summaryrefslogtreecommitdiffstats
path: root/examples/network/multistreamclient
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2016-08-03 09:50:55 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2016-08-03 11:46:21 +0000
commit5a133a404ebaa5233d5370ace10ba9532b9c6adc (patch)
tree9544da1252cf7d7aff1d195186c160235bf5c49b /examples/network/multistreamclient
parent733c4de36e71fa58dc444a181d725bfa46699a16 (diff)
Polish SCTP examples
- Introduce a common header file for client and server; - Update license headers; - Fix minor issues. Change-Id: I3fc42fd5ba32141c702fc6679a27bf0b6a16fd26 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'examples/network/multistreamclient')
-rw-r--r--examples/network/multistreamclient/chatconsumer.cpp14
-rw-r--r--examples/network/multistreamclient/chatconsumer.h14
-rw-r--r--examples/network/multistreamclient/client.cpp40
-rw-r--r--examples/network/multistreamclient/client.h22
-rw-r--r--examples/network/multistreamclient/consumer.h14
-rw-r--r--examples/network/multistreamclient/main.cpp14
-rw-r--r--examples/network/multistreamclient/movieconsumer.cpp14
-rw-r--r--examples/network/multistreamclient/movieconsumer.h14
-rw-r--r--examples/network/multistreamclient/timeconsumer.cpp14
-rw-r--r--examples/network/multistreamclient/timeconsumer.h14
10 files changed, 134 insertions, 40 deletions
diff --git a/examples/network/multistreamclient/chatconsumer.cpp b/examples/network/multistreamclient/chatconsumer.cpp
index 65840accae..723ecfaa23 100644
--- a/examples/network/multistreamclient/chatconsumer.cpp
+++ b/examples/network/multistreamclient/chatconsumer.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/chatconsumer.h b/examples/network/multistreamclient/chatconsumer.h
index cac846757f..9e12f99359 100644
--- a/examples/network/multistreamclient/chatconsumer.h
+++ b/examples/network/multistreamclient/chatconsumer.h
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/client.cpp b/examples/network/multistreamclient/client.cpp
index fbe138162e..112fb2e1a0 100644
--- a/examples/network/multistreamclient/client.cpp
+++ b/examples/network/multistreamclient/client.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
@@ -46,9 +56,11 @@
#include "timeconsumer.h"
#include "chatconsumer.h"
+#include "../shared/sctpchannels.h"
+
Client::Client(QWidget *parent)
: QDialog(parent)
- , consumers(NumberOfChannels)
+ , consumers(SctpChannels::NumberOfChannels)
{
setWindowTitle(tr("Multi-stream Client"));
@@ -100,12 +112,12 @@ Client::Client(QWidget *parent)
buttonBox->addButton(quitButton, QDialogButtonBox::AcceptRole);
QLabel *movieLabel = new QLabel(tr("Movie stream:"));
- consumers[Movie] = new MovieConsumer(this);
+ consumers[SctpChannels::Movie] = new MovieConsumer(this);
QLabel *timeLabel = new QLabel(tr("Time stream:"));
- consumers[Time] = new TimeConsumer(this);
+ consumers[SctpChannels::Time] = new TimeConsumer(this);
QLabel *chatLabel = new QLabel(tr("&Chat:"));
- consumers[Chat] = new ChatConsumer(this);
- chatLabel->setBuddy(consumers[Chat]->widget());
+ consumers[SctpChannels::Chat] = new ChatConsumer(this);
+ chatLabel->setBuddy(consumers[SctpChannels::Chat]->widget());
connect(hostCombo, &QComboBox::editTextChanged, this, &Client::enableConnectButton);
connect(portLineEdit, &QLineEdit::textChanged, this, &Client::enableConnectButton);
@@ -116,8 +128,8 @@ Client::Client(QWidget *parent)
connect(sctpSocket, &QSctpSocket::channelReadyRead, this, &Client::readDatagram);
connect(sctpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(displayError(QAbstractSocket::SocketError)));
- connect(consumers[Time], &Consumer::writeDatagram, this, &Client::writeDatagram);
- connect(consumers[Chat], &Consumer::writeDatagram, this, &Client::writeDatagram);
+ connect(consumers[SctpChannels::Time], &Consumer::writeDatagram, this, &Client::writeDatagram);
+ connect(consumers[SctpChannels::Chat], &Consumer::writeDatagram, this, &Client::writeDatagram);
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(hostLabel, 0, 0);
@@ -127,10 +139,10 @@ Client::Client(QWidget *parent)
mainLayout->addWidget(buttonBox, 2, 0, 1, 2);
mainLayout->addWidget(movieLabel, 3, 0);
mainLayout->addWidget(timeLabel, 3, 1);
- mainLayout->addWidget(consumers[Movie]->widget(), 4, 0);
- mainLayout->addWidget(consumers[Time]->widget(), 4, 1);
+ mainLayout->addWidget(consumers[SctpChannels::Movie]->widget(), 4, 0);
+ mainLayout->addWidget(consumers[SctpChannels::Time]->widget(), 4, 1);
mainLayout->addWidget(chatLabel, 5, 0);
- mainLayout->addWidget(consumers[Chat]->widget(), 6, 0, 1, 2);
+ mainLayout->addWidget(consumers[SctpChannels::Chat]->widget(), 6, 0, 1, 2);
setLayout(mainLayout);
portLineEdit->setFocus();
@@ -143,7 +155,7 @@ Client::~Client()
void Client::connected()
{
- consumers[Chat]->widget()->setFocus();
+ consumers[SctpChannels::Chat]->widget()->setFocus();
}
void Client::disconnected()
@@ -189,7 +201,7 @@ void Client::displayError(QAbstractSocket::SocketError socketError)
.arg(sctpSocket->errorString()));
}
- connectButton->setEnabled(true);
+ enableConnectButton();
}
void Client::enableConnectButton()
diff --git a/examples/network/multistreamclient/client.h b/examples/network/multistreamclient/client.h
index 6ec804e9be..c22a245eba 100644
--- a/examples/network/multistreamclient/client.h
+++ b/examples/network/multistreamclient/client.h
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
@@ -71,14 +81,6 @@ private slots:
void writeDatagram(const QByteArray &ba);
private:
- enum ChannelNumber {
- Movie = 0,
- Time = 1,
- Chat = 2,
-
- NumberOfChannels = 3
- };
-
QVector<Consumer *> consumers;
QSctpSocket *sctpSocket;
diff --git a/examples/network/multistreamclient/consumer.h b/examples/network/multistreamclient/consumer.h
index 0c7c1bbfb6..d70f8d67bf 100644
--- a/examples/network/multistreamclient/consumer.h
+++ b/examples/network/multistreamclient/consumer.h
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/main.cpp b/examples/network/multistreamclient/main.cpp
index c9e0c38d9a..b903214710 100644
--- a/examples/network/multistreamclient/main.cpp
+++ b/examples/network/multistreamclient/main.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/movieconsumer.cpp b/examples/network/multistreamclient/movieconsumer.cpp
index 68c7b4a229..ff5610a0b9 100644
--- a/examples/network/multistreamclient/movieconsumer.cpp
+++ b/examples/network/multistreamclient/movieconsumer.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/movieconsumer.h b/examples/network/multistreamclient/movieconsumer.h
index 0f4fd7af42..74321a8505 100644
--- a/examples/network/multistreamclient/movieconsumer.h
+++ b/examples/network/multistreamclient/movieconsumer.h
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/timeconsumer.cpp b/examples/network/multistreamclient/timeconsumer.cpp
index 3ad73a8712..6543e53cfc 100644
--- a/examples/network/multistreamclient/timeconsumer.cpp
+++ b/examples/network/multistreamclient/timeconsumer.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/examples/network/multistreamclient/timeconsumer.h b/examples/network/multistreamclient/timeconsumer.h
index d382e99d86..3faa4a6b1a 100644
--- a/examples/network/multistreamclient/timeconsumer.h
+++ b/examples/network/multistreamclient/timeconsumer.h
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are