Skip to content

Commit

Permalink
[stdstring] get rid of CStdString in pictures/
Browse files Browse the repository at this point in the history
  • Loading branch information
notspiff authored and Montellese committed Jan 7, 2015
1 parent a337745 commit a8cf288
Show file tree
Hide file tree
Showing 14 changed files with 196 additions and 196 deletions.
2 changes: 1 addition & 1 deletion xbmc/pictures/GUIDialogPictureInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void CGUIDialogPictureInfo::UpdatePictureInfo()
if (info == SLIDE_EXIF_DATE || info == SLIDE_EXIF_LONG_DATE || info == SLIDE_EXIF_LONG_DATE_TIME )
continue;

CStdString picInfo = g_infoManager.GetLabel(info);
std::string picInfo = g_infoManager.GetLabel(info);
if (!picInfo.empty())
{
CFileItemPtr item(new CFileItem(g_localizeStrings.Get(SLIDE_STRING_BASE + info)));
Expand Down
2 changes: 1 addition & 1 deletion xbmc/pictures/GUIDialogPictureInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ class CGUIDialogPictureInfo :
void UpdatePictureInfo();

CFileItemList* m_pictureInfo;
CStdString m_currentPicture;
std::string m_currentPicture;
};
20 changes: 10 additions & 10 deletions xbmc/pictures/GUIWindowPictures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void CGUIWindowPictures::OnInitWindow()
if (m_slideShowStarted)
{
CGUIWindowSlideShow* wndw = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
CStdString path;
std::string path;
if (wndw && wndw->GetCurrentSlide())
path = URIUtils::GetDirectory(wndw->GetCurrentSlide()->GetPath());
if (m_vecItems->IsPath(path))
Expand Down Expand Up @@ -268,7 +268,7 @@ bool CGUIWindowPictures::Update(const std::string &strDirectory, bool updateFilt
m_thumbLoader.Load(*m_vecItems);

CPictureThumbLoader thumbLoader;
CStdString thumb = thumbLoader.GetCachedImage(*m_vecItems, "thumb");
std::string thumb = thumbLoader.GetCachedImage(*m_vecItems, "thumb");
m_vecItems->SetArt("thumb", thumb);

return true;
Expand Down Expand Up @@ -301,7 +301,7 @@ bool CGUIWindowPictures::GetDirectory(const std::string &strDirectory, CFileItem
if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
return false;

CStdString label;
std::string label;
if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::Get().GetSources("pictures"), &label))
items.SetLabel(label);

Expand All @@ -320,7 +320,7 @@ bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow)
{
if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return false;
CFileItemPtr pItem = m_vecItems->Get(iItem);
CStdString strPicture = pItem->GetPath();
std::string strPicture = pItem->GetPath();

#ifdef HAS_DVD_DRIVE
if (pItem->IsDVD())
Expand Down Expand Up @@ -370,7 +370,7 @@ bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow)
return true;
}

void CGUIWindowPictures::OnShowPictureRecursive(const CStdString& strPath)
void CGUIWindowPictures::OnShowPictureRecursive(const std::string& strPath)
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (pSlideShow)
Expand All @@ -390,12 +390,12 @@ void CGUIWindowPictures::OnShowPictureRecursive(const CStdString& strPath)
}
}

void CGUIWindowPictures::OnSlideShowRecursive(const CStdString &strPicture)
void CGUIWindowPictures::OnSlideShowRecursive(const std::string &strPicture)
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (pSlideShow)
{
CStdString strExtensions;
std::string strExtensions;
CFileItemList items;
CGUIViewState* viewState=CGUIViewState::GetViewState(GetID(), items);
if (viewState)
Expand All @@ -416,7 +416,7 @@ void CGUIWindowPictures::OnSlideShowRecursive(const CStdString &strPicture)

void CGUIWindowPictures::OnSlideShowRecursive()
{
CStdString strEmpty = "";
std::string strEmpty = "";
OnSlideShowRecursive(m_vecItems->GetPath());
}

Expand All @@ -425,12 +425,12 @@ void CGUIWindowPictures::OnSlideShow()
OnSlideShow(m_vecItems->GetPath());
}

void CGUIWindowPictures::OnSlideShow(const CStdString &strPicture)
void CGUIWindowPictures::OnSlideShow(const std::string &strPicture)
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (pSlideShow)
{
CStdString strExtensions;
std::string strExtensions;
CFileItemList items;
CGUIViewState* viewState=CGUIViewState::GetViewState(GetID(), items);
if (viewState)
Expand Down
6 changes: 3 additions & 3 deletions xbmc/pictures/GUIWindowPictures.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class CGUIWindowPictures : public CGUIMediaWindow, public IBackgroundLoaderObser
void OnRegenerateThumbs();
virtual bool OnPlayMedia(int iItem);
bool ShowPicture(int iItem, bool startSlideShow);
void OnShowPictureRecursive(const CStdString& strPath);
void OnSlideShow(const CStdString& strPicture);
void OnShowPictureRecursive(const std::string& strPath);
void OnSlideShow(const std::string& strPicture);
void OnSlideShow();
void OnSlideShowRecursive(const CStdString& strPicture);
void OnSlideShowRecursive(const std::string& strPicture);
void OnSlideShowRecursive();
virtual void OnItemLoaded(CFileItem* pItem);
virtual void LoadPlayList(const std::string& strPlayList);
Expand Down
34 changes: 17 additions & 17 deletions xbmc/pictures/GUIWindowSlideShow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void CBackgroundPicLoader::Process()
count, totalTime, totalTime / count);
}

void CBackgroundPicLoader::LoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, const int maxWidth, const int maxHeight)
void CBackgroundPicLoader::LoadPic(int iPic, int iSlideNumber, const std::string &strFileName, const int maxWidth, const int maxHeight)
{
m_iPic = iPic;
m_iSlideNumber = iSlideNumber;
Expand Down Expand Up @@ -332,7 +332,7 @@ void CGUIWindowSlideShow::ShowPrevious()
}


void CGUIWindowSlideShow::Select(const CStdString& strPicture)
void CGUIWindowSlideShow::Select(const std::string& strPicture)
{
for (int i = 0; i < m_slides->Size(); ++i)
{
Expand Down Expand Up @@ -504,7 +504,7 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
if (!m_Image[m_iCurrentPic].IsLoaded() && !m_pBackgroundLoader->IsLoading())
{ // load first image
CFileItemPtr item = m_slides->Get(m_iCurrentSlide);
CStdString picturePath = GetPicturePath(item.get());
std::string picturePath = GetPicturePath(item.get());
if (!picturePath.empty())
{
if (item->IsVideo())
Expand Down Expand Up @@ -532,7 +532,7 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
{ // load the next image
m_iLastFailedNextSlide = -1;
CFileItemPtr item = m_slides->Get(m_iNextSlide);
CStdString picturePath = GetPicturePath(item.get());
std::string picturePath = GetPicturePath(item.get());
if (!picturePath.empty() && (!item->IsVideo() || !m_bSlideShow || m_bPause))
{
if (item->IsVideo())
Expand Down Expand Up @@ -940,7 +940,7 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)

case GUI_MSG_SHOW_PICTURE:
{
CStdString strFile = message.GetStringParam();
std::string strFile = message.GetStringParam();
Reset();
CFileItem item(strFile, false);
Add(&item);
Expand All @@ -950,7 +950,7 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)

case GUI_MSG_START_SLIDESHOW:
{
CStdString strFolder = message.GetStringParam();
std::string strFolder = message.GetStringParam();
unsigned int iParams = message.GetParam1();
std::string beginSlidePath = message.GetStringParam(1);
//decode params
Expand Down Expand Up @@ -1129,7 +1129,7 @@ CSlideShowPic::DISPLAY_EFFECT CGUIWindowSlideShow::GetDisplayEffect(int iSlideNu
return CSlideShowPic::EFFECT_NO_TIMEOUT;
}

void CGUIWindowSlideShow::OnLoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, CBaseTexture* pTexture, bool bFullSize)
void CGUIWindowSlideShow::OnLoadPic(int iPic, int iSlideNumber, const std::string &strFileName, CBaseTexture* pTexture, bool bFullSize)
{
if (pTexture)
{
Expand All @@ -1148,7 +1148,7 @@ void CGUIWindowSlideShow::OnLoadPic(int iPic, int iSlideNumber, const CStdString
if (URIUtils::IsInRAR(m_slides->Get(m_iCurrentSlide)->GetPath()) || URIUtils::IsInZIP(m_slides->Get(m_iCurrentSlide)->GetPath())) // move to top for cbr/cbz
{
CURL url(m_slides->Get(m_iCurrentSlide)->GetPath());
CStdString strHostName = url.GetHostName();
std::string strHostName = url.GetHostName();
if (URIUtils::HasExtension(strHostName, ".cbr|.cbz"))
{
m_Image[iPic].m_bIsComic = true;
Expand Down Expand Up @@ -1188,10 +1188,10 @@ int CGUIWindowSlideShow::CurrentSlide() const
return m_iCurrentSlide + 1;
}

void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath,
void CGUIWindowSlideShow::AddFromPath(const std::string &strPath,
bool bRecursive,
SortBy method, SortOrder order, SortAttribute sortAttributes,
const CStdString &strExtensions)
const std::string &strExtensions)
{
if (strPath!="")
{
Expand All @@ -1208,12 +1208,12 @@ void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath,
}
}

void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath,
void CGUIWindowSlideShow::RunSlideShow(const std::string &strPath,
bool bRecursive /* = false */, bool bRandom /* = false */,
bool bNotRandom /* = false */, const CStdString &beginSlidePath /* = "" */,
bool bNotRandom /* = false */, const std::string &beginSlidePath /* = "" */,
bool startSlideShow /* = true */, SortBy method /* = SortByLabel */,
SortOrder order /* = SortOrderAscending */, SortAttribute sortAttributes /* = SortAttributeNone */,
const CStdString &strExtensions)
const std::string &strExtensions)
{
// stop any video
if (g_application.m_pPlayer->IsPlayingVideo())
Expand Down Expand Up @@ -1249,12 +1249,12 @@ void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath,
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
}

void CGUIWindowSlideShow::AddItems(const CStdString &strPath, path_set *recursivePaths, SortBy method, SortOrder order, SortAttribute sortAttributes)
void CGUIWindowSlideShow::AddItems(const std::string &strPath, path_set *recursivePaths, SortBy method, SortOrder order, SortAttribute sortAttributes)
{
// check whether we've already added this path
if (recursivePaths)
{
CStdString path(strPath);
std::string path(strPath);
URIUtils::RemoveSlashAtEnd(path);
if (recursivePaths->find(path) != recursivePaths->end())
return;
Expand Down Expand Up @@ -1289,10 +1289,10 @@ void CGUIWindowSlideShow::GetCheckedSize(float width, float height, int &maxWidt
maxHeight = g_Windowing.GetMaxTextureSize();
}

CStdString CGUIWindowSlideShow::GetPicturePath(CFileItem *item)
std::string CGUIWindowSlideShow::GetPicturePath(CFileItem *item)
{
bool isVideo = item->IsVideo();
CStdString picturePath = item->GetPath();
std::string picturePath = item->GetPath();
if (isVideo)
{
picturePath = item->GetArt("thumb");
Expand Down
26 changes: 13 additions & 13 deletions xbmc/pictures/GUIWindowSlideShow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CBackgroundPicLoader : public CThread
~CBackgroundPicLoader();

void Create(CGUIWindowSlideShow *pCallback);
void LoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, const int maxWidth, const int maxHeight);
void LoadPic(int iPic, int iSlideNumber, const std::string &strFileName, const int maxWidth, const int maxHeight);
bool IsLoading() { return m_isLoading;};
int SlideNumber() const { return m_iSlideNumber; }
int Pic() const { return m_iPic; }
Expand All @@ -50,7 +50,7 @@ class CBackgroundPicLoader : public CThread
void Process();
int m_iPic;
int m_iSlideNumber;
CStdString m_strFileName;
std::string m_strFileName;
int m_maxWidth;
int m_maxHeight;

Expand All @@ -71,22 +71,22 @@ class CGUIWindowSlideShow : public CGUIWindow
bool IsPlaying() const;
void ShowNext();
void ShowPrevious();
void Select(const CStdString& strPicture);
void Select(const std::string& strPicture);
const CFileItemList &GetSlideShowContents();
void GetSlideShowContents(CFileItemList &list);
const CFileItemPtr GetCurrentSlide();
void RunSlideShow(const CStdString &strPath, bool bRecursive = false,
void RunSlideShow(const std::string &strPath, bool bRecursive = false,
bool bRandom = false, bool bNotRandom = false,
const CStdString &beginSlidePath="", bool startSlideShow = true,
const std::string &beginSlidePath="", bool startSlideShow = true,
SortBy method = SortByLabel,
SortOrder order = SortOrderAscending,
SortAttribute sortAttributes = SortAttributeNone,
const CStdString &strExtensions="");
void AddFromPath(const CStdString &strPath, bool bRecursive,
const std::string &strExtensions="");
void AddFromPath(const std::string &strPath, bool bRecursive,
SortBy method = SortByLabel,
SortOrder order = SortOrderAscending,
SortAttribute sortAttributes = SortAttributeNone,
const CStdString &strExtensions="");
const std::string &strExtensions="");
void StartSlideShow();
bool InSlideShow() const;
virtual bool OnMessage(CGUIMessage& message);
Expand All @@ -95,7 +95,7 @@ class CGUIWindowSlideShow : public CGUIWindow
virtual void Render();
virtual void Process(unsigned int currentTime, CDirtyRegionList &regions);
virtual void OnDeinitWindow(int nextWindowID);
void OnLoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, CBaseTexture* pTexture, bool bFullSize);
void OnLoadPic(int iPic, int iSlideNumber, const std::string &strFileName, CBaseTexture* pTexture, bool bFullSize);
int NumSlides() const;
int CurrentSlide() const;
void Shuffle();
Expand All @@ -104,8 +104,8 @@ class CGUIWindowSlideShow : public CGUIWindow
int GetDirection() const { return m_iDirection; }
void SetDirection(int direction); // -1: rewind, 1: forward
private:
typedef std::set<CStdString> path_set; // set to track which paths we're adding
void AddItems(const CStdString &strPath, path_set *recursivePaths,
typedef std::set<std::string> path_set; // set to track which paths we're adding
void AddItems(const std::string &strPath, path_set *recursivePaths,
SortBy method = SortByLabel,
SortOrder order = SortOrderAscending,
SortAttribute sortAttributes = SortAttributeNone);
Expand All @@ -118,7 +118,7 @@ class CGUIWindowSlideShow : public CGUIWindow
void ZoomRelative(float fZoom, bool immediate = false);
void Move(float fX, float fY);
void GetCheckedSize(float width, float height, int &maxWidth, int &maxHeight);
CStdString GetPicturePath(CFileItem *item);
std::string GetPicturePath(CFileItem *item);
int GetNextSlide();

void AnnouncePlayerPlay(const CFileItemPtr& item);
Expand Down Expand Up @@ -156,6 +156,6 @@ class CGUIWindowSlideShow : public CGUIWindow
DllImageLib m_ImageLib;
RESOLUTION m_Resolution;
CCriticalSection m_slideSection;
CStdString m_strExtensions;
std::string m_strExtensions;
CPoint m_firstGesturePoint;
};
4 changes: 2 additions & 2 deletions xbmc/pictures/Picture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extern "C" {

using namespace XFILE;

bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width, int height, int stride, const CStdString &thumbFile)
bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width, int height, int stride, const std::string &thumbFile)
{
CLog::Log(LOGDEBUG, "cached image '%s' size %dx%d", thumbFile.c_str(), width, height);
if (URIUtils::HasExtension(thumbFile, ".jpg"))
Expand Down Expand Up @@ -72,7 +72,7 @@ bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width
return ret;
}

CThumbnailWriter::CThumbnailWriter(unsigned char* buffer, int width, int height, int stride, const CStdString& thumbFile)
CThumbnailWriter::CThumbnailWriter(unsigned char* buffer, int width, int height, int stride, const std::string& thumbFile)
{
m_buffer = buffer;
m_width = width;
Expand Down
9 changes: 5 additions & 4 deletions xbmc/pictures/Picture.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
* <http://www.gnu.org/licenses/>.
*
*/
#include "utils/StdString.h"
#include "utils/Job.h"
#include <string>
#include <vector>

class CBaseTexture;

class CPicture
{
public:
static bool CreateThumbnailFromSurface(const unsigned char* buffer, int width, int height, int stride, const CStdString &thumbFile);
static bool CreateThumbnailFromSurface(const unsigned char* buffer, int width, int height, int stride, const std::string &thumbFile);

/*! \brief Create a tiled thumb of the given files
\param files the files to create the thumb from
Expand Down Expand Up @@ -64,7 +65,7 @@ class CThumbnailWriter : public CJob
{
public:
//WARNING: buffer is deleted from DoWork()
CThumbnailWriter(unsigned char* buffer, int width, int height, int stride, const CStdString& thumbFile);
CThumbnailWriter(unsigned char* buffer, int width, int height, int stride, const std::string& thumbFile);
~CThumbnailWriter();
bool DoWork();

Expand All @@ -73,6 +74,6 @@ class CThumbnailWriter : public CJob
int m_width;
int m_height;
int m_stride;
CStdString m_thumbFile;
std::string m_thumbFile;
};

4 changes: 2 additions & 2 deletions xbmc/pictures/PictureInfoLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
*/

#include "BackgroundInfoLoader.h"
#include "utils/StdString.h"
#include <string>

class CPictureInfoLoader : public CBackgroundInfoLoader
{
public:
CPictureInfoLoader();
virtual ~CPictureInfoLoader();

void UseCacheOnHD(const CStdString& strFileName);
void UseCacheOnHD(const std::string& strFileName);
virtual bool LoadItem(CFileItem* pItem);
virtual bool LoadItemCached(CFileItem* pItem);
virtual bool LoadItemLookup(CFileItem* pItem);
Expand Down
Loading

0 comments on commit a8cf288

Please sign in to comment.