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