Commit 3d9e4928 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Do not use the fromAscii() and toAscii() functions.



They are deprecated in Qt 5. Use fromLatin1() and toLatin1() instead. In
Qt 5, these always do the same thing as their "Ascii" counterparts. The
same goes for Qt 4, provided QTextCodec::setCodecForCStrings has not
been set, which it hasn't.

Change-Id: I04edeb376762b6671eff8156094f0d5e2cb8e1ea
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 903281b3
......@@ -2368,7 +2368,7 @@ static void qDumpQObjectProperty(QDumper &d)
if (dotPos == -1)
return;
iname.remove(0, dotPos + 1);
const int index = mob->indexOfProperty(iname.toAscii());
const int index = mob->indexOfProperty(iname.toLatin1());
if (index == -1)
return;
const QMetaProperty mop = mob->property(index);
......
......@@ -585,10 +585,10 @@ int main(int argc, char *argv[])
// find all QMetaObjects reachable when the specified module is imported
if (action != Path) {
importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii();
importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toLatin1();
} else {
// pluginImportVersion can be empty
importCode += QString("import \".\" %2\n").arg(pluginImportVersion).toAscii();
importCode += QString("import \".\" %2\n").arg(pluginImportVersion).toLatin1();
}
// create a component with these imports to make sure the imports are valid
......
......@@ -339,7 +339,7 @@ void SshConnectionPrivate::handleIncomingData()
e.errorString);
} catch (Botan::Exception &e) {
closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "",
tr("Botan library exception: %1").arg(QString::fromAscii(e.what())));
tr("Botan library exception: %1").arg(QString::fromLatin1(e.what())));
}
}
......
......@@ -77,7 +77,7 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke
}
return true;
} catch (Botan::Exception &e) {
m_error = tr("Error generating key: %1").arg(QString::fromAscii(e.what()));
m_error = tr("Error generating key: %1").arg(QString::fromLatin1(e.what()));
return false;
}
}
......
......@@ -207,7 +207,7 @@ void SshRemoteProcess::sendSignal(Signal signal)
d->m_sendFacility.sendChannelSignalPacket(d->remoteChannel(), signalString);
}
} catch (Botan::Exception &e) {
setErrorString(QString::fromAscii(e.what()));
setErrorString(QString::fromLatin1(e.what()));
d->closeChannel();
}
}
......
......@@ -125,7 +125,7 @@ QString ConsoleProcess::msgCannotCreateTempDir(const QString & dir, const QStrin
QString ConsoleProcess::msgUnexpectedOutput(const QByteArray &what)
{
return tr("Unexpected output from helper program (%1).").arg(QString::fromAscii(what));
return tr("Unexpected output from helper program (%1).").arg(QString::fromLatin1(what));
}
QString ConsoleProcess::msgCannotChangeToWorkDir(const QString & dir, const QString &why)
......
......@@ -389,7 +389,7 @@ bool PersistentSettingsWriter::save(const QVariantMap &data, QWidget *parent) co
w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE ") + m_docType + QLatin1Char('>'));
w.writeComment(QString::fromAscii(" Written by %1 %2, %3. ").
w.writeComment(QString::fromLatin1(" Written by %1 %2, %3. ").
arg(QCoreApplication::applicationName(),
QCoreApplication::applicationVersion(),
QDateTime::currentDateTime().toString(Qt::ISODate)));
......
......@@ -117,7 +117,7 @@ private:
}
bool atEnd() const { return m_pos == m_portsSpec.length(); }
char nextChar() const { return m_portsSpec.at(m_pos).toAscii(); }
char nextChar() const { return m_portsSpec.at(m_pos).toLatin1(); }
PortList m_portList;
int m_pos;
......
......@@ -279,7 +279,7 @@ QStringList QtcProcess::splitArgs(const QString &_args, bool abortOnMeta, SplitE
inline static bool isQuoteMeta(QChar cUnicode)
{
char c = cUnicode.toAscii();
char c = cUnicode.toLatin1();
return c == '\\' || c == '\'' || c == '"' || c == '$';
}
......
......@@ -129,7 +129,7 @@ public:
logger->appendError(ErrorMessage::NoteLevel,
ZConfLib::tr("%1: log of previous daemon run is: '%2'.\n")
.arg(name())
.arg(QString::fromAscii(logBA.constData(), logBA.size())));
.arg(QString::fromLatin1(logBA.constData(), logBA.size())));
qDebug()<<logBA.size()<<oldLog.error()<<oldLog.errorString();
}
oldLog.close();
......
......@@ -85,7 +85,7 @@ void AndroidRunner::checkPID()
qint64 pid = -1;
QList<QByteArray> procs = psProc.readAll().split('\n');
foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith(m_packageName.toAscii())) {
if (proc.trimmed().endsWith(m_packageName.toLatin1())) {
QRegExp rx(QLatin1String("(\\d+)"));
if (rx.indexIn(QLatin1String(proc), proc.indexOf(' ')) > 0) {
pid = rx.cap(1).toLongLong();
......@@ -259,7 +259,7 @@ void AndroidRunner::logcatReadStandardOutput()
m_logcat += m_adbLogcatProcess.readAllStandardOutput();
bool keepLastLine = m_logcat.endsWith('\n');
QByteArray line;
QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toAscii());
QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1());
foreach (line, m_logcat.split('\n')) {
if (!line.contains(pid))
continue;
......
......@@ -153,7 +153,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// ------------- ClearCasePlugin
......
......@@ -1149,7 +1149,7 @@ void CMakeCbpParser::parseAdd()
compilerOption[assignIndex] = ' ';
}
m_defines.append("#define ");
m_defines.append(compilerOption.mid(macroNameIndex).toAscii());
m_defines.append(compilerOption.mid(macroNameIndex).toLatin1());
m_defines.append('\n');
}
}
......
......@@ -141,7 +141,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE KeyboardMappingScheme>"));
w.writeComment(QString::fromAscii(" Written by Qt Creator %1, %2. ").
w.writeComment(QString::fromLatin1(" Written by Qt Creator %1, %2. ").
arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
QDateTime::currentDateTime().toString(Qt::ISODate)));
w.writeStartElement(ctx.mappingElement);
......
......@@ -1094,7 +1094,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
case ParseComment: {
// comments have locale attributes. We want the default, English one
QString locale = atts.value(QLatin1String(localeAttributeC)).toString();
const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toAscii());
const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toLatin1());
if (locale.isEmpty()) {
data.comment = comment;
} else {
......
......@@ -158,7 +158,7 @@ void CodePasterProtocol::pasteFinished()
qWarning("Error pasting: %s", qPrintable(m_pasteReply->errorString()));
} else {
// Cut out the href-attribute
QString contents = QString::fromAscii(m_pasteReply->readAll());
QString contents = QString::fromLatin1(m_pasteReply->readAll());
int hrefPos = contents.indexOf(QLatin1String("href=\""));
if (hrefPos != -1) {
hrefPos += 6;
......@@ -189,7 +189,7 @@ void CodePasterProtocol::fetchFinished()
if (error) {
content = m_fetchReply->errorString();
} else {
content = QString::fromAscii(m_fetchReply->readAll()); // Codepaster does not support special characters.
content = QString::fromLatin1(m_fetchReply->readAll()); // Codepaster does not support special characters.
if (debug)
qDebug() << content;
if (content.contains(QLatin1String("<B>No such paste!</B>"))) {
......@@ -209,7 +209,7 @@ void CodePasterProtocol::listFinished()
Core::ICore::messageManager()->printToOutputPane(m_listReply->errorString(), true);
} else {
const QByteArray data = m_listReply->readAll();
const QStringList lines = QString::fromAscii(data).split(QLatin1Char('\n'));
const QStringList lines = QString::fromLatin1(data).split(QLatin1Char('\n'));
emit listDone(name(), lines);
}
m_listReply->deleteLater();
......
......@@ -119,7 +119,7 @@ void PasteBinDotCaProtocol::pasteFinished()
} else {
/// returns ""SUCCESS:[id]""
const QByteArray data = m_pasteReply->readAll();
const QString link = QString::fromLatin1(urlC) + QString::fromAscii(data).remove(QLatin1String("SUCCESS:"));
const QString link = QString::fromLatin1(urlC) + QString::fromLatin1(data).remove(QLatin1String("SUCCESS:"));
emit pasteDone(link);
}
m_pasteReply->deleteLater();
......
......@@ -134,7 +134,7 @@ void PasteBinDotComProtocol::pasteFinished()
if (m_pasteReply->error()) {
qWarning("Pastebin.com protocol error: %s", qPrintable(m_pasteReply->errorString()));
} else {
emit pasteDone(QString::fromAscii(m_pasteReply->readAll()));
emit pasteDone(QString::fromLatin1(m_pasteReply->readAll()));
}
m_pasteReply->deleteLater();
......@@ -171,7 +171,7 @@ void PasteBinDotComProtocol::fetchFinished()
qDebug() << "fetchFinished: error" << m_fetchId << content;
} else {
title = QString::fromLatin1("Pastebin.com: %1").arg(m_fetchId);
content = QString::fromAscii(m_fetchReply->readAll());
content = QString::fromLatin1(m_fetchReply->readAll());
// Cut out from '<pre>' formatting
const int preEnd = content.lastIndexOf(QLatin1String("</pre>"));
if (preEnd != -1)
......
......@@ -574,7 +574,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
QString newDeclText = linkSelection.selectedText();
for (int i = 0; i < newDeclText.size(); ++i) {
if (newDeclText.at(i).toAscii() == 0)
if (newDeclText.at(i).toLatin1() == 0)
newDeclText[i] = QLatin1Char('\n');
}
newDeclText.append(QLatin1String("{}"));
......
......@@ -148,7 +148,7 @@ static inline const VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
static inline bool messageBoxQuestion(const QString &title, const QString &question, QWidget *parent = 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment