Removed deprecated QResource usage.

This commit is contained in:
Leonardo 2020-12-11 14:14:54 -08:00
parent caed332b3f
commit eda0a705de
4 changed files with 12 additions and 48 deletions

View file

@ -412,23 +412,10 @@ bool lcLoadColorFile(lcFile& File)
void lcLoadDefaultColors() void lcLoadDefaultColors()
{ {
QResource Resource(":/resources/ldconfig.ldr"); lcDiskFile ConfigFile(":/resources/ldconfig.ldr");
if (!Resource.isValid()) if (ConfigFile.Open(QIODevice::ReadOnly))
return; lcLoadColorFile(ConfigFile);
QByteArray Data;
if (Resource.isCompressed())
Data = qUncompress(Resource.data(), Resource.size());
else
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
lcMemFile MemSettings;
MemSettings.WriteBuffer(Data.constData(), Data.size());
MemSettings.Seek(0, SEEK_SET);
lcLoadColorFile(MemSettings);
} }
int lcGetColorIndex(quint32 ColorCode) int lcGetColorIndex(quint32 ColorCode)

View file

@ -130,19 +130,12 @@ void lcContext::CreateShaderPrograms()
const auto LoadShader = [ShaderPrefix](const char* FileName, GLuint ShaderType) -> GLuint const auto LoadShader = [ShaderPrefix](const char* FileName, GLuint ShaderType) -> GLuint
{ {
QResource Resource(FileName); QFile ShaderFile(FileName);
if (!Resource.isValid()) if (!ShaderFile.open(QIODevice::ReadOnly))
return 0; return 0;
QByteArray Data; QByteArray Data = ShaderPrefix + ShaderFile.readAll();
if (Resource.isCompressed())
Data = qUncompress(Resource.data(), Resource.size());
else
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
Data = ShaderPrefix + Data;
const char* Source = Data.constData(); const char* Source = Data.constData();
const GLuint Shader = glCreateShader(ShaderType); const GLuint Shader = glCreateShader(ShaderType);

View file

@ -16,15 +16,10 @@ static bool lcLoadLDrawXML(std::map<int, int>& MaterialTable, std::map<int, std:
Data = File.readAll(); Data = File.readAll();
else else
{ {
QResource Resource(":/resources/ldraw.xml"); QFile DefaultFile(":/resources/ldraw.xml");
if (Resource.isValid()) if (DefaultFile.open(QIODevice::ReadOnly))
{ Data = DefaultFile.readAll();
if (Resource.isCompressed())
Data = qUncompress(Resource.data(), Resource.size());
else
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
}
} }
if (Data.isEmpty()) if (Data.isEmpty())

View file

@ -80,21 +80,10 @@ void MinifigWizard::LoadSettings()
} }
} }
QResource Resource(":/resources/minifig.ini"); lcDiskFile MinifigFile(":/resources/minifig.ini");
if (Resource.isValid()) if (MinifigFile.Open(QIODevice::ReadOnly))
{ ParseSettings(MinifigFile);
QByteArray Data;
if (Resource.isCompressed())
Data = qUncompress(Resource.data(), Resource.size());
else
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
lcMemFile MemSettings;
MemSettings.WriteBuffer(Data.constData(), Data.size());
ParseSettings(MemSettings);
}
} }
void MinifigWizard::OnInitialUpdate() void MinifigWizard::OnInitialUpdate()