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()
{
QResource Resource(":/resources/ldconfig.ldr");
lcDiskFile ConfigFile(":/resources/ldconfig.ldr");
if (!Resource.isValid())
return;
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);
if (ConfigFile.Open(QIODevice::ReadOnly))
lcLoadColorFile(ConfigFile);
}
int lcGetColorIndex(quint32 ColorCode)

View file

@ -130,19 +130,12 @@ void lcContext::CreateShaderPrograms()
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;
QByteArray Data;
if (Resource.isCompressed())
Data = qUncompress(Resource.data(), Resource.size());
else
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
Data = ShaderPrefix + Data;
QByteArray Data = ShaderPrefix + ShaderFile.readAll();
const char* Source = Data.constData();
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();
else
{
QResource Resource(":/resources/ldraw.xml");
QFile DefaultFile(":/resources/ldraw.xml");
if (Resource.isValid())
{
if (Resource.isCompressed())
Data = qUncompress(Resource.data(), Resource.size());
else
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
}
if (DefaultFile.open(QIODevice::ReadOnly))
Data = DefaultFile.readAll();
}
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())
{
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);
}
if (MinifigFile.Open(QIODevice::ReadOnly))
ParseSettings(MinifigFile);
}
void MinifigWizard::OnInitialUpdate()