Corrected issue with Qt ASCII strings

This commit is contained in:
Digital Artifex
2025-08-05 04:39:28 -04:00
parent cbb65358d3
commit 342ffb0bc7

View File

@@ -2,12 +2,12 @@
ShaderPackModel::ShaderPackModel(QObject *parent) ShaderPackModel::ShaderPackModel(QObject *parent)
: QObject(parent), : QObject(parent),
m_shaderPackPath(QString("%1/.local/share/komplex/packs/default").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))), m_shaderPackPath(QString::fromLatin1("%1/.local/share/komplex/packs/default").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))),
m_shaderPackInstallPath(QString("%1/.local/share/komplex/packs").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))), m_shaderPackInstallPath(QString::fromLatin1("%1/.local/share/komplex/packs").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))),
m_shadersPath(QString("%1/.local/share/komplex/shaders").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))), m_shadersPath(QString::fromLatin1("%1/.local/share/komplex/shaders").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))),
m_imagesPath(QString("%1/.local/share/komplex/images").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))), m_imagesPath(QString::fromLatin1("%1/.local/share/komplex/images").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))),
m_cubeMapsPath(QString("%1/.local/share/komplex/cubemaps").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))), m_cubeMapsPath(QString::fromLatin1("%1/.local/share/komplex/cubemaps").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))),
m_videosPath(QString("%1/.local/share/komplex/videos").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))), m_videosPath(QString::fromLatin1("%1/.local/share/komplex/videos").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))),
m_json(QString()) m_json(QString())
{ {
} }
@@ -96,10 +96,10 @@ void ShaderPackModel::refreshShaderPacks()
bool valid = false; bool valid = false;
// Check if the pack directory contains a pack.json file // Check if the pack directory contains a pack.json file
if(packDir.exists("pack.json")) if(packDir.exists(QString::fromLatin1("pack.json")))
{ {
// Load the pack.json data // Load the pack.json data
QFile packFile(packDir.absoluteFilePath("pack.json")); QFile packFile(packDir.absoluteFilePath(QString::fromLatin1("pack.json")));
if (packFile.open(QIODevice::ReadOnly | QIODevice::Text)) if (packFile.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
QByteArray packData = packFile.readAll(); QByteArray packData = packFile.readAll();
@@ -120,7 +120,7 @@ void ShaderPackModel::refreshShaderPacks()
// If valid, add to the list of verified shader packs // If valid, add to the list of verified shader packs
if(valid) if(valid)
verifiedShaderPacks.insert(pack, packDir.absoluteFilePath("pack.json")); // Store the path to the pack.json file verifiedShaderPacks.insert(pack, packDir.absoluteFilePath(QString::fromLatin1("pack.json"))); // Store the path to the pack.json file
// Otherwise, log a warning // Otherwise, log a warning
else else
qWarning("Shader pack %s does not contain a valid pack.json file", qPrintable(pack)); qWarning("Shader pack %s does not contain a valid pack.json file", qPrintable(pack));
@@ -171,10 +171,10 @@ void ShaderPackModel::importShaderPack(const QString &filePath)
setState(Importing); // Set the state to Importing setState(Importing); // Set the state to Importing
// Check if the file is a zip or tarball // Check if the file is a zip or tarball
if(filePath.endsWith(".zip", Qt::CaseInsensitive)) if(filePath.endsWith(QString::fromLatin1(".zip"), Qt::CaseInsensitive))
command = QString("unzip -o %1 -d %2/%3").arg(file.absoluteFilePath(), m_shaderPackInstallPath, file.baseName()); command = QString::fromLatin1("unzip -o %1 -d %2/%3").arg(file.absoluteFilePath(), m_shaderPackInstallPath, file.baseName());
else if(filePath.endsWith(".tar.gz", Qt::CaseInsensitive) || filePath.endsWith(".tar", Qt::CaseInsensitive)) else if(filePath.endsWith(QString::fromLatin1(".tar.gz"), Qt::CaseInsensitive) || filePath.endsWith(QString::fromLatin1(".tar"), Qt::CaseInsensitive))
command = QString("tar -xf %1 -C %2/%3").arg(file.absoluteFilePath(), m_shaderPackInstallPath, file.baseName()); command = QString::fromLatin1("tar -xf %1 -C %2/%3").arg(file.absoluteFilePath(), m_shaderPackInstallPath, file.baseName());
else else
{ {
setState(Idle); // Reset state to Idle setState(Idle); // Reset state to Idle