Example #1
0
void MCModInfoFrame::updateWithMod(Mod &m)
{
	if(m.type() == m.MOD_FOLDER)
	{
		clear();
		return;
	}

	QString text = "";
	QString name = "";
	if(m.name().isEmpty()) name = m.mmc_id();
	else name = m.name();

	if(m.homeurl().isEmpty()) text = name;
	else text = "<a href=\"" + m.homeurl() + "\">" + name + "</a>";
	if(!m.authors().isEmpty()) text += " by " + m.authors();

	setModText(text);

	if(m.description().isEmpty())
	{
		setModDescription(tr("No description provided in mcmod.info"));
	}
	else
	{
		setModDescription(m.description());
	}
}
Example #2
0
bool Mod::replace(Mod &with)
{
	if (!destroy())
		return false;
	bool success = false;
	auto t = with.type();

	if (t == MOD_ZIPFILE || t == MOD_SINGLEFILE)
	{
		QLOG_DEBUG() << "Copy: " << with.m_file.filePath() << " to " << m_file.filePath();
		success = QFile::copy(with.m_file.filePath(), m_file.filePath());
	}
	if (t == MOD_FOLDER)
	{
		success = copyPath(with.m_file.filePath(), m_file.path());
	}
	if (success)
	{
		m_name = with.m_name;
		m_mmc_id = with.m_mmc_id;
		m_mod_id = with.m_mod_id;
		m_version = with.m_version;
		m_mcversion = with.m_mcversion;
		m_description = with.m_description;
		m_authors = with.m_authors;
		m_credits = with.m_credits;
		m_homeurl = with.m_homeurl;
		m_type = with.m_type;
		m_file.refresh();
	}
	return success;
}
Example #3
0
bool Mod::strongCompare(const Mod &other) const
{
	return mmc_id() == other.mmc_id() && version() == other.version() && type() == other.type();
}