kopia lustrzana https://gitlab.com/eliggett/wfview
Change class constructors to include parent
rodzic
066c1b58ac
commit
ac677db7ac
|
@ -2,7 +2,8 @@
|
||||||
#include "logcategories.h"
|
#include "logcategories.h"
|
||||||
#include "ulaw.h"
|
#include "ulaw.h"
|
||||||
|
|
||||||
audioConverter::audioConverter(){
|
audioConverter::audioConverter(QObject* parent) : QObject(parent)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool audioConverter::init(QAudioFormat inFormat, QAudioFormat outFormat, quint8 opusComplexity, quint8 resampleQuality)
|
bool audioConverter::init(QAudioFormat inFormat, QAudioFormat outFormat, quint8 opusComplexity, quint8 resampleQuality)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class audioConverter : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
audioConverter();
|
explicit audioConverter(QObject* parent = nullptr);;
|
||||||
~audioConverter();
|
~audioConverter();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
audioHandler::audioHandler(QObject* parent)
|
audioHandler::audioHandler(QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ bool audioHandler::init(audioSetup setup)
|
||||||
|
|
||||||
// We "hopefully" now have a valid format that is supported so try connecting
|
// We "hopefully" now have a valid format that is supported so try connecting
|
||||||
|
|
||||||
converter = new audioConverter();
|
converter = new audioConverter(this);
|
||||||
converterThread = new QThread(this);
|
converterThread = new QThread(this);
|
||||||
if (setup.isinput) {
|
if (setup.isinput) {
|
||||||
converterThread->setObjectName("audioConvIn()");
|
converterThread->setObjectName("audioConvIn()");
|
||||||
|
|
|
@ -78,7 +78,7 @@ class audioHandler : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
audioHandler(QObject* parent = 0);
|
explicit audioHandler(QObject* parent = nullptr);
|
||||||
~audioHandler();
|
~audioHandler();
|
||||||
|
|
||||||
int getLatency();
|
int getLatency();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
// Copyright 2017-2020 Elliott H. Liggett
|
// Copyright 2017-2020 Elliott H. Liggett
|
||||||
|
|
||||||
commHandler::commHandler()
|
commHandler::commHandler(QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
//constructor
|
//constructor
|
||||||
// grab baud rate and other comm port details
|
// grab baud rate and other comm port details
|
||||||
|
@ -31,7 +31,7 @@ commHandler::commHandler()
|
||||||
connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn()));
|
connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn()));
|
||||||
}
|
}
|
||||||
|
|
||||||
commHandler::commHandler(QString portName, quint32 baudRate, quint8 wfFormat)
|
commHandler::commHandler(QString portName, quint32 baudRate, quint8 wfFormat, QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
//constructor
|
//constructor
|
||||||
// grab baud rate and other comm port details
|
// grab baud rate and other comm port details
|
||||||
|
|
|
@ -15,8 +15,8 @@ class commHandler : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
commHandler();
|
commHandler(QObject* parent = nullptr);
|
||||||
commHandler(QString portName, quint32 baudRate, quint8 wfFormat);
|
commHandler(QString portName, quint32 baudRate, quint8 wfFormat,QObject* parent = nullptr);
|
||||||
bool serialError;
|
bool serialError;
|
||||||
bool rtsStatus();
|
bool rtsStatus();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
// Copyright 2017-2021 Elliott H. Liggett & Phil Taylor
|
// Copyright 2017-2021 Elliott H. Liggett & Phil Taylor
|
||||||
|
|
||||||
pttyHandler::pttyHandler(QString pty)
|
pttyHandler::pttyHandler(QString pty, QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
//constructor
|
//constructor
|
||||||
if (pty == "" || pty.toLower() == "none")
|
if (pty == "" || pty.toLower() == "none")
|
||||||
|
|
|
@ -19,7 +19,7 @@ class pttyHandler : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
pttyHandler(QString portName);
|
explicit pttyHandler(QString portName, QObject* parent = nullptr);
|
||||||
pttyHandler(QString portName, quint32 baudRate);
|
pttyHandler(QString portName, quint32 baudRate);
|
||||||
bool serialError;
|
bool serialError;
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
// Note: When sending \x00, must use QByteArray.setRawData()
|
// Note: When sending \x00, must use QByteArray.setRawData()
|
||||||
|
|
||||||
rigCommander::rigCommander()
|
rigCommander::rigCommander(QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
qInfo(logRig()) << "creating instance of rigCommander()";
|
qInfo(logRig()) << "creating instance of rigCommander()";
|
||||||
state.set(SCOPEFUNC, true, false);
|
state.set(SCOPEFUNC, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
rigCommander::rigCommander(quint8 guid[GUIDLEN])
|
rigCommander::rigCommander(quint8 guid[GUIDLEN], QObject* parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
qInfo(logRig()) << "creating instance of rigCommander()";
|
qInfo(logRig()) << "creating instance of rigCommander()";
|
||||||
state.set(SCOPEFUNC, true, false);
|
state.set(SCOPEFUNC, true, false);
|
||||||
|
@ -59,8 +59,8 @@ void rigCommander::commSetup(unsigned char rigCivAddr, QString rigSerialPort, qu
|
||||||
this->rigBaudRate = rigBaudRate;
|
this->rigBaudRate = rigBaudRate;
|
||||||
rigCaps.baudRate = rigBaudRate;
|
rigCaps.baudRate = rigBaudRate;
|
||||||
|
|
||||||
comm = new commHandler(rigSerialPort, rigBaudRate,wf);
|
comm = new commHandler(rigSerialPort, rigBaudRate,wf,this);
|
||||||
ptty = new pttyHandler(vsp);
|
ptty = new pttyHandler(vsp,this);
|
||||||
|
|
||||||
if (tcpPort > 0) {
|
if (tcpPort > 0) {
|
||||||
tcp = new tcpServer(this);
|
tcp = new tcpServer(this);
|
||||||
|
@ -132,7 +132,7 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs, aud
|
||||||
//this->rigSerialPort = rigSerialPort;
|
//this->rigSerialPort = rigSerialPort;
|
||||||
//this->rigBaudRate = rigBaudRate;
|
//this->rigBaudRate = rigBaudRate;
|
||||||
|
|
||||||
ptty = new pttyHandler(vsp);
|
ptty = new pttyHandler(vsp,this);
|
||||||
|
|
||||||
if (tcpPort > 0) {
|
if (tcpPort > 0) {
|
||||||
tcp = new tcpServer(this);
|
tcp = new tcpServer(this);
|
||||||
|
|
|
@ -69,8 +69,8 @@ class rigCommander : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
rigCommander();
|
explicit rigCommander(QObject* parent=nullptr);
|
||||||
rigCommander(quint8 guid[GUIDLEN]);
|
explicit rigCommander(quint8 guid[GUIDLEN], QObject* parent = nullptr);
|
||||||
~rigCommander();
|
~rigCommander();
|
||||||
|
|
||||||
bool usingLAN();
|
bool usingLAN();
|
||||||
|
|
|
@ -326,7 +326,7 @@ class rigCtlD : public QTcpServer
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit rigCtlD(QObject *parent=Q_NULLPTR);
|
explicit rigCtlD(QObject *parent=nullptr);
|
||||||
virtual ~rigCtlD();
|
virtual ~rigCtlD();
|
||||||
|
|
||||||
int startServer(qint16 port);
|
int startServer(qint16 port);
|
||||||
|
|
|
@ -102,7 +102,7 @@ void servermain::makeRig()
|
||||||
if (radio->rigThread == Q_NULLPTR)
|
if (radio->rigThread == Q_NULLPTR)
|
||||||
{
|
{
|
||||||
qInfo(logSystem()) << "Creating new rigThread()";
|
qInfo(logSystem()) << "Creating new rigThread()";
|
||||||
radio->rig = new rigCommander(radio->guid);
|
radio->rig = new rigCommander(radio->guid,this);
|
||||||
radio->rigThread = new QThread(this);
|
radio->rigThread = new QThread(this);
|
||||||
radio->rigThread->setObjectName("rigCommander()");
|
radio->rigThread->setObjectName("rigCommander()");
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ void servermain::setServerToPrefs()
|
||||||
udp = Q_NULLPTR;
|
udp = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
udp = new udpServer(&serverConfig);
|
udp = new udpServer(&serverConfig,this);
|
||||||
|
|
||||||
serverThread = new QThread(this);
|
serverThread = new QThread(this);
|
||||||
serverThread->setObjectName("udpServer()");
|
serverThread->setObjectName("udpServer()");
|
||||||
|
|
|
@ -921,7 +921,7 @@ udpAudio::udpAudio(QHostAddress local, QHostAddress ip, quint16 audioPort, quint
|
||||||
|
|
||||||
QUdpSocket::connect(udp, &QUdpSocket::readyRead, this, &udpAudio::dataReceived);
|
QUdpSocket::connect(udp, &QUdpSocket::readyRead, this, &udpAudio::dataReceived);
|
||||||
|
|
||||||
rxaudio = new audioHandler();
|
rxaudio = new audioHandler(this);
|
||||||
rxAudioThread = new QThread(this);
|
rxAudioThread = new QThread(this);
|
||||||
rxAudioThread->setObjectName("rxAudio()");
|
rxAudioThread->setObjectName("rxAudio()");
|
||||||
|
|
||||||
|
@ -946,7 +946,7 @@ udpAudio::udpAudio(QHostAddress local, QHostAddress ip, quint16 audioPort, quint
|
||||||
pingTimer->start(PING_PERIOD); // send ping packets every 100ms
|
pingTimer->start(PING_PERIOD); // send ping packets every 100ms
|
||||||
|
|
||||||
if (enableTx) {
|
if (enableTx) {
|
||||||
txaudio = new audioHandler();
|
txaudio = new audioHandler(this);
|
||||||
txAudioThread = new QThread(this);
|
txAudioThread = new QThread(this);
|
||||||
rxAudioThread->setObjectName("txAudio()");
|
rxAudioThread->setObjectName("txAudio()");
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
#define STALE_CONNECTION 15
|
#define STALE_CONNECTION 15
|
||||||
#define LOCK_PERIOD 10 // time to attempt to lock Mutex in ms
|
#define LOCK_PERIOD 10 // time to attempt to lock Mutex in ms
|
||||||
#define AUDIO_SEND_PERIOD 20 //
|
#define AUDIO_SEND_PERIOD 20 //
|
||||||
udpServer::udpServer(SERVERCONFIG* config) :
|
udpServer::udpServer(SERVERCONFIG* config, QObject* parent) :
|
||||||
config(config)
|
config(config),
|
||||||
|
QObject(parent)
|
||||||
{
|
{
|
||||||
qInfo(logUdpServer()) << "Starting udp server";
|
qInfo(logUdpServer()) << "Starting udp server";
|
||||||
}
|
}
|
||||||
|
@ -366,7 +367,7 @@ void udpServer::controlReceived()
|
||||||
|
|
||||||
outAudio.isinput = false;
|
outAudio.isinput = false;
|
||||||
|
|
||||||
radio->txaudio = new audioHandler();
|
radio->txaudio = new audioHandler(this);
|
||||||
radio->txAudioThread = new QThread(this);
|
radio->txAudioThread = new QThread(this);
|
||||||
radio->txAudioThread->setObjectName("txAudio()");
|
radio->txAudioThread->setObjectName("txAudio()");
|
||||||
|
|
||||||
|
@ -408,7 +409,7 @@ void udpServer::controlReceived()
|
||||||
radio->rxAudioSetup.isinput = true;
|
radio->rxAudioSetup.isinput = true;
|
||||||
memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN);
|
memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN);
|
||||||
|
|
||||||
radio->rxaudio = new audioHandler();
|
radio->rxaudio = new audioHandler(this);
|
||||||
|
|
||||||
radio->rxAudioThread = new QThread(this);
|
radio->rxAudioThread = new QThread(this);
|
||||||
radio->rxAudioThread->setObjectName("rxAudio()");
|
radio->rxAudioThread->setObjectName("rxAudio()");
|
||||||
|
|
|
@ -99,7 +99,7 @@ class udpServer : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
udpServer(SERVERCONFIG* config);
|
explicit udpServer(SERVERCONFIG* config, QObject* parent = nullptr);
|
||||||
~udpServer();
|
~udpServer();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -405,7 +405,7 @@ void wfmain::makeRig()
|
||||||
{
|
{
|
||||||
if (rigThread == Q_NULLPTR)
|
if (rigThread == Q_NULLPTR)
|
||||||
{
|
{
|
||||||
rig = new rigCommander();
|
rig = new rigCommander(this);
|
||||||
rigThread = new QThread(this);
|
rigThread = new QThread(this);
|
||||||
rigThread->setObjectName("rigCommander()");
|
rigThread->setObjectName("rigCommander()");
|
||||||
|
|
||||||
|
@ -993,7 +993,7 @@ void wfmain::setServerToPrefs()
|
||||||
if (serverConfig.enabled) {
|
if (serverConfig.enabled) {
|
||||||
serverConfig.lan = prefs.enableLAN;
|
serverConfig.lan = prefs.enableLAN;
|
||||||
|
|
||||||
udp = new udpServer(&serverConfig);
|
udp = new udpServer(&serverConfig,this);
|
||||||
|
|
||||||
serverThread = new QThread(this);
|
serverThread = new QThread(this);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue