multi deploy

other qt6 patches
This commit is contained in:
2022-01-31 19:54:19 +03:00
parent bdb2acb414
commit 604441efc3
7 changed files with 54 additions and 32 deletions

View File

@@ -303,9 +303,7 @@ QPIConfig::QPIConfig(const QString & path, QStringList dirs) {
return;
}
dev->close();
#if QT_VERSION_MAJOR > 5
stream.setEncoding(QStringConverter::Utf8);
#endif
setupCodec();
setFileName(cp);
open(QIODevice::ReadOnly);
parse();
@@ -350,16 +348,22 @@ void QPIConfig::setString(QString * str) {
void QPIConfig::setCodec(const char * codecName) {
codec = codecName;
setupCodec();
parse();
}
void QPIConfig::setupCodec() {
#if QT_VERSION_MAJOR <= 5
stream.setCodec(codecName);
stream.setCodec(codec.toLatin1().data());
#else
QString cn = QString(codecName).toLower().remove(' ').remove('-').trimmed();
QString cn = codec.toLower().remove(' ').remove('-').trimmed();
QStringConverter::Encoding sc = QStringConverter::System;
if (cn == "utf8" ) sc = QStringConverter::Utf8 ;
else if (cn == "utf16") sc = QStringConverter::Utf16;
stream.setEncoding(sc);
#endif
parse();
}
@@ -606,10 +610,7 @@ void QPIConfig::writeAll() {
stream.setString(buffer);
buffer->clear();
}
#if QT_VERSION_MAJOR <= 5
if (!codec.isEmpty())
stream.setCodec(codec.toLatin1().data());
#endif
setupCodec();
stream.seek(0);
buildFullNames(&root);
Branch b = allLeaves();
@@ -782,13 +783,10 @@ void QPIConfig::parse(QString content) {
} else {
stream.setString(&content);
}
setupCodec();
stream.seek(0);
other.clear();
lines = centry = 0;
#if QT_VERSION_MAJOR <= 5
if (!codec.isEmpty())
stream.setCodec(codec.toLatin1().data());
#endif
while (!stream.atEnd()) {
other.push_back(QString());
src = str = parseLine(stream.readLine());