From f821bb670543350be41e23b71788f0108b83f21b Mon Sep 17 00:00:00 2001 From: jontio Date: Sun, 8 Aug 2021 10:41:45 +1200 Subject: [PATCH] added ability to disable planelog window for ppl who don't want the ram usage of it. added source to statusbar --- JAERO/gui_classes/settingsdialog.cpp | 14 ++------ JAERO/gui_classes/settingsdialog.h | 3 +- JAERO/gui_classes/settingsdialog.ui | 51 ++++++++++++++++++++++++++-- JAERO/mainwindow.cpp | 22 ++++++++++-- JAERO/mainwindow.h | 1 + JAERO/zmq_audioreceiver.cpp | 2 +- 6 files changed, 74 insertions(+), 19 deletions(-) diff --git a/JAERO/gui_classes/settingsdialog.cpp b/JAERO/gui_classes/settingsdialog.cpp index 68f6a3a..018b5d7 100644 --- a/JAERO/gui_classes/settingsdialog.cpp +++ b/JAERO/gui_classes/settingsdialog.cpp @@ -115,14 +115,13 @@ void SettingsDialog::poulatepublicvars() } tcp_for_ads_messages_enabled=ui->checkOutputADSMessageToTCP->isChecked(); tcp_as_client_enabled=ui->checkTCPAsClient->isChecked(); - ui->checkTCPAsClient->setEnabled(ui->checkOutputADSMessageToTCP->isChecked()); + disablePlaneLogWindow=ui->checkBoxDisablePlaneLogWindow->isChecked(); localAudioOutEnabled=ui->ambeEnabled->isChecked(); zmqAudioOutEnabled=ui->remoteAmbeEnabled->isChecked(); zmqAudioOutBind=ui->lineEditZMQBind->text(); zmqAudioOutTopic=ui->lineEditZMQBindTopic->text(); - zmqAudioInputAddress = ui->lineEditZmqConnectAddress->text(); zmqAudioInputTopic = ui->lineEditZmqTopic->text(); zmqAudioInputEnabled = ui->checkBoxZMQ->isChecked(); @@ -156,27 +155,20 @@ void SettingsDialog::populatesettings() ui->lineEdittcpoutputadsmessagesaddress->setText(settings.value("lineEdittcpoutputadsmessagesaddress","0.0.0.0:30003").toString()); ui->checkOutputADSMessageToTCP->setChecked(settings.value("checkOutputADSMessageToTCP",false).toBool()); ui->checkTCPAsClient->setChecked(settings.value("checkTCPAsClient",false).toBool()); - + ui->checkBoxDisablePlaneLogWindow->setChecked(settings.value("checkBoxDisablePlaneLogWindow",false).toBool()); ui->ambeEnabled->setChecked(settings.value("localAudioOutEnabled", true).toBool()); ui->remoteAmbeEnabled->setChecked(settings.value("remoteAudioOutEnabled", false).toBool()); - - if(!ui->remoteAmbeEnabled->isChecked()) { ui->lineEditZMQBind->setEnabled(false); ui->lineEditZMQBindTopic->setEnabled(false); - } ui->lineEditZMQBind->setText(settings.value("remoteAudioOutBindAddress", "tcp://*:5551").toString()); ui->lineEditZMQBindTopic->setText(settings.value("remoteAudioOutBindTopic", "JAERO").toString()); - ui->checkBoxZMQ->setChecked(settings.value("zmqAudioInputEnabled", false).toBool()); ui->lineEditZmqConnectAddress->setText(settings.value("zmqAudioInputReceiveAddress", "tcp://127.0.0.1:6003").toString()); - - QString default_topic = settings_name.remove(QRegExp( "JAERO \\[" )).remove(QRegExp( "\\]" )); - ui->lineEditZmqTopic->setText(settings.value("zmqAudioInputReceiveTopic", default_topic).toString()); on_lineEditlogdir_editingFinished(); @@ -204,13 +196,13 @@ void SettingsDialog::accept() settings.setValue("lineEdittcpoutputadsmessagesaddress", ui->lineEdittcpoutputadsmessagesaddress->text()); settings.setValue("checkOutputADSMessageToTCP", ui->checkOutputADSMessageToTCP->isChecked()); settings.setValue("checkTCPAsClient", ui->checkTCPAsClient->isChecked()); + settings.setValue("checkBoxDisablePlaneLogWindow",ui->checkBoxDisablePlaneLogWindow->isChecked()); settings.setValue("localAudioOutEnabled", ui->ambeEnabled->isChecked()); settings.setValue("remoteAudioOutEnabled", ui->remoteAmbeEnabled->isChecked()); settings.setValue("remoteAudioOutBindAddress",ui->lineEditZMQBind->text()); settings.setValue("remoteAudioOutBindTopic",ui->lineEditZMQBindTopic->text()); - settings.setValue("zmqAudioInputEnabled", ui->checkBoxZMQ->isChecked()); settings.setValue("zmqAudioInputReceiveAddress", ui->lineEditZmqConnectAddress->text()); settings.setValue("zmqAudioInputReceiveTopic", ui->lineEditZmqTopic->text()); diff --git a/JAERO/gui_classes/settingsdialog.h b/JAERO/gui_classes/settingsdialog.h index 177417f..cbf0121 100644 --- a/JAERO/gui_classes/settingsdialog.h +++ b/JAERO/gui_classes/settingsdialog.h @@ -51,7 +51,6 @@ class SettingsDialog : public QDialog bool tcp_for_ads_messages_enabled; bool tcp_as_client_enabled; - bool cpuSaveMode; bool disableAcarsConsole; @@ -64,7 +63,7 @@ class SettingsDialog : public QDialog QString zmqAudioInputAddress; QString zmqAudioInputTopic; - + bool disablePlaneLogWindow; private: Ui::SettingsDialog *ui; diff --git a/JAERO/gui_classes/settingsdialog.ui b/JAERO/gui_classes/settingsdialog.ui index 2721f6c..a76c5f5 100644 --- a/JAERO/gui_classes/settingsdialog.ui +++ b/JAERO/gui_classes/settingsdialog.ui @@ -503,7 +503,7 @@ eg "localhost:12345 localhost:12346" 120 - 28 + 58 291 21 @@ -512,14 +512,14 @@ eg "localhost:12345 localhost:12346" <html><head/><body><p>URL for plane lookup. {AES} is the plane ICAO number in hex and {REG} is the registration.</p></body></html> - http://junzisun.com/aif/?q={AES}# + http://www.flightradar24.com/data/airplanes/{REG} 10 - 30 + 60 101 16 @@ -528,6 +528,19 @@ eg "localhost:12345 localhost:12346" Plane lookup + + + + 10 + 20 + 201 + 19 + + + + Disable plane log window + + @@ -789,5 +802,37 @@ eg "localhost:12345 localhost:12346" + + checkBoxDisablePlaneLogWindow + toggled(bool) + lineEditplanelookup + setDisabled(bool) + + + 123 + 65 + + + 278 + 104 + + + + + checkBoxZMQ + toggled(bool) + checkBoxlogwidebandwidthenable + setDisabled(bool) + + + 83 + 576 + + + 193 + 635 + + + diff --git a/JAERO/mainwindow.cpp b/JAERO/mainwindow.cpp index 9f6d811..ac32192 100644 --- a/JAERO/mainwindow.cpp +++ b/JAERO/mainwindow.cpp @@ -128,9 +128,11 @@ MainWindow::MainWindow(QWidget *parent) : connect(ambe,SIGNAL(decoded_signal(QByteArray)),audioout,SLOT(audioin(QByteArray))); //statusbar setup + sourcelabel = new QLabel(); freqlabel = new QLabel(); ebnolabel = new QLabel(); ui->statusBar->addPermanentWidget(new QLabel()); + ui->statusBar->addPermanentWidget(sourcelabel); ui->statusBar->addPermanentWidget(freqlabel); ui->statusBar->addPermanentWidget(ebnolabel); @@ -147,7 +149,7 @@ MainWindow::MainWindow(QWidget *parent) : //aeroL connections connect(aerol,SIGNAL(DataCarrierDetect(bool)),this,SLOT(DataCarrierDetectStatusSlot(bool))); - connect(aerol,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&))); +//// connect(aerol,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&))); connect(aerol,SIGNAL(ACARSsignal(ACARSItem&)),this,SLOT(ACARSslot(ACARSItem&))); connect(aerol,SIGNAL(DataCarrierDetect(bool)),audiomskdemodulator,SLOT(DCDstatSlot(bool))); connect(aerol,SIGNAL(DataCarrierDetect(bool)),audioburstmskdemodulator,SLOT(DCDstatSlot(bool))); @@ -157,7 +159,7 @@ MainWindow::MainWindow(QWidget *parent) : //aeroL2 connections connect(aerol2,SIGNAL(DataCarrierDetect(bool)),this,SLOT(DataCarrierDetectStatusSlot(bool))); - connect(aerol2,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&))); +//// connect(aerol2,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&))); connect(aerol2,SIGNAL(ACARSsignal(ACARSItem&)),this,SLOT(ACARSslot(ACARSItem&))); //load settings @@ -961,6 +963,22 @@ void MainWindow::acceptsettings() aerol2->setDoNotDisplaySUs(settingsdialog->donotdisplaysus); aerol2->setDataBaseDir(settingsdialog->planesfolder); + if(settingsdialog->disablePlaneLogWindow) + { + disconnect(aerol,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&))); + disconnect(aerol2,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&))); + ui->action_PlaneLog->setVisible(false); + } + else + { + connect(aerol,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&)),Qt::UniqueConnection); + connect(aerol2,SIGNAL(ACARSsignal(ACARSItem&)),planelog,SLOT(ACARSslot(ACARSItem&)),Qt::UniqueConnection); + ui->action_PlaneLog->setVisible(true); + } + + if(settingsdialog->zmqAudioInputEnabled)sourcelabel->setText(" "+settingsdialog->zmqAudioInputTopic+" "); + else sourcelabel->setText(" "+settingsdialog->audioinputdevice.deviceName()+" "); + //start or stop tcp server/client if(settingsdialog->tcp_for_ads_messages_enabled)sbs1->starttcpconnection(settingsdialog->tcp_for_ads_messages_address,settingsdialog->tcp_for_ads_messages_port,settingsdialog->tcp_as_client_enabled); else sbs1->stoptcpconnection(); diff --git a/JAERO/mainwindow.h b/JAERO/mainwindow.h index 0e96b09..403ad0e 100644 --- a/JAERO/mainwindow.h +++ b/JAERO/mainwindow.h @@ -47,6 +47,7 @@ class MainWindow : public QMainWindow AudioMskDemodulator::Settings audiomskdemodulatorsettings; QLabel *ebnolabel; QLabel *freqlabel; + QLabel *sourcelabel; QUdpSocket *udpsocket; //OQPSK add diff --git a/JAERO/zmq_audioreceiver.cpp b/JAERO/zmq_audioreceiver.cpp index 0f700c4..097e62d 100644 --- a/JAERO/zmq_audioreceiver.cpp +++ b/JAERO/zmq_audioreceiver.cpp @@ -40,7 +40,7 @@ void ZMQAudioReceiver::process() char buf [recsize]; unsigned char rate[4]; - quint32 sampleRate; + quint32 sampleRate=48000; int received; running = true;