GH-729 use mod mmc_id as name when name is empty

This commit is contained in:
Petr Mrázek 2015-09-30 23:30:55 +02:00
parent 477a1a88c6
commit ac8ff88061
2 changed files with 16 additions and 7 deletions

View File

@ -22,7 +22,7 @@
void MCModInfoFrame::updateWithMod(Mod &m) void MCModInfoFrame::updateWithMod(Mod &m)
{ {
if(m.type() == m.MOD_FOLDER) if (m.type() == m.MOD_FOLDER)
{ {
clear(); clear();
return; return;
@ -30,16 +30,21 @@ void MCModInfoFrame::updateWithMod(Mod &m)
QString text = ""; QString text = "";
QString name = ""; QString name = "";
if(m.name().isEmpty()) name = m.mmc_id(); if (m.name().isEmpty())
else name = m.name(); name = m.mmc_id();
else
name = m.name();
if(m.homeurl().isEmpty()) text = name; if (m.homeurl().isEmpty())
else text = "<a href=\"" + m.homeurl() + "\">" + name + "</a>"; text = name;
if(!m.authors().isEmpty()) text += " by " + m.authors(); else
text = "<a href=\"" + m.homeurl() + "\">" + name + "</a>";
if (!m.authors().isEmpty())
text += " by " + m.authors();
setModText(text); setModText(text);
if(m.description().isEmpty()) if (m.description().isEmpty())
{ {
setModDescription(tr("No description provided in mcmod.info")); setModDescription(tr("No description provided in mcmod.info"));
} }

View File

@ -57,6 +57,10 @@ public:
} }
QString name() const QString name() const
{ {
if(m_name.trimmed().isEmpty())
{
return m_mmc_id;
}
return m_name; return m_name;
} }