Skip to content

Commit

Permalink
Merge pull request #10389 from tamland/hyphenfix
Browse files Browse the repository at this point in the history
[guilib] drop support for using hyphen as none value
  • Loading branch information
ronie committed Feb 24, 2017
2 parents 7e214f1 + a0fb0e9 commit e1c28e2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 16 deletions.
7 changes: 5 additions & 2 deletions xbmc/TextureCache.cpp
Expand Up @@ -62,7 +62,9 @@ void CTextureCache::Deinitialize()

bool CTextureCache::IsCachedImage(const std::string &url) const
{
if (url != "-" && !CURL::IsFullPath(url))
if (url.empty())
return false;
if (!CURL::IsFullPath(url))
return true;
if (URIUtils::PathHasParent(url, "special://skin", true) ||
URIUtils::PathHasParent(url, "special://temp", true) ||
Expand All @@ -83,7 +85,8 @@ bool CTextureCache::HasCachedImage(const std::string &url)
std::string CTextureCache::GetCachedImage(const std::string &image, CTextureDetails &details, bool trackUsage)
{
std::string url = CTextureUtils::UnwrapImageURL(image);

if (url.empty())
return "";
if (IsCachedImage(url))
return url;

Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/Edl.cpp
Expand Up @@ -820,7 +820,7 @@ std::string CEdl::GetInfo() const
if (HasSceneMarker())
strInfo += StringUtils::Format("s%" PRIuS, m_vecSceneMarkers.size());

return strInfo.empty() ? "-" : strInfo;
return strInfo;
}

bool CEdl::InCut(const int iSeek, Cut *pCut)
Expand Down
6 changes: 2 additions & 4 deletions xbmc/guilib/GUIControlFactory.cpp
Expand Up @@ -355,7 +355,7 @@ bool CGUIControlFactory::GetTexture(const TiXmlNode* pRootNode, const char* strT
const char *background = pNode->Attribute("background");
if (background && strnicmp(background, "true", 4) == 0)
image.useLarge = true;
image.filename = (pNode->FirstChild() && pNode->FirstChild()->ValueStr() != "-") ? pNode->FirstChild()->Value() : "";
image.filename = pNode->FirstChild() ? pNode->FirstChild()->Value() : "";
return true;
}

Expand Down Expand Up @@ -575,7 +575,7 @@ bool CGUIControlFactory::GetInfoLabelFromElement(const TiXmlElement *element, CG
return false;

std::string label = element->FirstChild()->Value();
if (label.empty() || label == "-")
if (label.empty())
return false;

std::string fallback = XMLUtils::GetAttribute(element, "fallback");
Expand Down Expand Up @@ -645,8 +645,6 @@ bool CGUIControlFactory::GetString(const TiXmlNode* pRootNode, const char *strTa
{
if (!XMLUtils::GetString(pRootNode, strTag, text))
return false;
if (text == "-")
text.clear();
if (StringUtils::IsNaturalNumber(text))
text = g_localizeStrings.Get(atoi(text.c_str()));
return true;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/GUIFontManager.cpp
Expand Up @@ -283,7 +283,7 @@ CGUIFont* GUIFontManager::GetFont(const std::string& strFontName, bool fallback
return pFont;
}
// fall back to "font13" if we have none
if (fallback && !strFontName.empty() && strFontName != "-" && !StringUtils::EqualsNoCase(strFontName, "font13"))
if (fallback && !strFontName.empty() && !StringUtils::EqualsNoCase(strFontName, "font13"))
return GetFont("font13");
return NULL;
}
Expand Down
6 changes: 3 additions & 3 deletions xbmc/guilib/GUIInfoTypes.cpp
Expand Up @@ -98,11 +98,11 @@ bool CGUIInfoColor::Update()

void CGUIInfoColor::Parse(const std::string &label, int context)
{
// Check for the standard $INFO[] block layout, and strip it if present
std::string label2 = label;
if (label == "-")
if (label.empty())
return;

// Check for the standard $INFO[] block layout, and strip it if present
std::string label2 = label;
if (StringUtils::StartsWithNoCase(label, "$var["))
{
label2 = label.substr(5, label.length() - 6);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/TextureManager.cpp
Expand Up @@ -239,7 +239,7 @@ CGUITextureManager::~CGUITextureManager(void)
/************************************************************************/
bool CGUITextureManager::CanLoad(const std::string &texturePath)
{
if (texturePath == "-")
if (texturePath.empty())
return false;

if (!CURL::IsFullPath(texturePath))
Expand Down
2 changes: 0 additions & 2 deletions xbmc/music/dialogs/GUIDialogMusicInfo.cpp
Expand Up @@ -429,8 +429,6 @@ void CGUIDialogMusicInfo::OnGetThumb()
newThumb = localThumb;
else if (CFile::Exists(result))
newThumb = result;
else // none
newThumb = "-"; // force local thumbs to be ignored

// update thumb in the database
CMusicDatabase db;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/music/dialogs/GUIDialogSongInfo.cpp
Expand Up @@ -365,7 +365,7 @@ void CGUIDialogSongInfo::OnGetThumb()

std::string newThumb;
if (result == "thumb://None")
newThumb = "-";
newThumb = "";
else if (result == "thumb://allmusic.com")
newThumb.clear();
else if (result == "thumb://Local")
Expand Down
2 changes: 1 addition & 1 deletion xbmc/windows/GUIWindowLoginScreen.cpp
Expand Up @@ -215,7 +215,7 @@ void CGUIWindowLoginScreen::Update()
strLabel = StringUtils::Format(g_localizeStrings.Get(20112).c_str(), profile->getDate().c_str());
item->SetLabel2(strLabel);
item->SetArt("thumb", profile->getThumb());
if (profile->getThumb().empty() || profile->getThumb() == "-")
if (profile->getThumb().empty())
item->SetArt("thumb", "DefaultUser.png");
item->SetLabelPreformatted(true);
m_vecItems->Add(item);
Expand Down

0 comments on commit e1c28e2

Please sign in to comment.