Replace {from,to}Ascii with {from,to}Latin1
authorK. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Sun, 9 Feb 2014 19:43:56 +0000 (11:43 -0800)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 24 Mar 2014 23:21:25 +0000 (00:21 +0100)
These have been deprecated since Qt 5.0, and rather than use
{from,to}Local8Bit I've decided to match the original functionality.

18 files changed:
src/client/networkmodel.cpp
src/client/treemodel.cpp
src/common/cliparser.cpp
src/common/eventmanager.cpp
src/common/ircchannel.cpp
src/common/ircuser.cpp
src/common/network.cpp
src/common/syncableobject.cpp
src/common/util.cpp
src/core/abstractsqlstorage.cpp
src/core/coreircchannel.cpp
src/core/corenetwork.cpp
src/core/coresessioneventprocessor.cpp
src/core/coreuserinputhandler.cpp
src/core/oidentdconfiggenerator.cpp
src/core/postgresqlstorage.cpp
src/core/sqlitestorage.cpp
src/uisupport/uistyle.cpp

index dc985bd..00811d8 100644 (file)
@@ -1102,7 +1102,7 @@ QList<QPair<NetworkId, BufferId> > 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;
 }
index 2f748d3..c03da2b 100644 (file)
@@ -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);
 }
 
 
index 350d812..5168ea2 100644 (file)
@@ -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;
index dd3bd4c..203ad8a 100644 (file)
@@ -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;
index dce038b..145a198 100644 (file)
@@ -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()));
 }
 
 
index 64f1bcd..d7276fd 100644 (file)
@@ -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()));
 }
 
 
index 09c33ff..1aa907d 100644 (file)
@@ -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();
 }
 
 
index 3d058ca..0a14203 100644 (file)
@@ -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);
 }
 
 
index b617bad..4797e72 100644 (file)
@@ -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);
 }
 
index dc14121..4554f3f 100644 (file)
@@ -409,7 +409,7 @@ void AbstractSqlMigrator::dumpStatus()
     qWarning() << "  bound Values:";
     QList<QVariant> 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();
 }
index 6423404..4f2f4f3 100644 (file)
@@ -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));
     }
 }
index 18f2784..b7d496a 100644 (file)
@@ -268,7 +268,7 @@ void CoreNetwork::putCmd(const QString &cmd, const QList<QByteArray> &params, co
 
     if (!prefix.isEmpty())
         msg += ":" + prefix + " ";
-    msg += cmd.toUpper().toAscii();
+    msg += cmd.toUpper().toLatin1();
 
     for (int i = 0; i < params.size(); i++) {
         msg += " ";
index 9a00537..bc7f88b 100644 (file)
@@ -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
index cc508cf..4f551f1 100644 (file)
@@ -819,10 +819,10 @@ int CoreUserInputHandler::lastParamOverrun(const QString &cmd, const QList<QByte
     // that means that the last message can be as long as:
     // 512 - nicklen - userlen - hostlen - commandlen - sum(param[0]..param[n-1])) - 2 (for CRLF) - 4 (":!@" + 1space between prefix and command) - max(paramcount - 1, 0) (space for simple params) - 2 (space and colon for last param)
     IrcUser *me = network()->me();
-    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++) {
index 6c17344..8c5f32b 100644 (file)
@@ -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();
 
index 299e739..56aaf54 100644 (file)
@@ -806,9 +806,9 @@ QList<NetworkInfo> 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<QVariant> 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<Message> PostgreSqlStorage::requestAllMsgs(UserId user, MsgId first, MsgId
 //   qDebug() << "   bound Values:";
 //   QList<QVariant> 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();
 
index b968679..311b47f 100644 (file)
@@ -828,9 +828,9 @@ QList<NetworkInfo> 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<QVariant> 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);
             }
         }
index 8228b8f..975c79d 100644 (file)
@@ -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);
 }