Skip to content

Commit

Permalink
added ability to disable planelog window for ppl who don't want the r…
Browse files Browse the repository at this point in the history
…am usage of it. added source to statusbar
  • Loading branch information
jontio committed Aug 7, 2021
1 parent a8b376c commit f821bb6
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 19 deletions.
14 changes: 3 additions & 11 deletions JAERO/gui_classes/settingsdialog.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions JAERO/gui_classes/settingsdialog.h
Expand Up @@ -51,7 +51,6 @@ class SettingsDialog : public QDialog
bool tcp_for_ads_messages_enabled;
bool tcp_as_client_enabled;


bool cpuSaveMode;
bool disableAcarsConsole;

Expand All @@ -64,7 +63,7 @@ class SettingsDialog : public QDialog
QString zmqAudioInputAddress;
QString zmqAudioInputTopic;


bool disablePlaneLogWindow;

private:
Ui::SettingsDialog *ui;
Expand Down
51 changes: 48 additions & 3 deletions JAERO/gui_classes/settingsdialog.ui
Expand Up @@ -503,7 +503,7 @@ eg &quot;localhost:12345 localhost:12346&quot;</string>
<property name="geometry">
<rect>
<x>120</x>
<y>28</y>
<y>58</y>
<width>291</width>
<height>21</height>
</rect>
Expand All @@ -512,14 +512,14 @@ eg &quot;localhost:12345 localhost:12346&quot;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;URL for plane lookup. {AES} is the plane ICAO number in hex and {REG} is the registration.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>http://junzisun.com/aif/?q={AES}#</string>
<string>http://www.flightradar24.com/data/airplanes/{REG}</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<y>60</y>
<width>101</width>
<height>16</height>
</rect>
Expand All @@ -528,6 +528,19 @@ eg &quot;localhost:12345 localhost:12346&quot;</string>
<string>Plane lookup</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxDisablePlaneLogWindow">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>201</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>Disable plane log window</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="voicesettings">
<property name="sizePolicy">
Expand Down Expand Up @@ -789,5 +802,37 @@ eg &quot;localhost:12345 localhost:12346&quot;</string>
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxDisablePlaneLogWindow</sender>
<signal>toggled(bool)</signal>
<receiver>lineEditplanelookup</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>65</y>
</hint>
<hint type="destinationlabel">
<x>278</x>
<y>104</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxZMQ</sender>
<signal>toggled(bool)</signal>
<receiver>checkBoxlogwidebandwidthenable</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>83</x>
<y>576</y>
</hint>
<hint type="destinationlabel">
<x>193</x>
<y>635</y>
</hint>
</hints>
</connection>
</connections>
</ui>
22 changes: 20 additions & 2 deletions JAERO/mainwindow.cpp
Expand Up @@ -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);

Expand All @@ -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)));
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions JAERO/mainwindow.h
Expand Up @@ -47,6 +47,7 @@ class MainWindow : public QMainWindow
AudioMskDemodulator::Settings audiomskdemodulatorsettings;
QLabel *ebnolabel;
QLabel *freqlabel;
QLabel *sourcelabel;
QUdpSocket *udpsocket;

//OQPSK add
Expand Down
2 changes: 1 addition & 1 deletion JAERO/zmq_audioreceiver.cpp
Expand Up @@ -40,7 +40,7 @@ void ZMQAudioReceiver::process()

char buf [recsize];
unsigned char rate[4];
quint32 sampleRate;
quint32 sampleRate=48000;
int received;

running = true;
Expand Down

0 comments on commit f821bb6

Please sign in to comment.