Commit ac54974b authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Utils: Compile with QT_NO_CAST_FROM_ASCII.



Change-Id: I5cd5607fcd3311915217a1615b948587ef808cfa
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent 5a31b006
......@@ -72,7 +72,7 @@ QString BuildableHelperLibrary::qtInstallDataDir(const Utils::FileName &qmakePat
QProcess proc;
proc.start(qmakePath.toString(), QStringList() << QLatin1String("-query") << QLatin1String("QT_INSTALL_DATA"));
if (proc.waitForFinished())
return QString(proc.readAll().trimmed());
return QString::fromLocal8Bit(proc.readAll()).trimmed();
return QString();
}
......@@ -276,7 +276,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
log->append(newline);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(),
qmakeArgs.join(" ")));
qmakeArgs.join(QLatin1String(" "))));
if (!runBuildProcess(proc, arguments.qmakeCommand.toString(), qmakeArgs, 30000, false, log, errorMessage))
return false;
......@@ -287,7 +287,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
return false;
}
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n").arg(makeFullPath, arguments.makeArguments.join(" ")));
"Running %1 %2 ...\n").arg(makeFullPath, arguments.makeArguments.join(QLatin1String(" "))));
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120000, false, log, errorMessage))
return false;
return true;
......
......@@ -190,7 +190,7 @@ QString ConsoleProcess::stubServerListen()
QTemporaryFile tf;
if (!tf.open())
return msgCannotCreateTempFile(tf.errorString());
stubFifoDir = QFile::encodeName(tf.fileName());
stubFifoDir = tf.fileName();
}
// By now the temp file was deleted again
d->m_stubServerDir = QFile::encodeName(stubFifoDir);
......@@ -199,7 +199,7 @@ QString ConsoleProcess::stubServerListen()
if (errno != EEXIST)
return msgCannotCreateTempDir(stubFifoDir, QString::fromLocal8Bit(strerror(errno)));
}
const QString stubServer = stubFifoDir + "/stub-socket";
const QString stubServer = stubFifoDir + QLatin1String("/stub-socket");
if (!d->m_stubServer.listen(stubServer)) {
::rmdir(d->m_stubServerDir.constData());
return tr("Cannot create socket '%1': %2").arg(stubServer, d->m_stubServer.errorString());
......
......@@ -106,13 +106,13 @@ CrumblePathButton::CrumblePathButton(const QString &title, QWidget *parent)
m_textPos.setY(height());
m_baseColor = StyleHelper::baseColor();
m_segment = QImage(":/utils/images/crumblepath-segment.png");
m_segmentSelected = QImage(":/utils/images/crumblepath-segment-selected.png");
m_segmentHover = QImage(":/utils/images/crumblepath-segment-hover.png");
m_segmentEnd = QImage(":/utils/images/crumblepath-segment-end.png");
m_segmentSelectedEnd = QImage(":/utils/images/crumblepath-segment-selected-end.png");
m_segmentHoverEnd = QImage(":/utils/images/crumblepath-segment-hover-end.png");
m_triangleIcon = QImage(":/utils/images/triangle_vert.png");
m_segment = QImage(QLatin1String(":/utils/images/crumblepath-segment.png"));
m_segmentSelected = QImage(QLatin1String(":/utils/images/crumblepath-segment-selected.png"));
m_segmentHover = QImage(QLatin1String(":/utils/images/crumblepath-segment-hover.png"));
m_segmentEnd = QImage(QLatin1String(":/utils/images/crumblepath-segment-end.png"));
m_segmentSelectedEnd = QImage(QLatin1String(":/utils/images/crumblepath-segment-selected-end.png"));
m_segmentHoverEnd = QImage(QLatin1String(":/utils/images/crumblepath-segment-hover-end.png"));
m_triangleIcon = QImage(QLatin1String(":/utils/images/triangle_vert.png"));
tintImages();
}
......
......@@ -72,7 +72,7 @@ QStringList EnvironmentItem::toStringList(const QList<EnvironmentItem> &list)
if (item.unset)
result << QString(item.name);
else
result << QString(item.name + '=' + item.value);
result << QString(item.name + QLatin1Char('=') + item.value);
}
return result;
}
......@@ -323,10 +323,10 @@ void Environment::modify(const QList<EnvironmentItem> & list)
if ((i + 1) < value.size()) {
const QChar &c = value.at(i+1);
int end = -1;
if (c == '(')
end = value.indexOf(')', i);
else if (c == '{')
end = value.indexOf('}', i);
if (c == QLatin1Char('('))
end = value.indexOf(QLatin1Char(')'), i);
else if (c == QLatin1Char('{'))
end = value.indexOf(QLatin1Char('}'), i);
if (end != -1) {
const QString &name = value.mid(i+2, end-i-2);
Environment::const_iterator it = constFind(name);
......
......@@ -109,10 +109,11 @@ bool FileNameValidatingLineEdit::validateFileName(const QString &name,
for (const char *c = notAllowedChars; *c; c++)
if (name.contains(QLatin1Char(*c))) {
if (errorMessage) {
if (QChar(*c).isSpace()) {
const QChar qc = QLatin1Char(*c);
if (qc.isSpace()) {
*errorMessage = tr("Name contains white space.");
} else {
*errorMessage = tr("Invalid character '%1'.").arg(*c);
*errorMessage = tr("Invalid character '%1'.").arg(qc);
}
}
return false;
......@@ -164,7 +165,7 @@ bool FileNameValidatingLineEdit::validateFileNameExtension(const QString &fileNa
if (requiredExtensions.count() == 1) {
*errorMessage = tr("File extension %1 is required:").arg(requiredExtensions.first());
} else {
*errorMessage = tr("File extensions %1 are required:").arg(requiredExtensions.join(", "));
*errorMessage = tr("File extensions %1 are required:").arg(requiredExtensions.join(QLatin1String(", ")));
}
}
......
......@@ -510,7 +510,7 @@ bool FileName::isChildOf(const FileName &s) const
return false;
if (size() <= s.size())
return false;
return at(s.size()) == '/';
return at(s.size()) == QLatin1Char('/');
}
/// \returns whether FileName endsWith \a s
......
......@@ -268,7 +268,7 @@ HistoryCompleterPrivate::HistoryCompleterPrivate(HistoryCompleter *parent)
HistoryLineDelegate::HistoryLineDelegate()
{
pixmap = QPixmap(":/core/images/editclear.png");
pixmap = QPixmap(QLatin1String(":/core/images/editclear.png"));
}
void HistoryLineDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
......
......@@ -63,13 +63,13 @@ IpAddressLineEdit::IpAddressLineEdit(QWidget* parent) :
BaseValidatingLineEdit(parent),
d(new IpAddressLineEditPrivate())
{
const char * ipAddressRegExpPattern = "^\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
const char ipAddressRegExpPatternC[] = "^\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"
"((:)(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[1-9]\\d{0,3}|0))?$";
QRegExp ipAddressRegExp(ipAddressRegExpPattern);
QRegExp ipAddressRegExp = QRegExp(QLatin1String(ipAddressRegExpPatternC));
d->m_ipAddressValidator = new QRegExpValidator(ipAddressRegExp, this);
}
......
......@@ -134,8 +134,9 @@ void NetworkAccessManager::getUrl(const QUrl &url)
QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
{
QString agentStr = QString::fromLatin1("Qt-Creator/%1 (QNetworkAccessManager %2; %3; %4; %5 bit)")
.arg(Core::Constants::IDE_VERSION_LONG).arg(qVersion())
.arg(getOsString()).arg(QLocale::system().name())
.arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
QLatin1String(qVersion()),
getOsString(), QLocale::system().name())
.arg(QSysInfo::WordSize);
QNetworkRequest req(request);
req.setRawHeader("User-Agent", agentStr.toLatin1());
......
......@@ -222,7 +222,7 @@ void PathListEditor::setPathList(const QString &pathString)
void PathListEditor::setPathListFromEnvVariable(const QString &var)
{
setPathList(qgetenv(var.toLocal8Bit()));
setPathList(QString::fromLocal8Bit(qgetenv(var.toLocal8Bit())));
}
QString PathListEditor::fileDialogTitle() const
......
......@@ -344,7 +344,7 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
case QVariant::StringList:
case QVariant::List:
w.writeStartElement(ctx.valueListElement);
w.writeAttribute(ctx.typeAttribute, QVariant::typeToName(QVariant::List));
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::List)));
if (!key.isEmpty())
w.writeAttribute(ctx.keyAttribute, key);
foreach (const QVariant &var, variant.toList())
......@@ -353,7 +353,7 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
break;
case QVariant::Map: {
w.writeStartElement(ctx.valueMapElement);
w.writeAttribute(ctx.typeAttribute, QVariant::typeToName(QVariant::Map));
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::Map)));
if (!key.isEmpty())
w.writeAttribute(ctx.keyAttribute, key);
const QVariantMap varMap = variant.toMap();
......
......@@ -174,6 +174,6 @@ void ProxyAction::updateToolTipWithKeySequence()
QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySequence &shortcut)
{
return QString("%1 <span style=\"color: gray; font-size: small\">%2</span>").arg(str).arg(
shortcut.toString(QKeySequence::NativeText));
return QString::fromLatin1("%1 <span style=\"color: gray; font-size: small\">%2</span>").
arg(str, shortcut.toString(QKeySequence::NativeText));
}
......@@ -663,12 +663,13 @@ void QtcProcess::start()
// That's brain dead, and we work around it
#if defined(Q_OS_UNIX)
# if defined(Q_OS_MAC)
static const char libraryPath[] = "DYLD_LIBRARY_PATH";
static const char libraryPathC[] = "DYLD_LIBRARY_PATH";
# else
static const char libraryPath[] = "LD_LIBRARY_PATH";
static const char libraryPathC[] = "LD_LIBRARY_PATH";
# endif
const QString libraryPath = QLatin1String(libraryPathC);
if (env.constFind(libraryPath) == env.constEnd())
env.set(libraryPath, QLatin1String(""));
env.set(libraryPath, QString());
#endif
QProcess::setEnvironment(env.toStringList());
} else {
......
......@@ -193,7 +193,7 @@ QString SavedAction::toString() const
return QLatin1String("value: ") + m_value.toString()
+ QLatin1String(" defaultvalue: ") + m_defaultValue.toString()
+ QLatin1String(" settingskey: ") + m_settingsGroup
+ '/' + m_settingsKey;
+ QLatin1Char('/') + m_settingsKey;
}
/*!
......@@ -219,8 +219,8 @@ QAction *SavedAction::updatedAction(const QString &text0)
if (!m_textPattern.isEmpty()) {
if (text.isEmpty()) {
text = m_textPattern;
text.remove("\"%1\"");
text.remove("%1");
text.remove(QLatin1String("\"%1\""));
text.remove(QLatin1String("%1"));
enabled = false;
} else {
text = m_textPattern.arg(text0);
......
......@@ -508,7 +508,7 @@ void SftpChannelPrivate::handleMkdirStatus(const JobMap::Iterator &it,
const QFileInfoList &dirInfos
= localDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QFileInfo &dirInfo, dirInfos) {
const QString remoteSubDir = remoteDir + '/' + dirInfo.fileName();
const QString remoteSubDir = remoteDir + QLatin1Char('/') + dirInfo.fileName();
const SftpMakeDir::Ptr mkdirOp(
new SftpMakeDir(++m_nextJobId, remoteSubDir, op->parentJob));
op->parentJob->mkdirsInProgress.insert(mkdirOp,
......@@ -528,7 +528,7 @@ void SftpChannelPrivate::handleMkdirStatus(const JobMap::Iterator &it,
return;
}
const QString remoteFilePath = remoteDir + '/' + fileInfo.fileName();
const QString remoteFilePath = remoteDir + QLatin1Char('/') + fileInfo.fileName();
SftpUploadFile::Ptr uploadFileOp(new SftpUploadFile(++m_nextJobId,
remoteFilePath, localFile, SftpOverwriteExisting, op->parentJob));
createJob(uploadFileOp);
......
......@@ -98,8 +98,8 @@ QByteArray SshCapabilities::findBestMatch(const QList<QByteArray> &myCapabilitie
QCoreApplication::translate("SshConnection",
"Server and client capabilities don't match. "
"Client list was: %1.\nServer list was %2.")
.arg(listAsByteArray(myCapabilities).data())
.arg(listAsByteArray(serverCapabilities).data()));
.arg(QString::fromLocal8Bit(listAsByteArray(myCapabilities).data()))
.arg(QString::fromLocal8Bit(listAsByteArray(serverCapabilities).data())));
}
} // namespace Internal
......
......@@ -321,7 +321,7 @@ void SshConnectionPrivate::handleIncomingData()
e.errorString);
} catch (Botan::Exception &e) {
closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "",
tr("Botan library exception: %1").arg(e.what()));
tr("Botan library exception: %1").arg(QString::fromAscii(e.what())));
}
}
......
......@@ -286,7 +286,7 @@ SshChannelOpenFailure SshIncomingPacket::extractChannelOpenFailure() const
quint32 offset = TypeOffset + 1;
openFailure.localChannel = SshPacketParser::asUint32(m_data, &offset);
openFailure.reasonCode = SshPacketParser::asUint32(m_data, &offset);
openFailure.reasonString = SshPacketParser::asString(m_data, &offset);
openFailure.reasonString = QString::fromLocal8Bit(SshPacketParser::asString(m_data, &offset));
openFailure.language = SshPacketParser::asString(m_data, &offset);
} catch (SshPacketParseException &) {
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
......
......@@ -84,7 +84,7 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke
}
return true;
} catch (Botan::Exception &e) {
m_error = tr("Error generating key: %1").arg(e.what());
m_error = tr("Error generating key: %1").arg(QString::fromAscii(e.what()));
return false;
}
}
......
......@@ -377,7 +377,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
QPainter *p, QIcon::Mode iconMode, int radius, const QColor &color, const QPoint &offset)
{
QPixmap cache;
QString pixmapName = QString("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
QString pixmapName = QString::fromLatin1("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
if (!QPixmapCache::find(pixmapName, cache)) {
QPixmap px = icon.pixmap(rect.size());
......
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