summaryrefslogtreecommitdiffstats
path: root/examples/network
diff options
context:
space:
mode:
authorAxel Waggershauser <awagger@gmail.com>2013-03-15 00:42:15 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-16 20:22:50 +0100
commitb11317a64339f5a4bcffc8234ecaf15c7fb416f2 (patch)
treef81e40ee49f5109b4100048d131d5bb922b448aa /examples/network
parent72367a94a750355eb748793ce8c365373a332c9c (diff)
Whitespace cleanup: remove trailing whitespace
Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'examples/network')
-rw-r--r--examples/network/doc/src/blockingfortuneclient.qdoc4
-rw-r--r--examples/network/doc/src/threadedfortuneserver.qdoc8
-rw-r--r--examples/network/http/httpwindow.cpp4
-rw-r--r--examples/network/securesocketclient/sslclient.h2
-rw-r--r--examples/network/torrent/addtorrentdialog.cpp4
-rw-r--r--examples/network/torrent/bencodeparser.cpp200
-rw-r--r--examples/network/torrent/bencodeparser.h2
-rw-r--r--examples/network/torrent/filemanager.h2
-rw-r--r--examples/network/torrent/mainwindow.cpp2
-rw-r--r--examples/network/torrent/mainwindow.h6
-rw-r--r--examples/network/torrent/metainfo.h2
-rw-r--r--examples/network/torrent/peerwireclient.h2
-rw-r--r--examples/network/torrent/torrentclient.cpp10
-rw-r--r--examples/network/torrent/torrentclient.h4
-rw-r--r--examples/network/torrent/trackerclient.h4
15 files changed, 128 insertions, 128 deletions
diff --git a/examples/network/doc/src/blockingfortuneclient.qdoc b/examples/network/doc/src/blockingfortuneclient.qdoc
index bff2e29ea5..2d77d3fcba 100644
--- a/examples/network/doc/src/blockingfortuneclient.qdoc
+++ b/examples/network/doc/src/blockingfortuneclient.qdoc
@@ -43,7 +43,7 @@
QTcpSocket::connectToHost() returns immediately, and when the connection
has been established, QTcpSocket emits
\l{QTcpSocket::connected()}{connected()}.
-
+
\li \e{The synchronous (blocking) approach.} In non-GUI and multithreaded
applications, you can call the \c waitFor...() functions (e.g.,
QTcpSocket::waitForConnected()) to suspend the calling thread until the
@@ -208,7 +208,7 @@
\snippet blockingfortuneclient/blockingclient.cpp 3
\codeline
\snippet blockingfortuneclient/blockingclient.cpp 4
-
+
Here, we simply display the fortune we received as the argument.
\sa {Fortune Client Example}, {Fortune Server Example}
diff --git a/examples/network/doc/src/threadedfortuneserver.qdoc b/examples/network/doc/src/threadedfortuneserver.qdoc
index fe627d0141..1b64e30226 100644
--- a/examples/network/doc/src/threadedfortuneserver.qdoc
+++ b/examples/network/doc/src/threadedfortuneserver.qdoc
@@ -48,8 +48,8 @@
FortuneServer inherits QTcpServer and reimplements
QTcpServer::incomingConnection(). We also use it for storing the list of
- random fortunes.
-
+ random fortunes.
+
\snippet threadedfortuneserver/fortuneserver.cpp 0
We use FortuneServer's constructor to simply generate the list of
@@ -71,7 +71,7 @@
QThread::run(), and it has a signal for reporting errors.
\snippet threadedfortuneserver/fortunethread.cpp 0
-
+
FortuneThread's constructor simply stores the socket descriptor and
fortune text, so that they are available for run() later on.
@@ -101,7 +101,7 @@
But unlike the previous example, we finish off by calling
QTcpSocket::waitForDisconnected(), which blocks the calling thread until
the socket has disconnected. Because we are running in a separate thread,
- the GUI will remain responsive.
+ the GUI will remain responsive.
\sa {Fortune Server Example}, {Fortune Client Example}, {Blocking Fortune
Client Example}
diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp
index 2f795ebe7f..2b689c7770 100644
--- a/examples/network/http/httpwindow.cpp
+++ b/examples/network/http/httpwindow.cpp
@@ -180,7 +180,7 @@ void HttpWindow::httpFinished()
tr("Download failed: %1.")
.arg(reply->errorString()));
downloadButton->setEnabled(true);
- } else if (!redirectionTarget.isNull()) {
+ } else if (!redirectionTarget.isNull()) {
QUrl newUrl = url.resolved(redirectionTarget.toUrl());
if (QMessageBox::question(this, tr("HTTP"),
tr("Redirect to %1 ?").arg(newUrl.toString()),
@@ -256,7 +256,7 @@ void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
errorString += ", ";
errorString += error.errorString();
}
-
+
if (QMessageBox::warning(this, tr("HTTP"),
tr("One or more SSL errors has occurred: %1").arg(errorString),
QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
diff --git a/examples/network/securesocketclient/sslclient.h b/examples/network/securesocketclient/sslclient.h
index 3caf6e2af1..8ebf2cc536 100644
--- a/examples/network/securesocketclient/sslclient.h
+++ b/examples/network/securesocketclient/sslclient.h
@@ -57,7 +57,7 @@ class SslClient : public QWidget
public:
SslClient(QWidget *parent = 0);
~SslClient();
-
+
private slots:
void updateEnabledState();
void secureConnect();
diff --git a/examples/network/torrent/addtorrentdialog.cpp b/examples/network/torrent/addtorrentdialog.cpp
index fac75ba465..d168633df3 100644
--- a/examples/network/torrent/addtorrentdialog.cpp
+++ b/examples/network/torrent/addtorrentdialog.cpp
@@ -117,14 +117,14 @@ void AddTorrentDialog::setTorrent(const QString &torrentFile)
if (lastDestinationDirectory.isEmpty())
lastDestinationDirectory = lastDirectory;
-
+
MetaInfo metaInfo;
QFile torrent(torrentFile);
if (!torrent.open(QFile::ReadOnly) || !metaInfo.parse(torrent.readAll())) {
enableOkButton();
return;
}
-
+
ui.torrentFile->setText(torrentFile);
ui.announceUrl->setText(metaInfo.announceUrl());
if (metaInfo.comment().isEmpty())
diff --git a/examples/network/torrent/bencodeparser.cpp b/examples/network/torrent/bencodeparser.cpp
index 2abc41a852..6ef7234539 100644
--- a/examples/network/torrent/bencodeparser.cpp
+++ b/examples/network/torrent/bencodeparser.cpp
@@ -81,26 +81,26 @@ bool BencodeParser::getByteString(QByteArray *byteString)
const int contentSize = content.size();
int size = -1;
do {
- char c = content.at(index);
- if (c < '0' || c > '9') {
- if (size == -1)
- return false;
- if (c != ':') {
- errString = QString("Unexpected character at pos %1: %2")
- .arg(index).arg(c);
- return false;
- }
- ++index;
- break;
- }
- if (size == -1)
- size = 0;
- size *= 10;
- size += c - '0';
+ char c = content.at(index);
+ if (c < '0' || c > '9') {
+ if (size == -1)
+ return false;
+ if (c != ':') {
+ errString = QString("Unexpected character at pos %1: %2")
+ .arg(index).arg(c);
+ return false;
+ }
+ ++index;
+ break;
+ }
+ if (size == -1)
+ size = 0;
+ size *= 10;
+ size += c - '0';
} while (++index < contentSize);
if (byteString)
- *byteString = content.mid(index, size);
+ *byteString = content.mid(index, size);
index += size;
return true;
}
@@ -109,38 +109,38 @@ bool BencodeParser::getInteger(qint64 *integer)
{
const int contentSize = content.size();
if (content.at(index) != 'i')
- return false;
+ return false;
++index;
qint64 num = -1;
bool negative = false;
do {
- char c = content.at(index);
- if (c < '0' || c > '9') {
- if (num == -1) {
- if (c != '-' || negative)
- return false;
- negative = true;
- continue;
- } else {
- if (c != 'e') {
- errString = QString("Unexpected character at pos %1: %2")
- .arg(index).arg(c);
- return false;
- }
- ++index;
- break;
- }
- }
- if (num == -1)
- num = 0;
- num *= 10;
- num += c - '0';
+ char c = content.at(index);
+ if (c < '0' || c > '9') {
+ if (num == -1) {
+ if (c != '-' || negative)
+ return false;
+ negative = true;
+ continue;
+ } else {
+ if (c != 'e') {
+ errString = QString("Unexpected character at pos %1: %2")
+ .arg(index).arg(c);
+ return false;
+ }
+ ++index;
+ break;
+ }
+ }
+ if (num == -1)
+ num = 0;
+ num *= 10;
+ num += c - '0';
} while (++index < contentSize);
if (integer)
- *integer = negative ? -num : num;
+ *integer = negative ? -num : num;
return true;
}
@@ -148,38 +148,38 @@ bool BencodeParser::getList(QList<QVariant> *list)
{
const int contentSize = content.size();
if (content.at(index) != 'l')
- return false;
+ return false;
- QList<QVariant> tmp;
+ QList<QVariant> tmp;
++index;
do {
- if (content.at(index) == 'e') {
- ++index;
- break;
- }
-
- qint64 number;
- QByteArray byteString;
- QList<QVariant> tmpList;
- QMap<QByteArray, QVariant> dictionary;
-
- if (getInteger(&number))
- tmp << number;
- else if (getByteString(&byteString))
- tmp << byteString;
- else if (getList(&tmpList))
- tmp << tmpList;
- else if (getDictionary(&dictionary))
- tmp << QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary);
- else {
- errString = QString("error at index %1").arg(index);
- return false;
- }
+ if (content.at(index) == 'e') {
+ ++index;
+ break;
+ }
+
+ qint64 number;
+ QByteArray byteString;
+ QList<QVariant> tmpList;
+ QMap<QByteArray, QVariant> dictionary;
+
+ if (getInteger(&number))
+ tmp << number;
+ else if (getByteString(&byteString))
+ tmp << byteString;
+ else if (getList(&tmpList))
+ tmp << tmpList;
+ else if (getDictionary(&dictionary))
+ tmp << QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary);
+ else {
+ errString = QString("error at index %1").arg(index);
+ return false;
+ }
} while (index < contentSize);
if (list)
- *list = tmp;
+ *list = tmp;
return true;
}
@@ -187,48 +187,48 @@ bool BencodeParser::getDictionary(QMap<QByteArray, QVariant> *dictionary)
{
const int contentSize = content.size();
if (content.at(index) != 'd')
- return false;
+ return false;
- QMap<QByteArray, QVariant> tmp;
+ QMap<QByteArray, QVariant> tmp;
++index;
do {
- if (content.at(index) == 'e') {
- ++index;
- break;
- }
-
- QByteArray key;
- if (!getByteString(&key))
- break;
-
- if (key == "info")
- infoStart = index;
-
- qint64 number;
- QByteArray byteString;
- QList<QVariant> tmpList;
- QMap<QByteArray, QVariant> dictionary;
-
- if (getInteger(&number))
- tmp.insert(key, number);
- else if (getByteString(&byteString))
- tmp.insert(key, byteString);
- else if (getList(&tmpList))
- tmp.insert(key, tmpList);
- else if (getDictionary(&dictionary))
- tmp.insert(key, QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary));
- else {
- errString = QString("error at index %1").arg(index);
- return false;
- }
-
- if (key == "info")
- infoLength = index - infoStart;
+ if (content.at(index) == 'e') {
+ ++index;
+ break;
+ }
+
+ QByteArray key;
+ if (!getByteString(&key))
+ break;
+
+ if (key == "info")
+ infoStart = index;
+
+ qint64 number;
+ QByteArray byteString;
+ QList<QVariant> tmpList;
+ QMap<QByteArray, QVariant> dictionary;
+
+ if (getInteger(&number))
+ tmp.insert(key, number);
+ else if (getByteString(&byteString))
+ tmp.insert(key, byteString);
+ else if (getList(&tmpList))
+ tmp.insert(key, tmpList);
+ else if (getDictionary(&dictionary))
+ tmp.insert(key, QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary));
+ else {
+ errString = QString("error at index %1").arg(index);
+ return false;
+ }
+
+ if (key == "info")
+ infoLength = index - infoStart;
} while (index < contentSize);
if (dictionary)
- *dictionary = tmp;
+ *dictionary = tmp;
return true;
}
diff --git a/examples/network/torrent/bencodeparser.h b/examples/network/torrent/bencodeparser.h
index 4fcaeab50a..5d3aeada04 100644
--- a/examples/network/torrent/bencodeparser.h
+++ b/examples/network/torrent/bencodeparser.h
@@ -54,7 +54,7 @@ class BencodeParser
{
public:
BencodeParser();
-
+
bool parse(const QByteArray &content);
QString errorString() const;
diff --git a/examples/network/torrent/filemanager.h b/examples/network/torrent/filemanager.h
index 721d62210d..41f1aa9a40 100644
--- a/examples/network/torrent/filemanager.h
+++ b/examples/network/torrent/filemanager.h
@@ -65,7 +65,7 @@ public:
inline void setMetaInfo(const MetaInfo &info) { metaInfo = info; }
inline void setDestinationFolder(const QString &directory) { destinationPath = directory; }
-
+
int read(int pieceIndex, int offset, int length);
void write(int pieceIndex, int offset, const QByteArray &data);
void verifyPiece(int pieceIndex);
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index 8d664abb93..649dbb0a77 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -130,7 +130,7 @@ MainWindow::MainWindow(QWidget *parent)
QAction *newTorrentAction = new QAction(QIcon(":/icons/bottom.png"), tr("Add &new torrent"), this);
pauseTorrentAction = new QAction(QIcon(":/icons/player_pause.png"), tr("&Pause torrent"), this);
removeTorrentAction = new QAction(QIcon(":/icons/player_stop.png"), tr("&Remove torrent"), this);
-
+
// File menu
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(newTorrentAction);
diff --git a/examples/network/torrent/mainwindow.h b/examples/network/torrent/mainwindow.h
index f0c3ea62c9..6ba42be81f 100644
--- a/examples/network/torrent/mainwindow.h
+++ b/examples/network/torrent/mainwindow.h
@@ -65,7 +65,7 @@ public:
QSize sizeHint() const;
const TorrentClient *clientForRow(int row) const;
-
+
protected:
void closeEvent(QCloseEvent *event);
@@ -94,12 +94,12 @@ private slots:
void about();
void setActionsEnabled();
void acceptFileDrop(const QString &fileName);
-
+
private:
int rowOfClient(TorrentClient *client) const;
bool addTorrent(const QString &fileName, const QString &destinationFolder,
const QByteArray &resumeState = QByteArray());
-
+
TorrentView *torrentView;
QAction *pauseTorrentAction;
QAction *removeTorrentAction;
diff --git a/examples/network/torrent/metainfo.h b/examples/network/torrent/metainfo.h
index 741fe69299..17daca559e 100644
--- a/examples/network/torrent/metainfo.h
+++ b/examples/network/torrent/metainfo.h
@@ -100,7 +100,7 @@ public:
// Total size
qint64 totalSize() const;
-private:
+private:
QString errString;
QByteArray content;
QByteArray infoData;
diff --git a/examples/network/torrent/peerwireclient.h b/examples/network/torrent/peerwireclient.h
index 391a77b8d8..7cd08d90cb 100644
--- a/examples/network/torrent/peerwireclient.h
+++ b/examples/network/torrent/peerwireclient.h
@@ -63,7 +63,7 @@ struct TorrentBlock
&& offset == other.offset
&& length == other.length;
}
-
+
int pieceIndex;
int offset;
int length;
diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp
index 748e5185fe..b5969e552e 100644
--- a/examples/network/torrent/torrentclient.cpp
+++ b/examples/network/torrent/torrentclient.cpp
@@ -1020,7 +1020,7 @@ void TorrentClient::blockReceived(int pieceIndex, int begin, const QByteArray &d
if (blocksLeftForPiece(piece) == 0) {
// Ask the file manager to verify the newly downloaded piece
d->fileManager.verifyPiece(piece->index);
-
+
// Remove this piece from all payloads
QMultiMap<PeerWireClient *, TorrentPiece *>::Iterator it = d->payloads.begin();
while (it != d->payloads.end()) {
@@ -1103,7 +1103,7 @@ void TorrentClient::scheduleUploads()
}
if ((client->peerWireState() & PeerWireClient::ChokingPeer) == 0) {
- if ((qrand() % 10) == 0)
+ if ((qrand() % 10) == 0)
client->abort();
else
client->chokePeer();
@@ -1245,7 +1245,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
if (d->state == WarmingUp || (qrand() & 4) == 0) {
int *occurrences = new int[d->pieceCount];
memset(occurrences, 0, d->pieceCount * sizeof(int));
-
+
// Count how many of each piece are available.
foreach (PeerWireClient *peer, d->connections) {
QBitArray peerPieces = peer->availablePieces();
@@ -1342,7 +1342,7 @@ void TorrentClient::requestMore(PeerWireClient *client)
? MaxBlocksInMultiMode : MaxBlocksInProgress);
if (numBlocksInProgress == maxInProgress)
return;
-
+
// Starting with the first piece that we're waiting for, request
// blocks until the quota is filled up.
foreach (TorrentPiece *piece, piecesInProgress) {
@@ -1446,7 +1446,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
// Skip our own server.
continue;
}
-
+
bool known = false;
foreach (TorrentPeer *knownPeer, d->peers) {
if (knownPeer->port == peer.port
diff --git a/examples/network/torrent/torrentclient.h b/examples/network/torrent/torrentclient.h
index be50189b53..7f48d1697c 100644
--- a/examples/network/torrent/torrentclient.h
+++ b/examples/network/torrent/torrentclient.h
@@ -124,7 +124,7 @@ public:
qint64 uploadedBytes() const;
int connectedPeerCount() const;
int seedCount() const;
-
+
// Accessors for the tracker
QByteArray peerId() const;
QByteArray infoHash() const;
@@ -142,7 +142,7 @@ signals:
void downloadCompleted();
void peerInfoUpdated();
-
+
void dataSent(int uploadedBytes);
void dataReceived(int downloadedBytes);
void progressUpdated(int percentProgress);
diff --git a/examples/network/torrent/trackerclient.h b/examples/network/torrent/trackerclient.h
index 17d237e665..6647422e3f 100644
--- a/examples/network/torrent/trackerclient.h
+++ b/examples/network/torrent/trackerclient.h
@@ -74,7 +74,7 @@ signals:
void uploadCountUpdated(qint64 newUploadCount);
void downloadCountUpdated(qint64 newDownloadCount);
-
+
void stopped();
protected:
@@ -99,7 +99,7 @@ private:
qint64 length;
QString uname;
QString pwd;
-
+
bool firstTrackerRequest;
bool lastTrackerRequest;
bool firstSeeding;