diff options
author | David Schulz <david.schulz@qt.io> | 2020-01-17 14:37:08 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-01-17 13:50:57 +0000 |
commit | 7021b1f078cc9d10ea943b6fbca85b679b3376a0 (patch) | |
tree | 5082ee42f35868b858823e4ea290780789256b5f | |
parent | 37e7b72609e57331dad8de22989e5672ae6f45ea (diff) | |
download | qt-creator-7021b1f078cc9d10ea943b6fbca85b679b3376a0.tar.gz |
Workaround 5.15 deprecations in QTextStreams
Change-Id: Ifc2b7fd353e7c12346e9716115e830679cea7666
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/libs/glsl/glslastdump.cpp | 3 | ||||
-rw-r--r-- | src/libs/utils/persistentsettings.cpp | 11 | ||||
-rw-r--r-- | src/plugins/coreplugin/find/findplugin.cpp | 4 | ||||
-rw-r--r-- | src/plugins/git/gerrit/authenticationdialog.cpp | 6 | ||||
-rw-r--r-- | src/plugins/git/gerrit/gerritmodel.cpp | 12 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljseditor.cpp | 28 | ||||
-rw-r--r-- | src/tools/buildoutputparser/outputprocessor.cpp | 4 | ||||
-rw-r--r-- | src/tools/valgrindfake/main.cpp | 40 | ||||
-rw-r--r-- | src/tools/valgrindfake/outputgenerator.cpp | 3 |
9 files changed, 55 insertions, 56 deletions
diff --git a/src/libs/glsl/glslastdump.cpp b/src/libs/glsl/glslastdump.cpp index 521249227d..4ca2f95ef2 100644 --- a/src/libs/glsl/glslastdump.cpp +++ b/src/libs/glsl/glslastdump.cpp @@ -33,7 +33,6 @@ #endif using namespace GLSL; -using namespace Qt; ASTDump::ASTDump(QTextStream &out) : out(out), _depth(0) @@ -53,7 +52,7 @@ bool ASTDump::preVisit(AST *ast) char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr); id = cppId; #endif - out << QByteArray(_depth, ' ') << id << endl; + out << QByteArray(_depth, ' ') << id << '\n'; #ifdef Q_CC_GNU free(cppId); #endif diff --git a/src/libs/utils/persistentsettings.cpp b/src/libs/utils/persistentsettings.cpp index 75235c8c27..a0ba53ed25 100644 --- a/src/libs/utils/persistentsettings.cpp +++ b/src/libs/utils/persistentsettings.cpp @@ -42,13 +42,18 @@ #include <utils/qtcassert.h> -using namespace Qt; - // Read and write rectangle in X11 resource syntax "12x12+4+3" static QString rectangleToString(const QRect &r) { QString result; - QTextStream(&result) << r.width() << 'x' << r.height() << forcesign << r.x() << r.y(); + QTextStream str(&result); + str << r.width() << 'x' << r.height() << r.x() << r.y(); + if (r.x() >= 0) + str << '+'; + str << r.x(); + if (r.y() >= 0) + str << '+'; + str << r.y(); return result; } diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp index 47dca13808..cceea8a01a 100644 --- a/src/plugins/coreplugin/find/findplugin.cpp +++ b/src/plugins/coreplugin/find/findplugin.cpp @@ -84,8 +84,8 @@ QDebug operator<<(QDebug d, const CompletionEntry &e) QDebugStateSaver saver(d); d.noquote(); d.nospace(); - d << "CompletionEntry(\"" << e.text << "\", flags=" << hex - << showbase << int(e.findFlags) << dec << noshowbase << ')'; + d << "CompletionEntry(\"" << e.text << "\", flags=" + << "0x" << QString::number(e.findFlags, 16) << ')'; return d; } diff --git a/src/plugins/git/gerrit/authenticationdialog.cpp b/src/plugins/git/gerrit/authenticationdialog.cpp index bb9d267ca7..ba0516df59 100644 --- a/src/plugins/git/gerrit/authenticationdialog.cpp +++ b/src/plugins/git/gerrit/authenticationdialog.cpp @@ -39,8 +39,6 @@ #include <QTextStream> #include <QTimer> -using namespace Qt; - namespace Gerrit { namespace Internal { @@ -152,10 +150,10 @@ bool AuthenticationDialog::setupCredentials() replaceEntry(line, "login", user); replaceEntry(line, "password", password); } - out << line << endl; + out << line << '\n'; } if (!found) - out << "machine " << m_server->host << " login " << user << " password " << password << endl; + out << "machine " << m_server->host << " login " << user << " password " << password << '\n'; Utils::FileSaver saver(m_netrcFileName, QFile::WriteOnly | QFile::Truncate | QFile::Text); saver.write(netrcContents.toUtf8()); return saver.finalize(); diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index c1bb78a854..a9be6358cc 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -55,8 +55,6 @@ enum { debug = 0 }; using namespace VcsBase; -using namespace Qt; - namespace Gerrit { namespace Internal { @@ -124,7 +122,10 @@ QString GerritPatchSet::approvalsToHtml() const str << a.reviewer.fullName; if (!a.reviewer.email.isEmpty()) str << " <a href=\"mailto:" << a.reviewer.email << "\">" << a.reviewer.email << "</a>"; - str << ": " << forcesign << a.approval << noforcesign; + str << ": "; + if (a.approval >= 0) + str << '+'; + str << a.approval; } str << "</tr>\n"; return result; @@ -166,7 +167,10 @@ QString GerritPatchSet::approvalsColumn() const for (TypeReviewMapConstIterator it = reviews.constBegin(); it != cend; ++it) { if (!result.isEmpty()) str << ' '; - str << it.key() << ": " << forcesign << it.value() << noforcesign; + str << it.key() << ": "; + if (it.value() >= 0) + str << '+'; + str << it.value(); } return result; } diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index ed76bca03d..13eab82ce4 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -101,8 +101,6 @@ using namespace QmlJS::AST; using namespace QmlJSTools; using namespace TextEditor; -using namespace Qt; - namespace QmlJSEditor { // @@ -559,24 +557,24 @@ public: *m_stream << m_indent; if (!propertyInfo.isWriteable()) *m_stream << "readonly "; - *m_stream << "property " << type << " " << name << endl; + *m_stream << "property " << type << " " << name << '\n'; return true; } bool processSignal(const QString &name, const Value *value) override { - *m_stream << m_indent << "signal " << name << stringifyFunctionParameters(value) << endl; + *m_stream << m_indent << "signal " << name << stringifyFunctionParameters(value) << '\n'; return true; } bool processSlot(const QString &name, const Value *value) override { - *m_stream << m_indent << "function " << name << stringifyFunctionParameters(value) << endl; + *m_stream << m_indent << "function " << name << stringifyFunctionParameters(value) << '\n'; return true; } bool processGeneratedSlot(const QString &name, const Value *value) override { *m_stream << m_indent << "/*generated*/ function " << name - << stringifyFunctionParameters(value) << endl; + << stringifyFunctionParameters(value) << '\n'; return true; } @@ -633,33 +631,33 @@ static QString inspectCppComponent(const CppComponentValue *cppValue) if (superClassName.isEmpty()) superClassName = cppValue->metaObject()->className(); - bufWriter << "import QtQuick " << cppValue->importVersion().toString() << endl + bufWriter << "import QtQuick " << cppValue->importVersion().toString() << '\n' << "// " << cppValue->metaObject()->className() << " imported as " << cppValue->moduleName() << " " - << cppValue->importVersion().toString() << endl - << endl - << superClassName << " {" << endl; + << cppValue->importVersion().toString() << '\n' + << '\n' + << superClassName << " {" << '\n'; CodeModelInspector insp(cppValue, &bufWriter); cppValue->processMembers(&insp); - bufWriter << endl; + bufWriter << '\n'; const int enumeratorCount = cppValue->metaObject()->enumeratorCount(); for (int index = cppValue->metaObject()->enumeratorOffset(); index < enumeratorCount; ++index) { LanguageUtils::FakeMetaEnum enumerator = cppValue->metaObject()->enumerator(index); - bufWriter << " enum " << enumerator.name() << " {" << endl; + bufWriter << " enum " << enumerator.name() << " {" << '\n'; const QStringList keys = enumerator.keys(); const int keysCount = keys.size(); for (int i = 0; i < keysCount; ++i) { bufWriter << " " << keys.at(i); if (i != keysCount - 1) bufWriter << ','; - bufWriter << endl; + bufWriter << '\n'; } - bufWriter << " }" << endl; + bufWriter << " }" << '\n'; } - bufWriter << "}" << endl; + bufWriter << "}" << '\n'; return result; } diff --git a/src/tools/buildoutputparser/outputprocessor.cpp b/src/tools/buildoutputparser/outputprocessor.cpp index e5abaa0baf..083f4de89e 100644 --- a/src/tools/buildoutputparser/outputprocessor.cpp +++ b/src/tools/buildoutputparser/outputprocessor.cpp @@ -40,8 +40,6 @@ #include <stdio.h> -using namespace Qt; - CompilerOutputProcessor::CompilerOutputProcessor(CompilerType compilerType, QIODevice &source) : m_compilerType(compilerType) , m_source(source) @@ -88,5 +86,5 @@ void CompilerOutputProcessor::handleTask(const ProjectExplorer::Task &task) *m_ostream << ':' << task.line; *m_ostream << ": "; } - *m_ostream << task.description << endl; + *m_ostream << task.description << '\n'; } diff --git a/src/tools/valgrindfake/main.cpp b/src/tools/valgrindfake/main.cpp index 10778b25c2..4e5fb0e860 100644 --- a/src/tools/valgrindfake/main.cpp +++ b/src/tools/valgrindfake/main.cpp @@ -36,24 +36,22 @@ using namespace Valgrind::Fake; -using namespace Qt; - QTextStream qerr(stderr); QTextStream qout(stdout); void usage(QTextStream& stream) { - stream << "valgrind-fake OPTIONS" << endl; - stream << endl; - stream << " REQUIRED OPTIONS:" << endl; - stream << " --xml-socket=ipaddr:port \tXML output to socket ipaddr:port" << endl; - stream << " -i, --xml-input FILE \tpath to a XML file as generated by valgrind" << endl; - stream << endl; - stream << " OPTIONAL OPTIONS:" << endl; - stream << " -c, --crash \tcrash randomly" << endl; - stream << " -g, --garbage \toutput invalid XML somewhere" << endl; - stream << " -w, --wait SECONDS \twait randomly for the given amount of seconds" << endl; - stream << " -h, --help \tprint help" << endl; + stream << "valgrind-fake OPTIONS" << '\n'; + stream << '\n'; + stream << " REQUIRED OPTIONS:" << '\n'; + stream << " --xml-socket=ipaddr:port \tXML output to socket ipaddr:port" << '\n'; + stream << " -i, --xml-input FILE \tpath to a XML file as generated by valgrind" << '\n'; + stream << '\n'; + stream << " OPTIONAL OPTIONS:" << '\n'; + stream << " -c, --crash \tcrash randomly" << '\n'; + stream << " -g, --garbage \toutput invalid XML somewhere" << '\n'; + stream << " -w, --wait SECONDS \twait randomly for the given amount of seconds" << '\n'; + stream << " -h, --help \tprint help" << '\n'; } int main(int argc, char** argv) @@ -89,7 +87,7 @@ int main(int argc, char** argv) bool ok; arg_wait = args.at(i+1).toUInt(&ok); if (!ok) { - qerr << "ERROR: invalid wait time given" << args.at(i+1) << endl; + qerr << "ERROR: invalid wait time given" << args.at(i+1) << '\n'; usage(qerr); return 4; } @@ -100,31 +98,31 @@ int main(int argc, char** argv) } if (arg_xmlFile.isEmpty()) { - qerr << "ERROR: no XML input file given" << endl; + qerr << "ERROR: no XML input file given" << '\n'; usage(qerr); return 1; } if (arg_server.isEmpty()) { - qerr << "ERROR: no server given" << endl; + qerr << "ERROR: no server given" << '\n'; usage(qerr); return 2; } if (arg_port.isEmpty()) { - qerr << "ERROR: no port given" << endl; + qerr << "ERROR: no port given" << '\n'; usage(qerr); return 3; } QFile xmlFile(arg_xmlFile); if (!xmlFile.exists() || !xmlFile.open(QIODevice::ReadOnly)) { - qerr << "ERROR: invalid XML file" << endl; + qerr << "ERROR: invalid XML file" << '\n'; usage(qerr); return 10; } bool ok = false; quint16 port = arg_port.toUInt(&ok); if (!ok) { - qerr << "ERROR: invalid port" << endl; + qerr << "ERROR: invalid port" << '\n'; usage(qerr); return 30; } @@ -132,12 +130,12 @@ int main(int argc, char** argv) QTcpSocket socket; socket.connectToHost(arg_server, port, QIODevice::WriteOnly); if (!socket.isOpen()) { - qerr << "ERROR: could not open socket to server:" << arg_server << ":" << port << endl; + qerr << "ERROR: could not open socket to server:" << arg_server << ":" << port << '\n'; usage(qerr); return 20; } if (!socket.waitForConnected()) { - qerr << "ERROR: could not connect to socket: " << socket.errorString() << endl; + qerr << "ERROR: could not connect to socket: " << socket.errorString() << '\n'; return 21; } diff --git a/src/tools/valgrindfake/outputgenerator.cpp b/src/tools/valgrindfake/outputgenerator.cpp index d8e544da4c..3c0b651bce 100644 --- a/src/tools/valgrindfake/outputgenerator.cpp +++ b/src/tools/valgrindfake/outputgenerator.cpp @@ -49,7 +49,6 @@ void doSleep(int msec) } #endif -using namespace Qt; using namespace Valgrind::Fake; OutputGenerator::OutputGenerator(QAbstractSocket *output, QIODevice *input) : @@ -116,7 +115,7 @@ void OutputGenerator::produceRuntimeError() blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre"); m_output->flush(); } else if (m_wait) { - qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << endl; + qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << '\n'; doSleep(1000 * m_wait); } } |