From: K. Ernest (iFire) Lee Date: Sun, 9 Feb 2014 19:43:56 +0000 (-0800) Subject: Replace {from,to}Ascii with {from,to}Latin1 X-Git-Tag: 0.11.0~81 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=40601ae070413b727a68e35e5b8c619176c661b1 Replace {from,to}Ascii with {from,to}Latin1 These have been deprecated since Qt 5.0, and rather than use {from,to}Local8Bit I've decided to match the original functionality. --- diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index dc985bd8..00811d83 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -1102,7 +1102,7 @@ QList > NetworkModel::mimeDataToBufferList(const QMim if (!mimeContainsBufferList(mimeData)) return bufferList; - QStringList rawBufferList = QString::fromAscii(mimeData->data("application/Quassel/BufferItemList")).split(","); + QStringList rawBufferList = QString::fromLatin1(mimeData->data("application/Quassel/BufferItemList")).split(","); NetworkId networkId; BufferId bufferUid; foreach(QString rawBuffer, rawBufferList) { @@ -1130,7 +1130,7 @@ QMimeData *NetworkModel::mimeData(const QModelIndexList &indexes) const bufferlist << bufferid; } - mimeData->setData("application/Quassel/BufferItemList", bufferlist.join(",").toAscii()); + mimeData->setData("application/Quassel/BufferItemList", bufferlist.join(",").toLatin1()); return mimeData; } diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 2f748d3d..c03da2b0 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -304,7 +304,7 @@ QVariant PropertyMapItem::data(int column, int role) const return toolTip(column); case Qt::DisplayRole: case TreeModel::SortRole: // fallthrough, since SortRole should default to DisplayRole - return property(_propertyOrder[column].toAscii()); + return property(_propertyOrder[column].toLatin1()); default: return QVariant(); } @@ -317,7 +317,7 @@ bool PropertyMapItem::setData(int column, const QVariant &value, int role) return false; emit dataChanged(column); - return setProperty(_propertyOrder[column].toAscii(), value); + return setProperty(_propertyOrder[column].toLatin1(), value); } diff --git a/src/common/cliparser.cpp b/src/common/cliparser.cpp index 350d8125..5168ea22 100644 --- a/src/common/cliparser.cpp +++ b/src/common/cliparser.cpp @@ -126,8 +126,8 @@ bool CliParser::init(const QStringList &args) // if next arg is a short/long option/switch the current arg is one too if (nextArg == argsRaw.constEnd() || nextArg->startsWith("-")) { // switch - for (int i = 0; i < currentArg->mid(1).toAscii().size(); i++) { - name = currentArg->mid(1).toAscii().at(i); + for (int i = 0; i < currentArg->mid(1).toLatin1().size(); i++) { + name = currentArg->mid(1).toLatin1().at(i); if (!addShortArg(CliParserArg::CliArgSwitch, name)) return false; } } @@ -135,7 +135,7 @@ bool CliParser::init(const QStringList &args) else { // option // short options are not freely mixable with other shortargs - if (currentArg->mid(1).toAscii().size() > 1) { + if (currentArg->mid(1).toLatin1().size() > 1) { qWarning() << "Warning: Shortoptions may not be combined with other shortoptions or switches"; return false; } @@ -146,7 +146,7 @@ bool CliParser::init(const QStringList &args) skipNext = true; } else value = currentArg->toLocal8Bit(); - name = currentArg->mid(1).toAscii().at(0); + name = currentArg->mid(1).toLatin1().at(0); // we took one argument as argument to an option so skip it next time if (skipNext) currentArg++; if (!addShortArg(CliParserArg::CliArgOption, name, value)) return false; diff --git a/src/common/eventmanager.cpp b/src/common/eventmanager.cpp index dd3bd4c9..203ad8a2 100644 --- a/src/common/eventmanager.cpp +++ b/src/common/eventmanager.cpp @@ -126,7 +126,7 @@ int EventManager::findEventType(const QString &methodSignature_, const QString & int num = methodSignature.right(3).toUInt(); if (num > 0) { QString numericSig = methodSignature.left(methodSignature.length() - 3) + "Numeric"; - eventType = eventEnum().keyToValue(numericSig.toAscii()); + eventType = eventEnum().keyToValue(numericSig.toLatin1()); if (eventType < 0) { qWarning() << Q_FUNC_INFO << "Could not find EventType" << numericSig << "for handling" << methodSignature; return -1; @@ -136,7 +136,7 @@ int EventManager::findEventType(const QString &methodSignature_, const QString & } if (eventType < 0) - eventType = eventEnum().keyToValue(methodSignature.toAscii()); + eventType = eventEnum().keyToValue(methodSignature.toLatin1()); if (eventType < 0) { qWarning() << Q_FUNC_INFO << "Could not find EventType" << methodSignature; return -1; diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index dce038be..145a1986 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -97,7 +97,7 @@ QString IrcChannel::userModes(const QString &nick) const void IrcChannel::setCodecForEncoding(const QString &name) { - setCodecForEncoding(QTextCodec::codecForName(name.toAscii())); + setCodecForEncoding(QTextCodec::codecForName(name.toLatin1())); } @@ -109,7 +109,7 @@ void IrcChannel::setCodecForEncoding(QTextCodec *codec) void IrcChannel::setCodecForDecoding(const QString &name) { - setCodecForDecoding(QTextCodec::codecForName(name.toAscii())); + setCodecForDecoding(QTextCodec::codecForName(name.toLatin1())); } diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 64f1bcd2..d7276fdc 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -87,7 +87,7 @@ QStringList IrcUser::channels() const void IrcUser::setCodecForEncoding(const QString &name) { - setCodecForEncoding(QTextCodec::codecForName(name.toAscii())); + setCodecForEncoding(QTextCodec::codecForName(name.toLatin1())); } @@ -99,7 +99,7 @@ void IrcUser::setCodecForEncoding(QTextCodec *codec) void IrcUser::setCodecForDecoding(const QString &name) { - setCodecForDecoding(QTextCodec::codecForName(name.toAscii())); + setCodecForDecoding(QTextCodec::codecForName(name.toLatin1())); } diff --git a/src/common/network.cpp b/src/common/network.cpp index 09c33ff1..1aa907d8 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -455,7 +455,7 @@ QByteArray Network::encodeString(const QString &string) const if (_defaultCodecForEncoding) { return _defaultCodecForEncoding->fromUnicode(string); } - return string.toAscii(); + return string.toLatin1(); } @@ -476,7 +476,7 @@ QByteArray Network::encodeServerString(const QString &string) const if (_defaultCodecForServer) { return _defaultCodecForServer->fromUnicode(string); } - return string.toAscii(); + return string.toLatin1(); } diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index 3d058caa..0a142037 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -124,7 +124,7 @@ QVariantMap SyncableObject::toVariantMap() QVariant value(variantType, (const void *)0); QGenericReturnArgument genericvalue = QGenericReturnArgument(method.typeName(), value.data()); - QMetaObject::invokeMethod(this, methodname.toAscii(), genericvalue); + QMetaObject::invokeMethod(this, methodname.toLatin1(), genericvalue); properties[SignalProxy::ExtendedMetaObject::methodBaseName(method)] = value; } @@ -145,12 +145,12 @@ void SyncableObject::fromVariantMap(const QVariantMap &properties) continue; } - int propertyIndex = meta->indexOfProperty(propName.toAscii()); + int propertyIndex = meta->indexOfProperty(propName.toLatin1()); if (propertyIndex == -1 || !meta->property(propertyIndex).isWritable()) setInitValue(propName, iterator.value()); else - setProperty(propName.toAscii(), iterator.value()); + setProperty(propName.toLatin1(), iterator.value()); // qDebug() << "<<< SYNC:" << name << iterator.value(); iterator++; } @@ -163,9 +163,9 @@ bool SyncableObject::setInitValue(const QString &property, const QVariant &value handlername[7] = handlername[7].toUpper(); QString methodSignature = QString("%1(%2)").arg(handlername).arg(value.typeName()); - int methodIdx = metaObject()->indexOfMethod(methodSignature.toAscii().constData()); + int methodIdx = metaObject()->indexOfMethod(methodSignature.toLatin1().constData()); if (methodIdx < 0) { - QByteArray normedMethodName = QMetaObject::normalizedSignature(methodSignature.toAscii().constData()); + QByteArray normedMethodName = QMetaObject::normalizedSignature(methodSignature.toLatin1().constData()); methodIdx = metaObject()->indexOfMethod(normedMethodName.constData()); } if (methodIdx < 0) { @@ -173,7 +173,7 @@ bool SyncableObject::setInitValue(const QString &property, const QVariant &value } QGenericArgument param(value.typeName(), value.constData()); - return QMetaObject::invokeMethod(this, handlername.toAscii(), param); + return QMetaObject::invokeMethod(this, handlername.toLatin1(), param); } diff --git a/src/common/util.cpp b/src/common/util.cpp index b617bad3..4797e72b 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -121,8 +121,8 @@ QString decodeString(const QByteArray &input, QTextCodec *codec) //qDebug() << "Detected utf8:" << s; return s; } - //QTextCodec *codec = QTextCodec::codecForName(encoding.toAscii()); - if (!codec) return QString::fromAscii(input); + //QTextCodec *codec = QTextCodec::codecForName(encoding.toLatin1()); + if (!codec) return QString::fromLatin1(input); return codec->toUnicode(input); } diff --git a/src/core/abstractsqlstorage.cpp b/src/core/abstractsqlstorage.cpp index dc141217..4554f3f6 100644 --- a/src/core/abstractsqlstorage.cpp +++ b/src/core/abstractsqlstorage.cpp @@ -409,7 +409,7 @@ void AbstractSqlMigrator::dumpStatus() qWarning() << " bound Values:"; QList list = boundValues(); for (int i = 0; i < list.size(); ++i) - qWarning() << i << ": " << list.at(i).toString().toAscii().data(); + qWarning() << i << ": " << list.at(i).toString().toLatin1().data(); qWarning() << " Error Number:" << lastError().number(); qWarning() << " Error Message:" << lastError().text(); } diff --git a/src/core/coreircchannel.cpp b/src/core/coreircchannel.cpp index 64234044..4f2f4f31 100644 --- a/src/core/coreircchannel.cpp +++ b/src/core/coreircchannel.cpp @@ -61,7 +61,7 @@ void CoreIrcChannel::setEncrypted(bool e) if (topic().isEmpty()) return; - QByteArray decrypted = cipher()->decryptTopic(topic().toAscii()); + QByteArray decrypted = cipher()->decryptTopic(topic().toLatin1()); setTopic(decodeString(decrypted)); } } diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 18f27842..b7d496af 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -268,7 +268,7 @@ void CoreNetwork::putCmd(const QString &cmd, const QList ¶ms, co if (!prefix.isEmpty()) msg += ":" + prefix + " "; - msg += cmd.toUpper().toAscii(); + msg += cmd.toUpper().toLatin1(); for (int i = 0; i < params.size(); i++) { msg += " "; diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 9a00537e..bc7f88b8 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -127,7 +127,7 @@ void CoreSessionEventProcessor::processIrcEventAuthenticate(IrcEvent *e) construct.append(net->saslAccount()); construct.append(QChar(QChar::Null)); construct.append(net->saslPassword()); - QByteArray saslData = QByteArray(construct.toAscii().toBase64()); + QByteArray saslData = QByteArray(construct.toLatin1().toBase64()); saslData.prepend("AUTHENTICATE "); net->putRawLine(saslData); #ifdef HAVE_SSL diff --git a/src/core/coreuserinputhandler.cpp b/src/core/coreuserinputhandler.cpp index cc508cf8..4f551f1c 100644 --- a/src/core/coreuserinputhandler.cpp +++ b/src/core/coreuserinputhandler.cpp @@ -819,10 +819,10 @@ int CoreUserInputHandler::lastParamOverrun(const QString &cmd, const QListme(); - int maxLen = 480 - cmd.toAscii().count(); // educated guess in case we don't know us (yet?) + int maxLen = 480 - cmd.toLatin1().count(); // educated guess in case we don't know us (yet?) if (me) - maxLen = 512 - serverEncode(me->nick()).count() - serverEncode(me->user()).count() - serverEncode(me->host()).count() - cmd.toAscii().count() - 6; + maxLen = 512 - serverEncode(me->nick()).count() - serverEncode(me->user()).count() - serverEncode(me->host()).count() - cmd.toLatin1().count() - 6; if (!params.isEmpty()) { for (int i = 0; i < params.count() - 1; i++) { diff --git a/src/core/oidentdconfiggenerator.cpp b/src/core/oidentdconfiggenerator.cpp index 6c17344c..8c5f32ba 100644 --- a/src/core/oidentdconfiggenerator.cpp +++ b/src/core/oidentdconfiggenerator.cpp @@ -71,7 +71,7 @@ bool OidentdConfigGenerator::addSocket(const CoreIdentity *identity, const QHost Q_UNUSED(localAddress) Q_UNUSED(peerAddress) Q_UNUSED(peerPort) QString ident = identity->ident(); - _quasselConfig.append(_quasselStanzaTemplate.arg(localPort).arg(ident).arg(_configTag).toAscii()); + _quasselConfig.append(_quasselStanzaTemplate.arg(localPort).arg(ident).arg(_configTag).toLatin1()); bool ret = writeConfig(); diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index 299e7391..56aaf54c 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -806,9 +806,9 @@ QList PostgreSqlStorage::networks(UserId user) net.networkId = networksQuery.value(0).toInt(); net.networkName = networksQuery.value(1).toString(); net.identity = networksQuery.value(2).toInt(); - net.codecForServer = networksQuery.value(3).toString().toAscii(); - net.codecForEncoding = networksQuery.value(4).toString().toAscii(); - net.codecForDecoding = networksQuery.value(5).toString().toAscii(); + net.codecForServer = networksQuery.value(3).toString().toLatin1(); + net.codecForEncoding = networksQuery.value(4).toString().toLatin1(); + net.codecForDecoding = networksQuery.value(5).toString().toLatin1(); net.useRandomServer = networksQuery.value(6).toBool(); net.perform = networksQuery.value(7).toString().split("\n"); net.useAutoIdentify = networksQuery.value(8).toBool(); @@ -1023,7 +1023,7 @@ BufferInfo PostgreSqlStorage::bufferInfo(UserId user, const NetworkId &networkId qCritical() << " bound Values:"; QList list = query.boundValues().values(); for (int i = 0; i < list.size(); ++i) - qCritical() << i << ":" << list.at(i).toString().toAscii().data(); + qCritical() << i << ":" << list.at(i).toString().toLatin1().data(); Q_ASSERT(false); } db.commit(); @@ -1603,7 +1603,7 @@ QList PostgreSqlStorage::requestAllMsgs(UserId user, MsgId first, MsgId // qDebug() << " bound Values:"; // QList list = query.boundValues().values(); // for (int i = 0; i < list.size(); ++i) -// qCritical() << i << ": " << list.at(i).toString().toAscii().data(); +// qCritical() << i << ": " << list.at(i).toString().toLatin1().data(); // query.exec(); diff --git a/src/core/sqlitestorage.cpp b/src/core/sqlitestorage.cpp index b9686798..311b47f7 100644 --- a/src/core/sqlitestorage.cpp +++ b/src/core/sqlitestorage.cpp @@ -828,9 +828,9 @@ QList SqliteStorage::networks(UserId user) net.networkId = networksQuery.value(0).toInt(); net.networkName = networksQuery.value(1).toString(); net.identity = networksQuery.value(2).toInt(); - net.codecForServer = networksQuery.value(3).toString().toAscii(); - net.codecForEncoding = networksQuery.value(4).toString().toAscii(); - net.codecForDecoding = networksQuery.value(5).toString().toAscii(); + net.codecForServer = networksQuery.value(3).toString().toLatin1(); + net.codecForEncoding = networksQuery.value(4).toString().toLatin1(); + net.codecForDecoding = networksQuery.value(5).toString().toLatin1(); net.useRandomServer = networksQuery.value(6).toInt() == 1 ? true : false; net.perform = networksQuery.value(7).toString().split("\n"); net.useAutoIdentify = networksQuery.value(8).toInt() == 1 ? true : false; @@ -1110,7 +1110,7 @@ BufferInfo SqliteStorage::bufferInfo(UserId user, const NetworkId &networkId, Bu qCritical() << " bound Values:"; QList list = query.boundValues().values(); for (int i = 0; i < list.size(); ++i) - qCritical() << i << ":" << list.at(i).toString().toAscii().data(); + qCritical() << i << ":" << list.at(i).toString().toLatin1().data(); Q_ASSERT(false); } } diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 8228b8fe..975c79df 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -862,7 +862,7 @@ quint8 UiStyle::StyledMessage::senderHash() const if (chopCount < nick.size()) nick.chop(chopCount); } - quint16 hash = qChecksum(nick.toAscii().data(), nick.toAscii().size()); + quint16 hash = qChecksum(nick.toLatin1().data(), nick.toLatin1().size()); return (_senderHash = (hash & 0xf) + 1); }