diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-02-16 14:51:41 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-02-17 12:59:47 +0000 |
commit | 1bbba5b9e8761fabe79a212e221102503fb0ac25 (patch) | |
tree | 2819879f98063497e9961166ee456227323c0c9f /examples/websockets/echoclient/main.cpp | |
parent | e0521c794bd1a4325d0c59e8f75aa263efa671d5 (diff) |
Examples: add an option for debug outputs in echoclient
Change-Id: I9bec2324b666c00212135ef6c9d5a69594cda050
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'examples/websockets/echoclient/main.cpp')
-rw-r--r-- | examples/websockets/echoclient/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/websockets/echoclient/main.cpp b/examples/websockets/echoclient/main.cpp index cdc6d04..911c069 100644 --- a/examples/websockets/echoclient/main.cpp +++ b/examples/websockets/echoclient/main.cpp @@ -31,12 +31,25 @@ ** ****************************************************************************/ #include <QtCore/QCoreApplication> +#include <QtCore/QCommandLineParser> +#include <QtCore/QCommandLineOption> #include "echoclient.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); - EchoClient client(QUrl(QStringLiteral("ws://localhost:1234"))); + + QCommandLineParser parser; + parser.setApplicationDescription("QtWebSockets example: echoclient"); + parser.addHelpOption(); + + QCommandLineOption dbgOption(QStringList() << "d" << "debug", + QCoreApplication::translate("main", "Debug output [default: off].")); + parser.addOption(dbgOption); + parser.process(a); + bool debug = parser.isSet(dbgOption); + + EchoClient client(QUrl(QStringLiteral("ws://localhost:1234")), debug); QObject::connect(&client, &EchoClient::closed, &a, &QCoreApplication::quit); return a.exec(); |