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: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Christian Kandeler
2012-09-21 13:54:38 +02:00
parent 903281b352
commit 3d9e492860
44 changed files with 60 additions and 60 deletions
+1 -1
View File
@@ -2368,7 +2368,7 @@ static void qDumpQObjectProperty(QDumper &d)
if (dotPos == -1) if (dotPos == -1)
return; return;
iname.remove(0, dotPos + 1); iname.remove(0, dotPos + 1);
const int index = mob->indexOfProperty(iname.toAscii()); const int index = mob->indexOfProperty(iname.toLatin1());
if (index == -1) if (index == -1)
return; return;
const QMetaProperty mop = mob->property(index); const QMetaProperty mop = mob->property(index);
+2 -2
View File
@@ -585,10 +585,10 @@ int main(int argc, char *argv[])
// find all QMetaObjects reachable when the specified module is imported // find all QMetaObjects reachable when the specified module is imported
if (action != Path) { if (action != Path) {
importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii(); importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toLatin1();
} else { } else {
// pluginImportVersion can be empty // 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 // create a component with these imports to make sure the imports are valid
+1 -1
View File
@@ -339,7 +339,7 @@ void SshConnectionPrivate::handleIncomingData()
e.errorString); e.errorString);
} catch (Botan::Exception &e) { } catch (Botan::Exception &e) {
closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "", 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())));
} }
} }
+1 -1
View File
@@ -77,7 +77,7 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke
} }
return true; return true;
} catch (Botan::Exception &e) { } 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; return false;
} }
} }
+1 -1
View File
@@ -207,7 +207,7 @@ void SshRemoteProcess::sendSignal(Signal signal)
d->m_sendFacility.sendChannelSignalPacket(d->remoteChannel(), signalString); d->m_sendFacility.sendChannelSignalPacket(d->remoteChannel(), signalString);
} }
} catch (Botan::Exception &e) { } catch (Botan::Exception &e) {
setErrorString(QString::fromAscii(e.what())); setErrorString(QString::fromLatin1(e.what()));
d->closeChannel(); d->closeChannel();
} }
} }
+1 -1
View File
@@ -125,7 +125,7 @@ QString ConsoleProcess::msgCannotCreateTempDir(const QString & dir, const QStrin
QString ConsoleProcess::msgUnexpectedOutput(const QByteArray &what) 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) QString ConsoleProcess::msgCannotChangeToWorkDir(const QString & dir, const QString &why)
+1 -1
View File
@@ -389,7 +389,7 @@ bool PersistentSettingsWriter::save(const QVariantMap &data, QWidget *parent) co
w.setAutoFormattingIndent(1); // Historical, used to be QDom. w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument(); w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE ") + m_docType + QLatin1Char('>')); 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(), arg(QCoreApplication::applicationName(),
QCoreApplication::applicationVersion(), QCoreApplication::applicationVersion(),
QDateTime::currentDateTime().toString(Qt::ISODate))); QDateTime::currentDateTime().toString(Qt::ISODate)));
+1 -1
View File
@@ -117,7 +117,7 @@ private:
} }
bool atEnd() const { return m_pos == m_portsSpec.length(); } 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; PortList m_portList;
int m_pos; int m_pos;
+1 -1
View File
@@ -279,7 +279,7 @@ QStringList QtcProcess::splitArgs(const QString &_args, bool abortOnMeta, SplitE
inline static bool isQuoteMeta(QChar cUnicode) inline static bool isQuoteMeta(QChar cUnicode)
{ {
char c = cUnicode.toAscii(); char c = cUnicode.toLatin1();
return c == '\\' || c == '\'' || c == '"' || c == '$'; return c == '\\' || c == '\'' || c == '"' || c == '$';
} }
+1 -1
View File
@@ -129,7 +129,7 @@ public:
logger->appendError(ErrorMessage::NoteLevel, logger->appendError(ErrorMessage::NoteLevel,
ZConfLib::tr("%1: log of previous daemon run is: '%2'.\n") ZConfLib::tr("%1: log of previous daemon run is: '%2'.\n")
.arg(name()) .arg(name())
.arg(QString::fromAscii(logBA.constData(), logBA.size()))); .arg(QString::fromLatin1(logBA.constData(), logBA.size())));
qDebug()<<logBA.size()<<oldLog.error()<<oldLog.errorString(); qDebug()<<logBA.size()<<oldLog.error()<<oldLog.errorString();
} }
oldLog.close(); oldLog.close();
+2 -2
View File
@@ -85,7 +85,7 @@ void AndroidRunner::checkPID()
qint64 pid = -1; qint64 pid = -1;
QList<QByteArray> procs = psProc.readAll().split('\n'); QList<QByteArray> procs = psProc.readAll().split('\n');
foreach (const QByteArray &proc, procs) { foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith(m_packageName.toAscii())) { if (proc.trimmed().endsWith(m_packageName.toLatin1())) {
QRegExp rx(QLatin1String("(\\d+)")); QRegExp rx(QLatin1String("(\\d+)"));
if (rx.indexIn(QLatin1String(proc), proc.indexOf(' ')) > 0) { if (rx.indexIn(QLatin1String(proc), proc.indexOf(' ')) > 0) {
pid = rx.cap(1).toLongLong(); pid = rx.cap(1).toLongLong();
@@ -259,7 +259,7 @@ void AndroidRunner::logcatReadStandardOutput()
m_logcat += m_adbLogcatProcess.readAllStandardOutput(); m_logcat += m_adbLogcatProcess.readAllStandardOutput();
bool keepLastLine = m_logcat.endsWith('\n'); bool keepLastLine = m_logcat.endsWith('\n');
QByteArray line; 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')) { foreach (line, m_logcat.split('\n')) {
if (!line.contains(pid)) if (!line.contains(pid))
continue; continue;
+1 -1
View File
@@ -153,7 +153,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c) 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 // ------------- ClearCasePlugin
@@ -1149,7 +1149,7 @@ void CMakeCbpParser::parseAdd()
compilerOption[assignIndex] = ' '; compilerOption[assignIndex] = ' ';
} }
m_defines.append("#define "); m_defines.append("#define ");
m_defines.append(compilerOption.mid(macroNameIndex).toAscii()); m_defines.append(compilerOption.mid(macroNameIndex).toLatin1());
m_defines.append('\n'); m_defines.append('\n');
} }
} }
@@ -141,7 +141,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
w.setAutoFormattingIndent(1); // Historical, used to be QDom. w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument(); w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE KeyboardMappingScheme>")); 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), arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
QDateTime::currentDateTime().toString(Qt::ISODate))); QDateTime::currentDateTime().toString(Qt::ISODate)));
w.writeStartElement(ctx.mappingElement); w.writeStartElement(ctx.mappingElement);
+1 -1
View File
@@ -1094,7 +1094,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
case ParseComment: { case ParseComment: {
// comments have locale attributes. We want the default, English one // comments have locale attributes. We want the default, English one
QString locale = atts.value(QLatin1String(localeAttributeC)).toString(); 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()) { if (locale.isEmpty()) {
data.comment = comment; data.comment = comment;
} else { } else {
+3 -3
View File
@@ -158,7 +158,7 @@ void CodePasterProtocol::pasteFinished()
qWarning("Error pasting: %s", qPrintable(m_pasteReply->errorString())); qWarning("Error pasting: %s", qPrintable(m_pasteReply->errorString()));
} else { } else {
// Cut out the href-attribute // 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=\"")); int hrefPos = contents.indexOf(QLatin1String("href=\""));
if (hrefPos != -1) { if (hrefPos != -1) {
hrefPos += 6; hrefPos += 6;
@@ -189,7 +189,7 @@ void CodePasterProtocol::fetchFinished()
if (error) { if (error) {
content = m_fetchReply->errorString(); content = m_fetchReply->errorString();
} else { } 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) if (debug)
qDebug() << content; qDebug() << content;
if (content.contains(QLatin1String("<B>No such paste!</B>"))) { if (content.contains(QLatin1String("<B>No such paste!</B>"))) {
@@ -209,7 +209,7 @@ void CodePasterProtocol::listFinished()
Core::ICore::messageManager()->printToOutputPane(m_listReply->errorString(), true); Core::ICore::messageManager()->printToOutputPane(m_listReply->errorString(), true);
} else { } else {
const QByteArray data = m_listReply->readAll(); 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); emit listDone(name(), lines);
} }
m_listReply->deleteLater(); m_listReply->deleteLater();
@@ -119,7 +119,7 @@ void PasteBinDotCaProtocol::pasteFinished()
} else { } else {
/// returns ""SUCCESS:[id]"" /// returns ""SUCCESS:[id]""
const QByteArray data = m_pasteReply->readAll(); 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); emit pasteDone(link);
} }
m_pasteReply->deleteLater(); m_pasteReply->deleteLater();
@@ -134,7 +134,7 @@ void PasteBinDotComProtocol::pasteFinished()
if (m_pasteReply->error()) { if (m_pasteReply->error()) {
qWarning("Pastebin.com protocol error: %s", qPrintable(m_pasteReply->errorString())); qWarning("Pastebin.com protocol error: %s", qPrintable(m_pasteReply->errorString()));
} else { } else {
emit pasteDone(QString::fromAscii(m_pasteReply->readAll())); emit pasteDone(QString::fromLatin1(m_pasteReply->readAll()));
} }
m_pasteReply->deleteLater(); m_pasteReply->deleteLater();
@@ -171,7 +171,7 @@ void PasteBinDotComProtocol::fetchFinished()
qDebug() << "fetchFinished: error" << m_fetchId << content; qDebug() << "fetchFinished: error" << m_fetchId << content;
} else { } else {
title = QString::fromLatin1("Pastebin.com: %1").arg(m_fetchId); 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 // Cut out from '<pre>' formatting
const int preEnd = content.lastIndexOf(QLatin1String("</pre>")); const int preEnd = content.lastIndexOf(QLatin1String("</pre>"));
if (preEnd != -1) if (preEnd != -1)
@@ -574,7 +574,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
QString newDeclText = linkSelection.selectedText(); QString newDeclText = linkSelection.selectedText();
for (int i = 0; i < newDeclText.size(); ++i) { 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[i] = QLatin1Char('\n');
} }
newDeclText.append(QLatin1String("{}")); newDeclText.append(QLatin1String("{}"));
+1 -1
View File
@@ -148,7 +148,7 @@ static inline const VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c) 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) static inline bool messageBoxQuestion(const QString &title, const QString &question, QWidget *parent = 0)
+2 -2
View File
@@ -800,7 +800,7 @@ void CdbEngine::runEngine()
if (debug) if (debug)
qDebug("runEngine"); qDebug("runEngine");
foreach (const QString &breakEvent, m_options->breakEvents) foreach (const QString &breakEvent, m_options->breakEvents)
postCommand(QByteArray("sxe ") + breakEvent.toAscii(), 0); postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0);
// Break functions: each function must be fully qualified, // Break functions: each function must be fully qualified,
// else the debugger will slow down considerably. // else the debugger will slow down considerably.
foreach (const QString &breakFunctionS, m_options->breakFunctions) { foreach (const QString &breakFunctionS, m_options->breakFunctions) {
@@ -1260,7 +1260,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &cm
static inline bool isAsciiWord(const QString &s) static inline bool isAsciiWord(const QString &s)
{ {
foreach (const QChar &c, s) { foreach (const QChar &c, s) {
if (!c.isLetterOrNumber() || c.toAscii() == 0) if (!c.isLetterOrNumber() || c.toLatin1() == 0)
return false; return false;
} }
return true; return true;
+1 -1
View File
@@ -556,7 +556,7 @@ bool parseCdbDisassemblerLine(const QString &line, DisassemblerLine *dLine, uint
dLine->address = addressS.toULongLong(&ok, 16); dLine->address = addressS.toULongLong(&ok, 16);
if (!ok) if (!ok)
return false; return false;
dLine->rawData = QByteArray::fromHex(line.mid(rawDataPos, rawDataEnd - rawDataPos).toAscii()); dLine->rawData = QByteArray::fromHex(line.mid(rawDataPos, rawDataEnd - rawDataPos).toLatin1());
dLine->data = line.right(line.size() - instructionPos).trimmed(); dLine->data = line.right(line.size() - instructionPos).trimmed();
return true; return true;
} }
@@ -56,7 +56,7 @@ bool NameDemanglerPrivate::demangle(const QString &mangledName)
{ {
bool success; bool success;
try { try {
m_parseState.m_mangledName = mangledName.toAscii(); m_parseState.m_mangledName = mangledName.toLatin1();
m_parseState.m_pos = 0; m_parseState.m_pos = 0;
m_demangledName.clear(); m_demangledName.clear();
@@ -943,7 +943,7 @@ QtMessageLogItem *QmlV8DebuggerClientPrivate::constructLogItemTree(
if (objectData.name.isEmpty()) if (objectData.name.isEmpty())
text = objectData.value.toString(); text = objectData.value.toString();
else else
text = QString(_("%1: %2")).arg(QString::fromAscii(objectData.name)) text = QString(_("%1: %2")).arg(QString::fromLatin1(objectData.name))
.arg(objectData.value.toString()); .arg(objectData.value.toString());
QtMessageLogItem *item = new QtMessageLogItem(parent, QtMessageLogItem *item = new QtMessageLogItem(parent,
@@ -91,10 +91,10 @@ IntegerValidator::IntegerValidator(QObject *parent) :
bool IntegerValidator::isCharAcceptable(const QChar &c, int base) bool IntegerValidator::isCharAcceptable(const QChar &c, int base)
{ {
if (c.isLetter()) if (c.isLetter())
return base == 16 && c.toLower().toAscii() <= 'f'; return base == 16 && c.toLower().toLatin1() <= 'f';
if (!c.isDigit()) if (!c.isDigit())
return false; return false;
const int digit = c.toAscii() - '0'; const int digit = c.toLatin1() - '0';
if (base == 8 && digit > 7) if (base == 8 && digit > 7)
return false; return false;
if (base == 2 && digit > 1) if (base == 2 && digit > 1)
+1 -1
View File
@@ -281,7 +281,7 @@ bool isKeyWord(const QString &exp)
{ {
// FIXME: incomplete // FIXME: incomplete
QTC_ASSERT(!exp.isEmpty(), return false); QTC_ASSERT(!exp.isEmpty(), return false);
switch (exp.at(0).toAscii()) { switch (exp.at(0).toLatin1()) {
case 'a': case 'a':
return exp == QLatin1String("auto"); return exp == QLatin1String("auto");
case 'b': case 'b':
+1 -1
View File
@@ -799,7 +799,7 @@ static Input parseVimKeyName(const QString &keyName)
static const QMap<QString, int> k = vimKeyNames(); static const QMap<QString, int> k = vimKeyNames();
QMap<QString, int>::ConstIterator it = k.constFind(key.toUpper()); QMap<QString, int>::ConstIterator it = k.constFind(key.toUpper());
if (it != k.end()) if (it != k.end())
return Input(*it, mods, *it <= 0x7f ? QString(QChar::fromAscii(*it)) : QString("")); return Input(*it, mods, *it <= 0x7f ? QString(QChar::fromLatin1(*it)) : QString(""));
} }
return Input(); return Input();
+1 -1
View File
@@ -538,7 +538,7 @@ bool DebianManager::setPackageManagerIcon(const Utils::FileName &debianDir, Core
QBuffer buffer(&iconAsBase64); QBuffer buffer(&iconAsBase64);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
if (!pixmap.scaled(MaddeDevice::packageManagerIconSize(deviceType)) if (!pixmap.scaled(MaddeDevice::packageManagerIconSize(deviceType))
.save(&buffer, iconPath.toFileInfo().suffix().toAscii())) { .save(&buffer, iconPath.toFileInfo().suffix().toLatin1())) {
if (error) if (error)
*error = tr("Could not export image file '%1'.").arg(iconPath.toUserOutput()); *error = tr("Could not export image file '%1'.").arg(iconPath.toUserOutput());
return false; return false;
+2 -2
View File
@@ -96,7 +96,7 @@ bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, Core::Id devic
return false; return false;
madAdminProc.setReadChannel(QProcess::StandardOutput); madAdminProc.setReadChannel(QProcess::StandardOutput);
const QByteArray tgtName = targetName(qmakePath).toAscii(); const QByteArray tgtName = targetName(qmakePath).toLatin1();
while (madAdminProc.canReadLine()) { while (madAdminProc.canReadLine()) {
const QByteArray &line = madAdminProc.readLine(); const QByteArray &line = madAdminProc.readLine();
if (line.contains(tgtName) if (line.contains(tgtName)
@@ -141,7 +141,7 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
QByteArray remoteCall(":"); QByteArray remoteCall(":");
foreach (const QByteArray &profile, profiles) foreach (const QByteArray &profile, profiles)
remoteCall += "; test -f " + profile + " && source " + profile; remoteCall += "; test -f " + profile + " && source " + profile;
return QString::fromAscii(remoteCall); return QString::fromLatin1(remoteCall);
} }
PortList MaemoGlobal::freePorts(const Kit *k) PortList MaemoGlobal::freePorts(const Kit *k)
@@ -188,7 +188,7 @@ void MaemoPackageCreationWidget::setPackageManagerIcon()
QString imageFilter = tr("Images") + QLatin1String("( "); QString imageFilter = tr("Images") + QLatin1String("( ");
const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats(); const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats();
foreach (const QByteArray &imageType, imageTypes) foreach (const QByteArray &imageType, imageTypes)
imageFilter += "*." + QString::fromAscii(imageType) + QLatin1Char(' '); imageFilter += "*." + QString::fromLatin1(imageType) + QLatin1Char(' ');
imageFilter += QLatin1Char(')'); imageFilter += QLatin1Char(')');
const QSize iconSize = MaddeDevice::packageManagerIconSize(deviceType); const QSize iconSize = MaddeDevice::packageManagerIconSize(deviceType);
const QString iconFileName = QFileDialog::getOpenFileName(this, const QString iconFileName = QFileDialog::getOpenFileName(this,
+2 -2
View File
@@ -109,7 +109,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c) 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");
} }
// Ensure adding "..." to relative paths which is p4's convention // Ensure adding "..." to relative paths which is p4's convention
@@ -624,7 +624,7 @@ void PerforcePlugin::startSubmitProject()
Utils::TempFileSaver saver; Utils::TempFileSaver saver;
saver.setAutoRemove(false); saver.setAutoRemove(false);
saver.write(result.stdOut.toAscii()); saver.write(result.stdOut.toLatin1());
if (!saver.finalize()) { if (!saver.finalize()) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString()); VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
cleanCommitMessageFile(); cleanCommitMessageFile();
+1 -1
View File
@@ -695,7 +695,7 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
quint64 fileNameOffset = 0; quint64 fileNameOffset = 0;
if (fileName.startsWith(QLatin1String("#1/"))) if (fileName.startsWith(QLatin1String("#1/")))
fileNameOffset = fileName.mid(3).toInt(); fileNameOffset = fileName.mid(3).toInt();
const QString fileLength = QString::fromAscii(data.mid(48, 10)); const QString fileLength = QString::fromLatin1(data.mid(48, 10));
int toSkip = 60 + fileNameOffset; int toSkip = 60 + fileNameOffset;
offset += fileLength.toInt() + 60 /* header */; offset += fileLength.toInt() + 60 /* header */;
@@ -237,7 +237,7 @@ void ItemLibraryWidget::setSearchFilter(const QString &searchFilter)
nameFilterList.append(QString("*%1*").arg(searchFilter)); nameFilterList.append(QString("*%1*").arg(searchFilter));
} else { } else {
foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) { foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) {
nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromAscii(extension))); nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromLatin1(extension)));
} }
} }
@@ -78,7 +78,7 @@ SubComponentManager::SubComponentManager(Model *model, QObject *parent)
void SubComponentManager::addImport(int pos, const Import &import) void SubComponentManager::addImport(int pos, const Import &import)
{ {
if (debug) if (debug)
qDebug() << Q_FUNC_INFO << pos << import.file().toAscii(); qDebug() << Q_FUNC_INFO << pos << import.file().toLatin1();
if (import.isFileImport()) { if (import.isFileImport()) {
QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile()); QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile());
@@ -48,7 +48,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &)
QVariant read(const QString &typeStr, const QString &str) QVariant read(const QString &typeStr, const QString &str)
{ {
int type = QMetaType::type(typeStr.toAscii().constData()); int type = QMetaType::type(typeStr.toLatin1().constData());
if (type == 0) { if (type == 0) {
qWarning() << "Type " << typeStr qWarning() << "Type " << typeStr
<< " is unknown to QMetaType system. Cannot create properly typed QVariant for value " << " is unknown to QMetaType system. Cannot create properly typed QVariant for value "
@@ -326,7 +326,7 @@ ImageFileFilterItem::ImageFileFilterItem(QObject *parent)
// supported image formats according to // supported image formats according to
QList<QByteArray> extensions = QImageReader::supportedImageFormats(); QList<QByteArray> extensions = QImageReader::supportedImageFormats();
foreach (const QByteArray &extension, extensions) { foreach (const QByteArray &extension, extensions) {
filter.append(QString("*.%1;").arg(QString::fromAscii(extension))); filter.append(QString("*.%1;").arg(QString::fromLatin1(extension)));
} }
setFilter(filter); setFilter(filter);
} }
@@ -280,8 +280,8 @@ QByteArray AbstractMobileApp::generateProFile(QString *errorMessage) const
out << line << endl; out << line << endl;
}; };
proFileContent.replace("../shared/" + DeploymentPriFileName.toAscii(), proFileContent.replace("../shared/" + DeploymentPriFileName.toLatin1(),
DeploymentPriFileName.toAscii()); DeploymentPriFileName.toLatin1());
return proFileContent; return proFileContent;
} }
@@ -438,7 +438,7 @@ QByteArray AbstractMobileApp::generateFile(int fileType,
const QString versionLine = const QString versionLine =
comment + sep + FileChecksum + sep + checkSumString comment + sep + FileChecksum + sep + checkSumString
+ sep + FileStubVersion + sep + versionString + QLatin1Char('\x0A'); + sep + FileStubVersion + sep + versionString + QLatin1Char('\x0A');
return versionLine.toAscii() + data; return versionLine.toLatin1() + data;
} }
int AbstractMobileApp::makeStubVersion(int minor) int AbstractMobileApp::makeStubVersion(int minor)
@@ -150,7 +150,7 @@ static inline bool generateFormClass(const GuiAppParameters &params,
} }
} }
if (headerContents.isEmpty() || sourceContents.isEmpty()) { if (headerContents.isEmpty() || sourceContents.isEmpty()) {
*errorMessage = QString::fromAscii("Failed to obtain Designer plugin code generation service."); *errorMessage = QString::fromLatin1("Failed to obtain Designer plugin code generation service.");
return false; return false;
} }
@@ -154,7 +154,7 @@ public:
saver.setAutoRemove(false); saver.setAutoRemove(false);
if (!saver.hasError()) if (!saver.hasError())
saver.setResult(m_pixmap.save( saver.setResult(m_pixmap.save(
saver.file(), QFileInfo(m_iconPath).suffix().toAscii().constData())); saver.file(), QFileInfo(m_iconPath).suffix().toLatin1().constData()));
if (!saver.finalize()) { if (!saver.finalize()) {
QMessageBox::critical(QApplication::activeWindow(), QMessageBox::critical(QApplication::activeWindow(),
tr("File Error"), tr("File Error"),
@@ -178,7 +178,7 @@ public:
Q_UNUSED(size) Q_UNUSED(size)
QMutexLocker lock(&m_mutex); QMutexLocker lock(&m_mutex);
QUrl url = QUrl::fromEncoded(id.toAscii()); QUrl url = QUrl::fromEncoded(id.toLatin1());
if (!m_fetcher.asynchronousFetchData(url)) if (!m_fetcher.asynchronousFetchData(url))
return QImage(); return QImage();
@@ -250,19 +250,19 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
| (02 * fileInfo.permission(QFile::WriteOther)) | (02 * fileInfo.permission(QFile::WriteOther))
| (01 * fileInfo.permission(QFile::ExeOther)); | (01 * fileInfo.permission(QFile::ExeOther));
const QByteArray permissionString = QString("%1").arg(permissions, const QByteArray permissionString = QString("%1").arg(permissions,
sizeof header.fileMode - 1, 8, QLatin1Char('0')).toAscii(); sizeof header.fileMode - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.fileMode, permissionString.data(), permissionString.length()); std::memcpy(&header.fileMode, permissionString.data(), permissionString.length());
const QByteArray uidString = QString("%1").arg(fileInfo.ownerId(), const QByteArray uidString = QString("%1").arg(fileInfo.ownerId(),
sizeof header.uid - 1, 8, QLatin1Char('0')).toAscii(); sizeof header.uid - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.uid, uidString.data(), uidString.length()); std::memcpy(&header.uid, uidString.data(), uidString.length());
const QByteArray gidString = QString("%1").arg(fileInfo.groupId(), const QByteArray gidString = QString("%1").arg(fileInfo.groupId(),
sizeof header.gid - 1, 8, QLatin1Char('0')).toAscii(); sizeof header.gid - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.gid, gidString.data(), gidString.length()); std::memcpy(&header.gid, gidString.data(), gidString.length());
const QByteArray sizeString = QString("%1").arg(fileInfo.size(), const QByteArray sizeString = QString("%1").arg(fileInfo.size(),
sizeof header.length - 1, 8, QLatin1Char('0')).toAscii(); sizeof header.length - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.length, sizeString.data(), sizeString.length()); std::memcpy(&header.length, sizeString.data(), sizeString.length());
const QByteArray mtimeString = QString("%1").arg(fileInfo.lastModified().toTime_t(), const QByteArray mtimeString = QString("%1").arg(fileInfo.lastModified().toTime_t(),
sizeof header.mtime - 1, 8, QLatin1Char('0')).toAscii(); sizeof header.mtime - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.mtime, mtimeString.data(), mtimeString.length()); std::memcpy(&header.mtime, mtimeString.data(), mtimeString.length());
if (fileInfo.isDir()) if (fileInfo.isDir())
header.typeflag = '5'; header.typeflag = '5';
@@ -277,7 +277,7 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
for (size_t i = 0; i < sizeof header; ++i) for (size_t i = 0; i < sizeof header; ++i)
checksum += reinterpret_cast<char *>(&header)[i]; checksum += reinterpret_cast<char *>(&header)[i];
const QByteArray checksumString = QString("%1").arg(checksum, const QByteArray checksumString = QString("%1").arg(checksum,
sizeof header.chksum - 1, 8, QLatin1Char('0')).toAscii(); sizeof header.chksum - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.chksum, checksumString.data(), checksumString.length()); std::memcpy(&header.chksum, checksumString.data(), checksumString.length());
header.chksum[sizeof header.chksum-1] = 0; header.chksum[sizeof header.chksum-1] = 0;
if (!tarFile.write(reinterpret_cast<char *>(&header), sizeof header)) { if (!tarFile.write(reinterpret_cast<char *>(&header), sizeof header)) {
@@ -699,7 +699,7 @@ bool ResourceModel::iconFileExtension(const QString &path)
const QList<QByteArray> _ext_list = QImageReader::supportedImageFormats(); const QList<QByteArray> _ext_list = QImageReader::supportedImageFormats();
foreach (const QByteArray &ext, _ext_list) { foreach (const QByteArray &ext, _ext_list) {
QString dotExt = QString(QLatin1Char('.')); QString dotExt = QString(QLatin1Char('.'));
dotExt += QString::fromAscii(ext); dotExt += QString::fromLatin1(ext);
ext_list.append(dotExt); ext_list.append(dotExt);
} }
} }
+1 -1
View File
@@ -144,7 +144,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c) 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");
} }
// Parse "svn status" output for added/modified/deleted files // Parse "svn status" output for added/modified/deleted files
@@ -62,7 +62,7 @@ QString toolTipForFrame(const Frame &frame)
if (frame.instructionPointer()) if (frame.instructionPointer())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol",
"Instruction pointer:"), "Instruction pointer:"),
QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16)); QString::fromLatin1("0x%1").arg(frame.instructionPointer(), 0, 16));
if (!frame.object().isEmpty()) if (!frame.object().isEmpty())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object()); lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());