00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2016 Kurt Pattyn <pattyn.kurt@gmail.com>. 00004 ** Contact: https://www.qt.io/licensing/ 00005 ** 00006 ** This file is part of the QtWebSockets module of the Qt Toolkit. 00007 ** 00008 ** $QT_BEGIN_LICENSE:BSD$ 00009 ** Commercial License Usage 00010 ** Licensees holding valid commercial Qt licenses may use this file in 00011 ** accordance with the commercial license agreement provided with the 00012 ** Software or, alternatively, in accordance with the terms contained in 00013 ** a written agreement between you and The Qt Company. For licensing terms 00014 ** and conditions see https://www.qt.io/terms-conditions. For further 00015 ** information use the contact form at https://www.qt.io/contact-us. 00016 ** 00017 ** BSD License Usage 00018 ** Alternatively, you may use this file under the terms of the BSD license 00019 ** as follows: 00020 ** 00021 ** "Redistribution and use in source and binary forms, with or without 00022 ** modification, are permitted provided that the following conditions are 00023 ** met: 00024 ** * Redistributions of source code must retain the above copyright 00025 ** notice, this list of conditions and the following disclaimer. 00026 ** * Redistributions in binary form must reproduce the above copyright 00027 ** notice, this list of conditions and the following disclaimer in 00028 ** the documentation and/or other materials provided with the 00029 ** distribution. 00030 ** * Neither the name of The Qt Company Ltd nor the names of its 00031 ** contributors may be used to endorse or promote products derived 00032 ** from this software without specific prior written permission. 00033 ** 00034 ** 00035 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00036 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00037 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00038 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00039 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00040 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00041 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00042 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00043 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00044 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00045 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 00046 ** 00047 ** $QT_END_LICENSE$ 00048 ** 00049 ****************************************************************************/ 00050 #include <QtCore/QCoreApplication> 00051 #include <QtCore/QCommandLineParser> 00052 #include <QtCore/QCommandLineOption> 00053 #include "client.h" 00054 00055 int main(int argc, char *argv[]) 00056 { 00057 QCoreApplication a(argc, argv); 00058 00059 QCommandLineParser parser; 00060 parser.setApplicationDescription("PlotJuggler WebSockets client"); 00061 parser.addHelpOption(); 00062 00063 QCommandLineOption dbgOption(QStringList() << "d" << "debug", 00064 QCoreApplication::translate("main", "Debug output [default: off].")); 00065 parser.addOption(dbgOption); 00066 parser.process(a); 00067 bool debug = parser.isSet(dbgOption); 00068 00069 Client client(QUrl(QStringLiteral("ws://localhost:6666")), debug); 00070 QObject::connect(&client, &Client::closed, &a, &QCoreApplication::quit); 00071 00072 return a.exec(); 00073 }