From b4d60000981e298b7e40605a284f2b8b9b18fff5 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 28 Jan 2010 15:38:55 +0100 Subject: Fix header labels on mac with rtl The removed code simply reduces the size of the rect when running with RightToLeft without compensating anywhere else. It seems to be a leftover from a previously removed piece of code. Reviewed-by: richard Task-number: QTBUG-6882 --- src/gui/styles/qmacstyle_mac.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index f4af579..7a680f2 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -4341,8 +4341,6 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, rect.setY(0); rect.setHeight(widget->height()); } - if (opt->direction == Qt::RightToLeft) - rect.adjust(15, 0, -20, 0); } break; case SE_ProgressBarGroove: -- cgit v0.12 From 1a6e9a69235458e55b2e726e51d2797434780384 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 28 Jan 2010 16:46:51 +0100 Subject: Core classes, examples, demos: Some changes from string to char Reviewed-by: Peter Hartmann --- examples/network/network-chat/chatdialog.cpp | 2 +- examples/network/network-chat/client.cpp | 4 ++-- examples/network/network-chat/connection.cpp | 6 +++--- examples/network/network-chat/peermanager.cpp | 2 +- examples/network/qftp/ftpwindow.cpp | 3 ++- examples/network/securesocketclient/sslclient.cpp | 2 +- examples/network/torrent/trackerclient.cpp | 2 +- src/corelib/io/qfsfileengine_unix.cpp | 2 +- src/network/access/qnetworkaccesshttpbackend.cpp | 2 +- src/network/ssl/qsslcertificate.cpp | 4 ++-- 10 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/network/network-chat/chatdialog.cpp b/examples/network/network-chat/chatdialog.cpp index d8bcb30..da65270 100644 --- a/examples/network/network-chat/chatdialog.cpp +++ b/examples/network/network-chat/chatdialog.cpp @@ -79,7 +79,7 @@ void ChatDialog::appendMessage(const QString &from, const QString &message) QTextCursor cursor(textEdit->textCursor()); cursor.movePosition(QTextCursor::End); QTextTable *table = cursor.insertTable(1, 2, tableFormat); - table->cellAt(0, 0).firstCursorPosition().insertText("<" + from + "> "); + table->cellAt(0, 0).firstCursorPosition().insertText('<' + from + "> "); table->cellAt(0, 1).firstCursorPosition().insertText(message); QScrollBar *bar = textEdit->verticalScrollBar(); bar->setValue(bar->maximum()); diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp index 2b8725c..f516783 100644 --- a/examples/network/network-chat/client.cpp +++ b/examples/network/network-chat/client.cpp @@ -69,8 +69,8 @@ void Client::sendMessage(const QString &message) QString Client::nickName() const { - return QString(peerManager->userName()) + "@" + QHostInfo::localHostName() - + ":" + QString::number(server.serverPort()); + return QString(peerManager->userName()) + '@' + QHostInfo::localHostName() + + ':' + QString::number(server.serverPort()); } bool Client::hasConnection(const QHostAddress &senderIp, int senderPort) const diff --git a/examples/network/network-chat/connection.cpp b/examples/network/network-chat/connection.cpp index 1df8a2d..5c636b9 100644 --- a/examples/network/network-chat/connection.cpp +++ b/examples/network/network-chat/connection.cpp @@ -83,7 +83,7 @@ bool Connection::sendMessage(const QString &message) return false; QByteArray msg = message.toUtf8(); - QByteArray data = "MESSAGE " + QByteArray::number(msg.size()) + " " + msg; + QByteArray data = "MESSAGE " + QByteArray::number(msg.size()) + ' ' + msg; return write(data) == data.size(); } @@ -118,7 +118,7 @@ void Connection::processReadyRead() return; } - username = QString(buffer) + "@" + peerAddress().toString() + ":" + username = QString(buffer) + '@' + peerAddress().toString() + ':' + QString::number(peerPort()); currentDataType = Undefined; numBytesForCurrentDataType = 0; @@ -162,7 +162,7 @@ void Connection::sendPing() void Connection::sendGreetingMessage() { QByteArray greeting = greetingMessage.toUtf8(); - QByteArray data = "GREETING " + QByteArray::number(greeting.size()) + " " + greeting; + QByteArray data = "GREETING " + QByteArray::number(greeting.size()) + ' ' + greeting; if (write(data) == data.size()) isGreetingMessageSent = true; } diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp index 5ad2dc7..430031b 100644 --- a/examples/network/network-chat/peermanager.cpp +++ b/examples/network/network-chat/peermanager.cpp @@ -61,7 +61,7 @@ PeerManager::PeerManager(Client *client) foreach (QString string, envVariables) { int index = environment.indexOf(QRegExp(string)); if (index != -1) { - QStringList stringList = environment.at(index).split("="); + QStringList stringList = environment.at(index).split('='); if (stringList.size() == 2) { username = stringList.at(1).toUtf8(); break; diff --git a/examples/network/qftp/ftpwindow.cpp b/examples/network/qftp/ftpwindow.cpp index ae3a2b6..3fd62f8 100644 --- a/examples/network/qftp/ftpwindow.cpp +++ b/examples/network/qftp/ftpwindow.cpp @@ -324,7 +324,8 @@ void FtpWindow::processItem(QTreeWidgetItem *item, int /*column*/) if (isDirectory.value(name)) { fileList->clear(); isDirectory.clear(); - currentPath += "/" + name; + currentPath += '/'; + currentPath += name; ftp->cd(name); ftp->list(); cdToParentButton->setEnabled(true); diff --git a/examples/network/securesocketclient/sslclient.cpp b/examples/network/securesocketclient/sslclient.cpp index 1422f1c..0d6a581 100644 --- a/examples/network/securesocketclient/sslclient.cpp +++ b/examples/network/securesocketclient/sslclient.cpp @@ -177,7 +177,7 @@ void SslClient::socketReadyRead() void SslClient::sendData() { QString input = form->sessionInput->text(); - appendString(input + "\n"); + appendString(input + '\n'); socket->write(input.toUtf8() + "\r\n"); form->sessionInput->clear(); } diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp index 4f23d54..2397737 100644 --- a/examples/network/torrent/trackerclient.cpp +++ b/examples/network/torrent/trackerclient.cpp @@ -105,7 +105,7 @@ void TrackerClient::fetchPeerList() QString passkey = "?"; if (fullUrl.contains("?passkey")) { passkey = metaInfo.announceUrl().mid(fullUrl.indexOf("?passkey"), -1); - passkey += "&"; + passkey += '&'; } // Percent encode the hash diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 722d6d3..9179485 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -98,7 +98,7 @@ static inline QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QS if (!fileName.isEmpty() && QT_STAT(QFile::encodeName(fileName), &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG) { - mode += "+"; + mode += '+'; } else { mode = "wb+"; } diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 58123b2..61a95fe 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -753,7 +753,7 @@ void QNetworkAccessHttpBackend::replyHeaderChanged() QByteArray value = rawHeader(it->first); if (!value.isEmpty()) { if (qstricmp(it->first.constData(), "set-cookie") == 0) - value += "\n"; + value += '\n'; else value += ", "; } diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 9a9b1b5..fd647e2 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -634,11 +634,11 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi QByteArray tmp; for (int i = 0; i <= array.size() - 64; i += 64) { tmp += QByteArray::fromRawData(array.data() + i, 64); - tmp += "\n"; + tmp += '\n'; } if (int remainder = array.size() % 64) { tmp += QByteArray::fromRawData(array.data() + array.size() - remainder, remainder); - tmp += "\n"; + tmp += '\n'; } return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n"; -- cgit v0.12 From dfc530e1dd9040e3a8516108a9973af73d092246 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 28 Jan 2010 16:50:59 +0100 Subject: googlesuggest example: Add newline to end of file Reviewed-by: TrustMe --- examples/network/googlesuggest/googlesuggest.cpp | 3 ++- examples/network/googlesuggest/searchbox.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/network/googlesuggest/googlesuggest.cpp b/examples/network/googlesuggest/googlesuggest.cpp index 79bc448..0c85773 100644 --- a/examples/network/googlesuggest/googlesuggest.cpp +++ b/examples/network/googlesuggest/googlesuggest.cpp @@ -231,4 +231,5 @@ void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply) networkReply->deleteLater(); } -//! [9] \ No newline at end of file +//! [9] + diff --git a/examples/network/googlesuggest/searchbox.cpp b/examples/network/googlesuggest/searchbox.cpp index 69dc20e..8ef6f00 100644 --- a/examples/network/googlesuggest/searchbox.cpp +++ b/examples/network/googlesuggest/searchbox.cpp @@ -69,4 +69,5 @@ void SearchBox::doSearch() QString url = QString(GSEARCH_URL).arg(text()); QDesktopServices::openUrl(QUrl(url)); } -//! [2] \ No newline at end of file +//! [2] + -- cgit v0.12 From d381bb257f210432725221952d0a295decd56d91 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 28 Jan 2010 17:02:59 +0100 Subject: Fix some foreach usage to use const refs Reviewed-by: joao --- src/network/access/qhttpnetworkheader.cpp | 2 +- src/network/access/qnetworkrequest.cpp | 2 +- src/network/kernel/qnetworkinterface.cpp | 4 ++-- src/network/ssl/qsslsocket.cpp | 2 +- src/network/ssl/qsslsocket_openssl.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp index c2cc69c..669f9cf 100644 --- a/src/network/access/qhttpnetworkheader.cpp +++ b/src/network/access/qhttpnetworkheader.cpp @@ -80,7 +80,7 @@ QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QByteArray result; bool first = true; - foreach (QByteArray value, allValues) { + foreach (const QByteArray &value, allValues) { if (!first) result += ", "; first = false; diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 6dcd05d..a2bef67 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -649,7 +649,7 @@ static QVariant parseCookieHeader(const QByteArray &raw) { QList result; QList cookieList = raw.split(';'); - foreach (QByteArray cookie, cookieList) { + foreach (const QByteArray &cookie, cookieList) { QList parsed = QNetworkCookie::parseCookies(cookie.trimmed()); if (parsed.count() != 1) return QVariant(); // invalid Cookie: header diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 367e3c4..1115c63 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -541,7 +541,7 @@ QList QNetworkInterface::allInterfaces() { QList > privs = manager()->allInterfaces(); QList result; - foreach (QSharedDataPointer p, privs) { + foreach (const QSharedDataPointer &p, privs) { QNetworkInterface item; item.d = p; result << item; @@ -560,7 +560,7 @@ QList QNetworkInterface::allAddresses() { QList > privs = manager()->allInterfaces(); QList result; - foreach (const QSharedDataPointer p, privs) { + foreach (const QSharedDataPointer &p, privs) { foreach (const QNetworkAddressEntry &entry, p->addressEntries) result += entry.ip(); } diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 6947aa7..9623570 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1109,7 +1109,7 @@ void QSslSocket::setCiphers(const QString &ciphers) { Q_D(QSslSocket); d->configuration.ciphers.clear(); - foreach (QString cipherName, ciphers.split(QLatin1String(":"),QString::SkipEmptyParts)) { + foreach (const QString &cipherName, ciphers.split(QLatin1String(":"),QString::SkipEmptyParts)) { for (int i = 0; i < 3; ++i) { // ### Crude QSslCipher cipher(cipherName, QSsl::SslProtocol(i)); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 892d330..ce2aee1 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -818,7 +818,7 @@ bool QSslSocketBackendPrivate::startHandshake() QRegExp regexp(commonName, Qt::CaseInsensitive, QRegExp::Wildcard); if (!regexp.exactMatch(peerName)) { bool matched = false; - foreach (QString altName, configuration.peerCertificate + foreach (const QString &altName, configuration.peerCertificate .alternateSubjectNames().values(QSsl::DnsEntry)) { regexp.setPattern(altName); if (regexp.exactMatch(peerName)) { -- cgit v0.12 From bc1bf5fa40b56bf2787fbdf10d1612ca5803167e Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 28 Jan 2010 17:16:26 +0100 Subject: Call cheaper clear() instead of assigning new QString() Reviewed-by: joao Reviewed-by: Peter Hartmann --- src/network/kernel/qauthenticator.cpp | 4 ++-- src/network/socket/qlocalserver.cpp | 10 +++++----- src/network/socket/qlocalsocket_tcp.cpp | 10 +++++----- src/network/socket/qlocalsocket_unix.cpp | 14 +++++++------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 193a043..e4023c8 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -270,7 +270,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, break; case Ntlm: // #### extract from header - realm = QString(); + realm.clear(); break; case DigestMd5: { realm = QString::fromLatin1(options.value("realm")); @@ -281,7 +281,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, break; } default: - realm = QString(); + realm.clear(); challenge = QByteArray(); phase = Invalid; } diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index ede3c89..ef7fc02 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -122,9 +122,9 @@ void QLocalServer::close() qDeleteAll(d->pendingConnections); d->pendingConnections.clear(); d->closeServer(); - d->serverName = QString(); - d->fullServerName = QString(); - d->errorString = QString(); + d->serverName.clear(); + d->fullServerName.clear(); + d->errorString.clear(); d->error = QAbstractSocket::UnknownSocketError; } @@ -226,8 +226,8 @@ bool QLocalServer::listen(const QString &name) } if (!d->listen(name)) { - d->serverName = QString(); - d->fullServerName = QString(); + d->serverName.clear(); + d->fullServerName.clear(); return false; } diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index 9f574d4..5b5e84f 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -102,8 +102,8 @@ void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState) switch(newState) { case QAbstractSocket::UnconnectedState: state = QLocalSocket::UnconnectedState; - serverName = QString(); - fullServerName = QString(); + serverName.clear(); + fullServerName.clear(); break; case QAbstractSocket::ConnectingState: state = QLocalSocket::ConnectingState; @@ -218,7 +218,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) || state() == ConnectingState) return; - d->errorString = QString(); + d->errorString.clear(); d->state = ConnectingState; emit stateChanged(d->state); @@ -333,8 +333,8 @@ void QLocalSocket::close() { Q_D(QLocalSocket); d->tcpSocket->close(); - d->serverName = QString(); - d->fullServerName = QString(); + d->serverName.clear(); + d->fullServerName.clear(); QIODevice::close(); } diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 73c2465..1ca11d8 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -109,8 +109,8 @@ void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState) switch(newState) { case QAbstractSocket::UnconnectedState: state = QLocalSocket::UnconnectedState; - serverName = QString(); - fullServerName = QString(); + serverName.clear(); + fullServerName.clear(); break; case QAbstractSocket::ConnectingState: state = QLocalSocket::ConnectingState; @@ -225,7 +225,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) || state() == ConnectingState) return; - d->errorString = QString(); + d->errorString.clear(); d->unixSocket.setSocketState(QAbstractSocket::ConnectingState); d->state = ConnectingState; emit stateChanged(d->state); @@ -341,7 +341,7 @@ void QLocalSocketPrivate::_q_connectToSocket() errorOccurred(QLocalSocket::UnknownSocketError, function); } connectingSocket = -1; - connectingName = QString(); + connectingName.clear(); connectingOpenMode = 0; } @@ -438,10 +438,10 @@ void QLocalSocket::close() if (d->connectingSocket != -1) ::close(d->connectingSocket); d->connectingSocket = -1; - d->connectingName = QString(); + d->connectingName.clear(); d->connectingOpenMode = 0; - d->serverName = QString(); - d->fullServerName = QString(); + d->serverName.clear(); + d->fullServerName.clear(); QIODevice::close(); } -- cgit v0.12 From 2ffe2fafcd8ed7c2b6267a016401af86ed57b540 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 28 Jan 2010 18:24:39 +0100 Subject: Doc: Put the correct images with the D-Bus and Embedded Linux sections. Reviewed-by: Trust Me --- doc/src/getting-started/examples.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 6b4ec61..0c18773 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -406,7 +406,7 @@ \clearfloat \section1 \l{D-Bus Examples}{D-Bus} \beginfloatleft - \l{D-Bus Examples}{\inlineimage qt-embedded-examples.png + \l{D-Bus Examples}{\inlineimage dbus-examples.png } \endfloat @@ -416,7 +416,7 @@ \clearfloat \section1 \l{Qt for Embedded Linux Examples}{Qt for Embedded Linux} \beginfloatleft - \l{Qt for Embedded Linux Examples}{\inlineimage dbus-examples.png + \l{Qt for Embedded Linux Examples}{\inlineimage qt-embedded-examples.png } \endfloat -- cgit v0.12 From 9c2ee0daafd159058d0804d4fc65a8ef1a4ed852 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 29 Jan 2010 12:46:07 +1000 Subject: Fixed `make test' for xmlpatternsxqts. As far as I can tell, setting lib.file here is unnecessary, and it happens to break `make test'. The reason is that, on the first pass, qmake will generate Makefile.lib; then, when `make' is run, it will generate Makefile, and any additional parameters originally passed to qmake will be omitted. --- tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro index 39267c8..3f49ccc 100644 --- a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro +++ b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro @@ -1,7 +1,6 @@ TEMPLATE = subdirs contains(QT_CONFIG,xmlpatterns) { SUBDIRS += lib - !wince*:lib.file = lib/lib.pro test.depends = lib } SUBDIRS += test -- cgit v0.12