From 1bbba5b9e8761fabe79a212e221102503fb0ac25 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 16 Feb 2015 14:51:41 +0100 Subject: Examples: add an option for debug outputs in echoclient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9bec2324b666c00212135ef6c9d5a69594cda050 Reviewed-by: Topi Reiniƶ --- examples/websockets/echoclient/main.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'examples/websockets/echoclient/main.cpp') 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 +#include +#include #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(); -- cgit v1.2.1