NOISSUE Add world icons and world icon reset button

This commit is contained in:
Petr Mrázek
2020-08-22 01:34:55 +02:00
parent c6c9feb3a2
commit 8a0027c73a
7 changed files with 108 additions and 2 deletions

View File

@ -138,14 +138,31 @@ void World::repath(const QFileInfo &file)
m_folderName = file.fileName();
if(file.isFile() && file.suffix() == "zip")
{
m_iconFile = QString();
readFromZip(file);
}
else if(file.isDir())
{
QFileInfo assumedIconPath(file.absoluteFilePath() + "/icon.png");
if(assumedIconPath.exists()) {
m_iconFile = assumedIconPath.absoluteFilePath();
}
readFromFS(file);
}
}
bool World::resetIcon()
{
if(m_iconFile.isNull()) {
return false;
}
if(QFile(m_iconFile).remove()) {
m_iconFile = QString();
return true;
}
return false;
}
void World::readFromFS(const QFileInfo &file)
{
auto bytes = getLevelDatDataFromFS(file);