diff options
22 files changed, 329 insertions, 75 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 diff --git a/examples/network/multistreamserver/chatprovider.cpp b/examples/network/multistreamserver/chatprovider.cpp index 9a88d491ab..a6ba9c6a27 100644 --- a/examples/network/multistreamserver/chatprovider.cpp +++ b/examples/network/multistreamserver/chatprovider.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/multistreamserver/chatprovider.h b/examples/network/multistreamserver/chatprovider.h index 912101ec34..b6ff61a917 100644 --- a/examples/network/multistreamserver/chatprovider.h +++ b/examples/network/multistreamserver/chatprovider.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/multistreamserver/main.cpp b/examples/network/multistreamserver/main.cpp index 04350cd13d..ae201f6b82 100644 --- a/examples/network/multistreamserver/main.cpp +++ b/examples/network/multistreamserver/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/multistreamserver/movieprovider.cpp b/examples/network/multistreamserver/movieprovider.cpp index cc534e6f40..335038a515 100644 --- a/examples/network/multistreamserver/movieprovider.cpp +++ b/examples/network/multistreamserver/movieprovider.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/multistreamserver/movieprovider.h b/examples/network/multistreamserver/movieprovider.h index d6d8fb7449..46de20a648 100644 --- a/examples/network/multistreamserver/movieprovider.h +++ b/examples/network/multistreamserver/movieprovider.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/multistreamserver/provider.h b/examples/network/multistreamserver/provider.h index c6ec612275..5be14d5ed8 100644 --- a/examples/network/multistreamserver/provider.h +++ b/examples/network/multistreamserver/provider.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/multistreamserver/server.cpp b/examples/network/multistreamserver/server.cpp index 1fb18e80b9..3b06c0fd37 100644 --- a/examples/network/multistreamserver/server.cpp +++ b/examples/network/multistreamserver/server.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2015 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 @@ -47,9 +57,11 @@ #include "timeprovider.h" #include "chatprovider.h" +#include "../shared/sctpchannels.h" + Server::Server(QWidget *parent) : QDialog(parent) - , providers(NumberOfChannels) + , providers(SctpChannels::NumberOfChannels) { setWindowTitle(tr("Multi-stream Server")); @@ -59,15 +71,15 @@ Server::Server(QWidget *parent) statusLabel = new QLabel; QPushButton *quitButton = new QPushButton(tr("Quit")); - providers[Movie] = new MovieProvider(this); - providers[Time] = new TimeProvider(this); - providers[Chat] = new ChatProvider(this); + providers[SctpChannels::Movie] = new MovieProvider(this); + providers[SctpChannels::Time] = new TimeProvider(this); + providers[SctpChannels::Chat] = new ChatProvider(this); connect(sctpServer, &QSctpServer::newConnection, this, &Server::newConnection); connect(quitButton, &QPushButton::clicked, this, &Server::accept); - connect(providers[Movie], &Provider::writeDatagram, this, &Server::writeDatagram); - connect(providers[Time], &Provider::writeDatagram, this, &Server::writeDatagram); - connect(providers[Chat], &Provider::writeDatagram, this, &Server::writeDatagram); + connect(providers[SctpChannels::Movie], &Provider::writeDatagram, this, &Server::writeDatagram); + connect(providers[SctpChannels::Time], &Provider::writeDatagram, this, &Server::writeDatagram); + connect(providers[SctpChannels::Chat], &Provider::writeDatagram, this, &Server::writeDatagram); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(statusLabel); diff --git a/examples/network/multistreamserver/server.h b/examples/network/multistreamserver/server.h index 6d01f7a238..d9a38e61a4 100644 --- a/examples/network/multistreamserver/server.h +++ b/examples/network/multistreamserver/server.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(QSctpSocket *to, const QByteArray &ba); private: - enum ChannelNumber { - Movie = 0, - Time = 1, - Chat = 2, - - NumberOfChannels = 3 - }; - QVector<Provider *> providers; QSctpServer *sctpServer; QList<QSctpSocket *> connections; diff --git a/examples/network/multistreamserver/timeprovider.cpp b/examples/network/multistreamserver/timeprovider.cpp index 043810cdf3..fb50baac26 100644 --- a/examples/network/multistreamserver/timeprovider.cpp +++ b/examples/network/multistreamserver/timeprovider.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 @@ -55,6 +65,8 @@ void TimeProvider::readDatagram(QSctpSocket &from, const QByteArray &ba) QTime clientTime; in_ds >> clientTime; + // Send response only if a displayed part of the time is changed. + // So, sub-second differences are ignored. if (!clientTime.isValid() || curTime.second() != clientTime.second() || curTime.minute() != clientTime.minute() || curTime.hour() != clientTime.hour()) { diff --git a/examples/network/multistreamserver/timeprovider.h b/examples/network/multistreamserver/timeprovider.h index b57c066c24..f99cdbc717 100644 --- a/examples/network/multistreamserver/timeprovider.h +++ b/examples/network/multistreamserver/timeprovider.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/network.pro b/examples/network/network.pro index ff7fbcf4f2..6a09acaae8 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -34,3 +34,5 @@ qtHaveModule(widgets) { contains(QT_CONFIG, openssl-linked):SUBDIRS += securesocketclient contains(QT_CONFIG, sctp):SUBDIRS += multistreamserver multistreamclient } + +EXAMPLE_FILES = shared diff --git a/examples/network/shared/sctpchannels.h b/examples/network/shared/sctpchannels.h new file mode 100644 index 0000000000..f8d78ee33b --- /dev/null +++ b/examples/network/shared/sctpchannels.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SCTPCHANNELS_H +#define SCTPCHANNELS_H + +enum SctpChannels { + Movie = 0, + Time = 1, + Chat = 2, + + NumberOfChannels = 3 +}; + +#endif |