forked from qt-creator/qt-creator
Workaround 5.15 deprecations in QTextStreams
Change-Id: Ifc2b7fd353e7c12346e9716115e830679cea7666 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user