2013-09-04 13:14:18 -04:00
|
|
|
//---------------------------------------------------------------- MainWindow
|
2012-05-22 13:09:48 -04:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
2013-08-05 09:57:55 -04:00
|
|
|
|
2013-08-07 19:09:13 -04:00
|
|
|
#include <QThread>
|
2013-08-07 10:49:45 -04:00
|
|
|
#include <QColorDialog>
|
2013-08-07 19:09:13 -04:00
|
|
|
|
|
|
|
#include "soundout.h"
|
2012-05-22 13:09:48 -04:00
|
|
|
#include "devsetup.h"
|
|
|
|
#include "plotter.h"
|
|
|
|
#include "about.h"
|
|
|
|
#include "widegraph.h"
|
|
|
|
#include "sleep.h"
|
2012-10-28 11:47:43 -04:00
|
|
|
#include "getfile.h"
|
2013-03-21 13:22:32 -04:00
|
|
|
#include "logqso.h"
|
2013-05-23 16:21:47 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
|
|
|
|
|
2013-05-23 16:21:47 -04:00
|
|
|
#ifdef QT5
|
|
|
|
#include <QtConcurrent/QtConcurrentRun>
|
|
|
|
#endif
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-08-05 09:57:55 -04:00
|
|
|
int itone[NUM_JT65_SYMBOLS]; //Audio tones for all Tx symbols
|
|
|
|
int icw[NUM_CW_SYMBOLS]; //Dits for CW ID
|
|
|
|
|
2013-05-24 08:36:41 -04:00
|
|
|
int outBufSize;
|
2013-03-11 11:51:44 -04:00
|
|
|
int rc;
|
2013-07-08 09:17:22 -04:00
|
|
|
qint32 g_COMportOpen;
|
|
|
|
qint32 g_iptt;
|
2013-04-17 13:59:28 -04:00
|
|
|
static int nc1=1;
|
2013-03-11 11:51:44 -04:00
|
|
|
wchar_t buffer[256];
|
2013-07-23 06:28:22 -04:00
|
|
|
|
2012-10-16 19:32:15 -04:00
|
|
|
|
2013-04-22 20:52:51 -04:00
|
|
|
Rig* rig = NULL;
|
2013-04-28 15:48:15 -04:00
|
|
|
QTextEdit* pShortcuts;
|
2013-07-23 13:32:59 -04:00
|
|
|
QTcpSocket* commanderSocket = new QTcpSocket(0);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
QString rev="$Rev$";
|
2013-08-05 11:22:59 -04:00
|
|
|
QString Program_Title_Version=" WSJT-X v1.2, r" + rev.mid(6,4) +
|
2012-05-22 13:09:48 -04:00
|
|
|
" by K1JT";
|
|
|
|
|
|
|
|
//-------------------------------------------------- MainWindow constructor
|
2013-07-18 20:23:40 -04:00
|
|
|
// Multiple instances: new arg *thekey
|
2013-08-10 11:29:55 -04:00
|
|
|
MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *thekey,
|
|
|
|
qint32 fontSize2, qint32 fontWeight2,
|
2013-07-24 15:07:57 -04:00
|
|
|
QWidget *parent) :
|
2012-05-22 13:09:48 -04:00
|
|
|
QMainWindow(parent),
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings (settings),
|
2013-08-05 09:57:55 -04:00
|
|
|
ui(new Ui::MainWindow),
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph (new WideGraph (settings)),
|
|
|
|
m_logDlg (new LogQSO (settings, this)),
|
2013-08-17 15:21:14 -04:00
|
|
|
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2),
|
2013-08-07 19:09:13 -04:00
|
|
|
m_audioInputDevice (QAudioDeviceInfo::defaultInputDevice ()), // start with default
|
|
|
|
m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
|
2013-08-05 09:57:55 -04:00
|
|
|
m_audioOutputDevice (QAudioDeviceInfo::defaultOutputDevice ()), // start with default
|
2013-08-16 19:24:48 -04:00
|
|
|
m_soundOutput (&m_modulator),
|
2013-08-16 19:31:19 -04:00
|
|
|
psk_Reporter (new PSK_Reporter (this))
|
2012-05-22 13:09:48 -04:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2013-08-07 19:09:13 -04:00
|
|
|
|
|
|
|
connect (this, &MainWindow::finished, this, &MainWindow::close);
|
|
|
|
|
2013-08-17 15:21:14 -04:00
|
|
|
// start audio thread and hook up slots & signals for shutdown management
|
2013-08-10 11:29:55 -04:00
|
|
|
|
2013-08-17 15:21:14 -04:00
|
|
|
// these objects need to be in the audio thread so that invoking
|
2013-08-10 11:29:55 -04:00
|
|
|
// their slots is done in a thread safe way
|
2013-08-17 15:21:14 -04:00
|
|
|
m_soundOutput.moveToThread (&m_audioThread);
|
|
|
|
m_modulator.moveToThread (&m_audioThread);
|
|
|
|
m_soundInput.moveToThread (&m_audioThread);
|
|
|
|
m_detector.moveToThread (&m_audioThread);
|
2013-08-10 11:29:55 -04:00
|
|
|
|
2013-08-17 15:21:14 -04:00
|
|
|
connect (this, &MainWindow::finished, &m_audioThread, &QThread::quit); // quit thread event loop
|
|
|
|
connect (&m_audioThread, &QThread::finished, &m_audioThread, &QThread::deleteLater); // disposal
|
2013-08-07 19:09:13 -04:00
|
|
|
|
|
|
|
// hook up sound output stream slots & signals
|
2013-08-10 11:29:55 -04:00
|
|
|
connect (this, SIGNAL (startAudioOutputStream (QAudioDeviceInfo const&, unsigned)), &m_soundOutput, SLOT (startStream (QAudioDeviceInfo const&, unsigned)));
|
|
|
|
connect (this, SIGNAL (stopAudioOutputStream ()), &m_soundOutput, SLOT (stopStream ()));
|
2013-08-07 19:09:13 -04:00
|
|
|
connect (&m_soundOutput, &SoundOutput::error, this, &MainWindow::showSoundOutError);
|
|
|
|
// connect (&m_soundOutput, &SoundOutput::status, this, &MainWindow::showStatusMessage);
|
2013-08-10 11:29:55 -04:00
|
|
|
connect (this, SIGNAL (outAttenuationChanged (qreal)), &m_soundOutput, SLOT (setAttenuation (qreal)));
|
2013-08-07 19:09:13 -04:00
|
|
|
|
|
|
|
// hook up Modulator slots
|
2013-08-10 11:29:55 -04:00
|
|
|
connect (this, SIGNAL (muteAudioOutput (bool)), &m_modulator, SLOT (mute (bool)));
|
|
|
|
connect (this, SIGNAL(transmitFrequency (unsigned)), &m_modulator, SLOT (setFrequency (unsigned)));
|
|
|
|
connect (this, SIGNAL (endTransmitMessage ()), &m_modulator, SLOT (close ()));
|
|
|
|
connect (this, SIGNAL (tune (bool)), &m_modulator, SLOT (tune (bool)));
|
2013-08-17 15:21:14 -04:00
|
|
|
connect (this, SIGNAL (sendMessage (unsigned, double, unsigned, AudioDevice::Channel, bool, double))
|
|
|
|
, &m_modulator, SLOT (open (unsigned, double, unsigned, AudioDevice::Channel, bool, double)));
|
2013-08-07 19:09:13 -04:00
|
|
|
|
2013-08-17 15:21:14 -04:00
|
|
|
// hook up the audio input stream
|
|
|
|
connect (this, SIGNAL (startAudioInputStream (QAudioDeviceInfo const&, unsigned, int, QIODevice *))
|
|
|
|
, &m_soundInput, SLOT (start (QAudioDeviceInfo const&, unsigned, int, QIODevice *)));
|
|
|
|
connect (this, SIGNAL (stopAudioInputStream ()), &m_soundInput, SLOT (stop ()));
|
|
|
|
|
|
|
|
connect(&m_soundInput, SIGNAL (error (QString)), this, SLOT (showSoundInError (QString)));
|
|
|
|
// connect(&m_soundInput, SIGNAL(status(QString)), this, SLOT(showStatusMessage(QString)));
|
|
|
|
|
|
|
|
// hook up the detector
|
|
|
|
connect (this, SIGNAL (startDetector (AudioDevice::Channel)), &m_detector, SLOT (open (AudioDevice::Channel)));
|
|
|
|
connect (this, SIGNAL (detectorSetMonitoring (bool)), &m_detector, SLOT (setMonitoring (bool)));
|
|
|
|
connect (this, SIGNAL (detectorClose ()), &m_detector, SLOT (close ()));
|
|
|
|
|
|
|
|
connect(&m_detector, SIGNAL (framesWritten (qint64)), this, SLOT (dataSink (qint64)));
|
|
|
|
|
|
|
|
// start the audio thread
|
|
|
|
m_audioThread.start (QThread::HighPriority);
|
2013-08-07 19:09:13 -04:00
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
|
|
|
|
// setup the waterfall
|
|
|
|
connect(m_wideGraph.data (), SIGNAL(freezeDecode2(int)),this,
|
|
|
|
SLOT(freezeDecode(int)));
|
|
|
|
connect(m_wideGraph.data (), SIGNAL(f11f12(int)),this,
|
|
|
|
SLOT(bumpFqso(int)));
|
|
|
|
connect(m_wideGraph.data (), SIGNAL(setXIT2(int)),this,
|
|
|
|
SLOT(setXIT(int)));
|
|
|
|
// connect(m_wideGraph.data (), SIGNAL(dialFreqChanged(double)),this,
|
|
|
|
// SLOT(dialFreqChanged2(double)));
|
|
|
|
connect (this, &MainWindow::finished, m_wideGraph.data (), &WideGraph::close);
|
|
|
|
|
|
|
|
|
|
|
|
// setup the log QSO dialog
|
|
|
|
connect (m_logDlg.data (), SIGNAL (acceptQSO (bool)), this, SLOT (acceptQSO2 (bool)));
|
|
|
|
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
on_EraseButton_clicked();
|
|
|
|
|
|
|
|
QActionGroup* modeGroup = new QActionGroup(this);
|
2012-10-04 17:39:48 -04:00
|
|
|
ui->actionJT9_1->setActionGroup(modeGroup);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->actionJT65->setActionGroup(modeGroup);
|
|
|
|
ui->actionJT9_JT65->setActionGroup(modeGroup);
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
QActionGroup* saveGroup = new QActionGroup(this);
|
|
|
|
ui->actionNone->setActionGroup(saveGroup);
|
2012-10-30 12:49:24 -04:00
|
|
|
ui->actionSave_decoded->setActionGroup(saveGroup);
|
|
|
|
ui->actionSave_all->setActionGroup(saveGroup);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
QActionGroup* DepthGroup = new QActionGroup(this);
|
2012-10-31 14:33:56 -04:00
|
|
|
ui->actionQuickDecode->setActionGroup(DepthGroup);
|
|
|
|
ui->actionMediumDecode->setActionGroup(DepthGroup);
|
|
|
|
ui->actionDeepestDecode->setActionGroup(DepthGroup);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
QButtonGroup* txMsgButtonGroup = new QButtonGroup;
|
|
|
|
txMsgButtonGroup->addButton(ui->txrb1,1);
|
|
|
|
txMsgButtonGroup->addButton(ui->txrb2,2);
|
|
|
|
txMsgButtonGroup->addButton(ui->txrb3,3);
|
|
|
|
txMsgButtonGroup->addButton(ui->txrb4,4);
|
|
|
|
txMsgButtonGroup->addButton(ui->txrb5,5);
|
|
|
|
txMsgButtonGroup->addButton(ui->txrb6,6);
|
|
|
|
connect(txMsgButtonGroup,SIGNAL(buttonClicked(int)),SLOT(set_ntx(int)));
|
2013-04-03 20:09:25 -04:00
|
|
|
connect(ui->decodedTextBrowser2,SIGNAL(selectCallsign(bool,bool)),this,
|
2013-05-13 20:22:22 -04:00
|
|
|
SLOT(doubleClickOnCall(bool,bool)));
|
|
|
|
connect(ui->decodedTextBrowser,SIGNAL(selectCallsign(bool,bool)),this,
|
2013-04-03 20:09:25 -04:00
|
|
|
SLOT(doubleClickOnCall2(bool,bool)));
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-08-11 07:45:17 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
setWindowTitle(Program_Title_Version);
|
|
|
|
createStatusBar();
|
|
|
|
|
2012-11-20 15:39:41 -05:00
|
|
|
connect(&proc_jt9, SIGNAL(readyReadStandardOutput()),
|
|
|
|
this, SLOT(readFromStdout()));
|
|
|
|
|
|
|
|
connect(&proc_jt9, SIGNAL(error(QProcess::ProcessError)),
|
|
|
|
this, SLOT(jt9_error()));
|
|
|
|
|
|
|
|
connect(&proc_jt9, SIGNAL(readyReadStandardError()),
|
|
|
|
this, SLOT(readFromStderr()));
|
|
|
|
|
2013-03-24 13:40:14 -04:00
|
|
|
ui->bandComboBox->setEditable(true);
|
|
|
|
ui->bandComboBox->lineEdit()->setReadOnly(true);
|
|
|
|
ui->bandComboBox->lineEdit()->setAlignment(Qt::AlignCenter);
|
|
|
|
for(int i = 0; i < ui->bandComboBox->count(); i++)
|
|
|
|
ui->bandComboBox->setItemData(i, Qt::AlignCenter, Qt::TextAlignmentRole);
|
|
|
|
|
2013-03-18 18:47:24 -04:00
|
|
|
ui->tx5->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
connect(ui->tx5, SIGNAL(customContextMenuRequested(const QPoint&)),
|
|
|
|
this, SLOT(showMacros(const QPoint&)));
|
|
|
|
|
2013-04-07 21:50:49 -04:00
|
|
|
ui->freeTextMsg->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
connect(ui->freeTextMsg, SIGNAL(customContextMenuRequested(const QPoint&)),
|
|
|
|
this, SLOT(showMacros(const QPoint&)));
|
|
|
|
|
2013-07-24 15:07:57 -04:00
|
|
|
QFont font=ui->decodedTextBrowser->font();
|
|
|
|
font.setPointSize(fontSize2);
|
|
|
|
font.setWeight(fontWeight2);
|
|
|
|
ui->decodedTextBrowser->setFont(font);
|
|
|
|
ui->decodedTextBrowser2->setFont(font);
|
2013-08-08 23:17:04 -04:00
|
|
|
|
2013-08-06 13:22:33 -04:00
|
|
|
font=ui->readFreq->font();
|
|
|
|
font.setFamily("helvetica");
|
|
|
|
font.setPointSize(9);
|
|
|
|
font.setWeight(75);
|
|
|
|
ui->readFreq->setFont(font);
|
2013-07-24 15:07:57 -04:00
|
|
|
|
2013-08-07 19:09:13 -04:00
|
|
|
connect(&m_guiTimer, SIGNAL(timeout()), this, SLOT(guiUpdate()));
|
|
|
|
m_guiTimer.start(100); //Don't change the 100 ms!
|
|
|
|
|
2013-03-24 13:29:26 -04:00
|
|
|
ptt0Timer = new QTimer(this);
|
|
|
|
ptt0Timer->setSingleShot(true);
|
2013-08-10 11:29:55 -04:00
|
|
|
connect (ptt0Timer, SIGNAL (timeout ()), &m_modulator, SLOT (close ()));
|
2013-03-24 13:29:26 -04:00
|
|
|
connect(ptt0Timer, SIGNAL(timeout()), this, SLOT(stopTx2()));
|
|
|
|
ptt1Timer = new QTimer(this);
|
|
|
|
ptt1Timer->setSingleShot(true);
|
|
|
|
connect(ptt1Timer, SIGNAL(timeout()), this, SLOT(startTx2()));
|
2013-03-24 10:13:37 -04:00
|
|
|
|
2013-03-28 20:21:26 -04:00
|
|
|
logQSOTimer = new QTimer(this);
|
|
|
|
logQSOTimer->setSingleShot(true);
|
|
|
|
connect(logQSOTimer, SIGNAL(timeout()), this, SLOT(on_logQSOButton_clicked()));
|
|
|
|
|
2013-04-17 11:53:43 -04:00
|
|
|
tuneButtonTimer= new QTimer(this);
|
|
|
|
tuneButtonTimer->setSingleShot(true);
|
2013-08-10 11:29:55 -04:00
|
|
|
connect (tuneButtonTimer, SIGNAL (timeout ()), &m_modulator, SLOT (close ()));
|
2013-04-17 11:53:43 -04:00
|
|
|
connect(tuneButtonTimer, SIGNAL(timeout()), this,
|
|
|
|
SLOT(on_stopTxButton_clicked()));
|
|
|
|
|
2013-04-12 13:57:20 -04:00
|
|
|
killFileTimer = new QTimer(this);
|
|
|
|
killFileTimer->setSingleShot(true);
|
|
|
|
connect(killFileTimer, SIGNAL(timeout()), this, SLOT(killFile()));
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
m_auto=false;
|
|
|
|
m_waterfallAvg = 1;
|
|
|
|
m_txFirst=false;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT muteAudioOutput (false);
|
2013-07-31 20:49:58 -04:00
|
|
|
m_btxMute=false;
|
|
|
|
m_btxok=false;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_restart=false;
|
|
|
|
m_transmitting=false;
|
2012-11-28 10:09:50 -05:00
|
|
|
m_killAll=false;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_widebandDecode=false;
|
|
|
|
m_ntx=1;
|
2013-03-26 14:54:15 -04:00
|
|
|
m_myCall="";
|
2012-05-22 13:09:48 -04:00
|
|
|
m_myGrid="FN20qi";
|
|
|
|
m_appDir = QApplication::applicationDirPath();
|
2012-09-24 15:11:31 -04:00
|
|
|
m_saveDir="/users/joe/wsjtx/install/save";
|
2013-07-08 09:17:22 -04:00
|
|
|
m_rxFreq=1500;
|
2012-10-15 13:43:49 -04:00
|
|
|
m_txFreq=1500;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_setftx=0;
|
|
|
|
m_loopall=false;
|
|
|
|
m_startAnother=false;
|
2012-10-30 12:49:24 -04:00
|
|
|
m_saveDecoded=false;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_saveAll=false;
|
|
|
|
m_sec0=-1;
|
2013-07-08 09:17:22 -04:00
|
|
|
m_palette="Linrad";
|
2012-09-24 11:20:48 -04:00
|
|
|
m_RxLog=1; //Write Date and Time to RxLog
|
2012-05-22 13:09:48 -04:00
|
|
|
m_nutc0=9999;
|
2013-07-08 09:17:22 -04:00
|
|
|
m_mode="JT9";
|
2013-04-08 14:31:21 -04:00
|
|
|
m_rpt="-15";
|
2012-09-24 15:11:31 -04:00
|
|
|
m_TRperiod=60;
|
2012-11-01 15:54:40 -04:00
|
|
|
m_inGain=0;
|
|
|
|
m_dataAvailable=false;
|
2013-07-08 09:17:22 -04:00
|
|
|
g_iptt=0;
|
|
|
|
g_COMportOpen=0;
|
2013-03-24 21:24:47 -04:00
|
|
|
m_secID=0;
|
2013-03-26 12:23:40 -04:00
|
|
|
m_promptToLog=false;
|
2013-03-28 20:21:26 -04:00
|
|
|
m_blankLine=false;
|
2013-04-03 11:35:11 -04:00
|
|
|
m_insertBlank=false;
|
2013-07-31 07:29:42 -04:00
|
|
|
m_displayDXCCEntity=false;
|
2013-04-03 17:32:21 -04:00
|
|
|
m_clearCallGrid=false;
|
|
|
|
m_bMiles=false;
|
2013-04-03 20:09:25 -04:00
|
|
|
m_decodedText2=false;
|
2013-04-08 14:31:21 -04:00
|
|
|
m_freeText=false;
|
2013-04-11 12:51:57 -04:00
|
|
|
m_msErase=0;
|
|
|
|
m_sent73=false;
|
2013-04-11 16:59:17 -04:00
|
|
|
m_watchdogLimit=5;
|
2013-04-14 10:11:20 -04:00
|
|
|
m_tune=false;
|
2013-04-15 12:06:22 -04:00
|
|
|
m_repeatMsg=0;
|
2013-04-22 20:52:51 -04:00
|
|
|
m_bRigOpen=false;
|
2013-04-18 06:35:58 -04:00
|
|
|
m_secBandChanged=0;
|
2013-04-24 11:00:30 -04:00
|
|
|
m_bMultipleOK=false;
|
2013-04-30 14:54:11 -04:00
|
|
|
m_dontReadFreq=false;
|
2013-07-08 09:17:22 -04:00
|
|
|
m_lockTxFreq=false;
|
2013-05-03 20:12:27 -04:00
|
|
|
ui->readFreq->setEnabled(false);
|
2013-08-24 21:48:45 -04:00
|
|
|
m_QSOText.clear();
|
2013-07-08 09:17:22 -04:00
|
|
|
m_CATerror=false;
|
2012-10-31 14:33:56 -04:00
|
|
|
decodeBusy(false);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-07-16 17:16:57 -04:00
|
|
|
signalMeter = new SignalMeter(ui->meterFrame);
|
|
|
|
signalMeter->resize(50, 160);
|
|
|
|
|
2013-03-25 07:26:11 -04:00
|
|
|
ui->labAz->setStyleSheet("border: 0px;");
|
|
|
|
ui->labDist->setStyleSheet("border: 0px;");
|
2012-11-20 15:39:41 -05:00
|
|
|
|
2013-04-13 08:28:03 -04:00
|
|
|
mem_jt9 = shdmem;
|
2013-07-18 20:23:40 -04:00
|
|
|
// Multiple instances:
|
|
|
|
mykey_jt9 = thekey;
|
2013-03-25 15:13:49 -04:00
|
|
|
|
2013-08-17 14:55:31 -04:00
|
|
|
//Band Settings
|
|
|
|
readSettings(); //Restore user's setup params
|
|
|
|
|
2013-07-15 16:01:25 -04:00
|
|
|
#ifdef WIN32
|
|
|
|
if(!m_bMultipleOK) {
|
|
|
|
while(true) {
|
|
|
|
int iret=killbyname("jt9.exe");
|
2013-08-17 14:55:31 -04:00
|
|
|
qDebug() << m_bMultipleOK << iret;
|
2013-07-15 16:01:25 -04:00
|
|
|
if(iret == 603) break;
|
|
|
|
if(iret != 0) msgBox("KillByName return code: " +
|
|
|
|
QString::number(iret));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-07-23 06:28:22 -04:00
|
|
|
if(m_dFreq.length()<=1) { //Use the startup default frequencies and band descriptions
|
|
|
|
// default bands and JT65 frequencies
|
|
|
|
const double dFreq[]={0.13613,0.4742,1.838,3.576,5.357,7.076,10.138,14.076,
|
|
|
|
18.102,21.076,24.917,28.076,50.276,70.091,144.489,432.178};
|
|
|
|
const QStringList dBandDescription = QStringList() << "2200 m" << "630 m" << "160 m"
|
|
|
|
<< "80 m" << "60 m" << "40 m"
|
|
|
|
<< "30 m" << "20 m" << "17 m"
|
|
|
|
<< "15 m" << "12 m" << "10 m"
|
|
|
|
<< "6 m" << "4 m" << "2 m"
|
|
|
|
<< "other";
|
|
|
|
m_dFreq.clear();
|
|
|
|
m_antDescription.clear();
|
|
|
|
m_bandDescription.clear();
|
|
|
|
for(int i=0; i<16; i++) {
|
|
|
|
QString t;
|
|
|
|
t.sprintf("%f",dFreq[i]);
|
|
|
|
m_dFreq.append(t);
|
|
|
|
m_antDescription.append("");
|
|
|
|
m_bandDescription.append(dBandDescription[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->bandComboBox->clear();
|
|
|
|
ui->bandComboBox->addItems(m_bandDescription);
|
|
|
|
ui->bandComboBox->setCurrentIndex(m_band);
|
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
QFile lockFile(m_appDir + "/.lock"); //Create .lock so jt9 will wait
|
2012-11-20 15:39:41 -05:00
|
|
|
lockFile.open(QIODevice::ReadWrite);
|
2013-03-24 10:05:31 -04:00
|
|
|
//QFile quitFile(m_appDir + "/.lock");
|
|
|
|
//quitFile.remove();
|
2013-07-18 20:23:40 -04:00
|
|
|
|
|
|
|
// Multiple instances: make the Qstring key into command line arg
|
|
|
|
// Multiple instances: start "jt9 -s <thekey>"
|
|
|
|
QByteArray ba = mykey_jt9->toLocal8Bit();
|
|
|
|
const char *bc = ba.data();
|
2013-08-15 13:32:46 -04:00
|
|
|
// proc_jt9.start(QDir::toNativeSeparators('"' + m_appDir + '"' + "/jt9 -s " + bc));
|
|
|
|
QByteArray lda = m_appDir.toLocal8Bit();
|
|
|
|
const char *ldir = lda.data();
|
2013-08-17 08:49:28 -04:00
|
|
|
proc_jt9.start(QDir::toNativeSeparators('"' + m_appDir + "\"/jt9 -s " + bc + " \"" + ldir + '"'));
|
2012-11-20 15:39:41 -05:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
m_pbdecoding_style1="QPushButton{background-color: cyan; \
|
|
|
|
border-style: outset; border-width: 1px; border-radius: 5px; \
|
|
|
|
border-color: black; min-width: 5em; padding: 3px;}";
|
|
|
|
m_pbmonitor_style="QPushButton{background-color: #00ff00; \
|
|
|
|
border-style: outset; border-width: 1px; border-radius: 5px; \
|
|
|
|
border-color: black; min-width: 5em; padding: 3px;}";
|
|
|
|
m_pbAutoOn_style="QPushButton{background-color: red; \
|
|
|
|
border-style: outset; border-width: 1px; border-radius: 5px; \
|
|
|
|
border-color: black; min-width: 5em; padding: 3px;}";
|
2013-04-14 10:11:20 -04:00
|
|
|
m_pbTune_style="QPushButton{background-color: red; \
|
|
|
|
border-style: outset; border-width: 1px; border-radius: 5px; \
|
|
|
|
border-color: black; min-width: 5em; padding: 3px;}";
|
|
|
|
|
2013-04-08 14:31:21 -04:00
|
|
|
genStdMsgs(m_rpt);
|
2013-08-06 13:22:33 -04:00
|
|
|
m_ntx=6;
|
|
|
|
ui->txrb6->setChecked(true);
|
2013-07-10 09:57:13 -04:00
|
|
|
if(m_mode!="JT9" and m_mode!="JT65" and m_mode!="JT9+JT65") m_mode="JT9";
|
2012-07-02 16:52:56 -04:00
|
|
|
on_actionWide_Waterfall_triggered(); //###
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setRxFreq(m_rxFreq);
|
|
|
|
m_wideGraph->setTxFreq(m_txFreq);
|
|
|
|
m_wideGraph->setLockTxFreq(m_lockTxFreq);
|
|
|
|
m_wideGraph->setModeTx(m_mode);
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
2013-07-12 09:45:28 -04:00
|
|
|
dialFreqChanged2(m_dialFreq);
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
connect(m_wideGraph.data (), SIGNAL(setFreq3(int,int)),this,
|
2013-07-08 09:17:22 -04:00
|
|
|
SLOT(setFreq4(int,int)));
|
|
|
|
|
|
|
|
if(m_mode=="JT9") on_actionJT9_1_triggered();
|
|
|
|
if(m_mode=="JT65") on_actionJT65_triggered();
|
|
|
|
if(m_mode=="JT9+JT65") on_actionJT9_JT65_triggered();
|
2013-03-18 12:14:18 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
future1 = new QFuture<void>;
|
|
|
|
watcher1 = new QFutureWatcher<void>;
|
|
|
|
connect(watcher1, SIGNAL(finished()),this,SLOT(diskDat()));
|
|
|
|
|
|
|
|
future2 = new QFuture<void>;
|
|
|
|
watcher2 = new QFutureWatcher<void>;
|
|
|
|
connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished()));
|
|
|
|
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT startDetector (m_audioInputChannel);
|
|
|
|
Q_EMIT startAudioInputStream (m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
2013-08-10 11:29:55 -04:00
|
|
|
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT transmitFrequency (m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0));
|
|
|
|
Q_EMIT muteAudioOutput (false);
|
2012-11-24 11:18:49 -05:00
|
|
|
m_monitoring=!m_monitorStartOFF; // Start with Monitoring ON/OFF
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (m_monitoring);
|
2012-05-22 13:09:48 -04:00
|
|
|
m_diskData=false;
|
|
|
|
|
2013-03-12 10:53:53 -04:00
|
|
|
// Create "m_worked", a dictionary of all calls in wsjtx.log
|
|
|
|
QFile f("wsjtx.log");
|
2013-03-18 16:12:23 -04:00
|
|
|
f.open(QIODevice::ReadOnly | QIODevice::Text);
|
2012-05-22 13:09:48 -04:00
|
|
|
QTextStream in(&f);
|
|
|
|
QString line,t,callsign;
|
|
|
|
for(int i=0; i<99999; i++) {
|
|
|
|
line=in.readLine();
|
|
|
|
if(line.length()<=0) break;
|
|
|
|
t=line.mid(18,12);
|
|
|
|
callsign=t.mid(0,t.indexOf(","));
|
|
|
|
}
|
|
|
|
f.close();
|
|
|
|
|
2013-07-24 15:07:57 -04:00
|
|
|
ui->decodedTextLabel->setFont(ui->decodedTextBrowser->font());
|
|
|
|
ui->decodedTextLabel2->setFont(ui->decodedTextBrowser2->font());
|
2013-07-08 09:17:22 -04:00
|
|
|
t="UTC dB DT Freq Message";
|
2013-04-03 20:09:25 -04:00
|
|
|
ui->decodedTextLabel->setText(t);
|
2013-04-04 11:04:01 -04:00
|
|
|
ui->decodedTextLabel2->setText(t);
|
2013-03-24 10:05:31 -04:00
|
|
|
|
2013-07-23 06:28:22 -04:00
|
|
|
psk_Reporter->setLocalStation(m_myCall,m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
|
2013-04-16 16:15:25 -04:00
|
|
|
|
2013-08-16 06:25:28 -04:00
|
|
|
on_actionEnable_DXCC_entity_triggered(m_displayDXCCEntity); // sets text window proportions and (re)inits the logbook
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2013-04-16 12:36:13 -04:00
|
|
|
ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}");
|
|
|
|
ui->label_10->setStyleSheet("QLabel{background-color: #aabec8}");
|
2013-04-24 13:55:33 -04:00
|
|
|
ui->labUTC->setStyleSheet( \
|
|
|
|
"QLabel { background-color : black; color : yellow; }");
|
|
|
|
ui->labDialFreq->setStyleSheet( \
|
|
|
|
"QLabel { background-color : black; color : yellow; }");
|
2013-04-27 09:11:29 -04:00
|
|
|
|
|
|
|
QFile f2("ALL.TXT");
|
|
|
|
f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
|
|
|
QTextStream out(&f2);
|
|
|
|
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
2013-04-27 09:29:46 -04:00
|
|
|
<< " " << m_dialFreq << " MHz " << m_mode << endl;
|
2013-04-27 09:11:29 -04:00
|
|
|
f2.close();
|
2012-07-18 09:35:54 -04:00
|
|
|
} // End of MainWindow constructor
|
|
|
|
|
|
|
|
//--------------------------------------------------- MainWindow destructor
|
2012-05-22 13:09:48 -04:00
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
2012-11-20 15:39:41 -05:00
|
|
|
if(!m_decoderBusy) {
|
|
|
|
QFile lockFile(m_appDir + "/.lock");
|
|
|
|
lockFile.remove();
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------- writeSettings()
|
|
|
|
void MainWindow::writeSettings()
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings->beginGroup("MainWindow");
|
|
|
|
m_settings->setValue ("geometry", saveGeometry ());
|
|
|
|
m_settings->setValue ("state", saveState ());
|
|
|
|
m_settings->setValue("MRUdir", m_path);
|
|
|
|
m_settings->setValue("TxFirst",m_txFirst);
|
|
|
|
m_settings->setValue("DXcall",ui->dxCallEntry->text());
|
|
|
|
m_settings->setValue("DXgrid",ui->dxGridEntry->text());
|
|
|
|
m_settings->endGroup();
|
|
|
|
|
|
|
|
m_settings->beginGroup("Common");
|
|
|
|
m_settings->setValue("MyCall",m_myCall);
|
|
|
|
m_settings->setValue("MyGrid",m_myGrid);
|
|
|
|
m_settings->setValue("IDint",m_idInt);
|
|
|
|
m_settings->setValue("PTTmethod",m_pttMethodIndex);
|
|
|
|
m_settings->setValue("PTTport",m_pttPort);
|
|
|
|
m_settings->setValue("SaveDir",m_saveDir);
|
|
|
|
m_settings->setValue("SoundInName", m_audioInputDevice.deviceName ());
|
|
|
|
m_settings->setValue("SoundOutName", m_audioOutputDevice.deviceName ());
|
|
|
|
|
|
|
|
m_settings->setValue ("AudioInputChannel", AudioDevice::toString (m_audioInputChannel));
|
|
|
|
m_settings->setValue ("AudioOutputChannel", AudioDevice::toString (m_audioOutputChannel));
|
|
|
|
m_settings->setValue("Mode",m_mode);
|
|
|
|
m_settings->setValue("ModeTx",m_modeTx);
|
|
|
|
m_settings->setValue("SaveNone",ui->actionNone->isChecked());
|
|
|
|
m_settings->setValue("SaveDecoded",ui->actionSave_decoded->isChecked());
|
|
|
|
m_settings->setValue("SaveAll",ui->actionSave_all->isChecked());
|
|
|
|
m_settings->setValue("NDepth",m_ndepth);
|
|
|
|
m_settings->setValue("MonitorOFF",m_monitorStartOFF);
|
|
|
|
m_settings->setValue("DialFreq",m_dialFreq);
|
|
|
|
m_settings->setValue("RxFreq",m_rxFreq);
|
|
|
|
m_settings->setValue("TxFreq",m_txFreq);
|
|
|
|
m_settings->setValue("InGain",m_inGain);
|
|
|
|
m_settings->setValue("OutAttenuation", ui->outAttenuation->value ());
|
|
|
|
m_settings->setValue("PSKReporter",m_pskReporter);
|
|
|
|
m_settings->setValue("After73",m_After73);
|
|
|
|
m_settings->setValue("Macros",m_macro);
|
2013-07-23 06:28:22 -04:00
|
|
|
//Band Settings
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings->setValue("BandFrequencies",m_dFreq);
|
|
|
|
m_settings->setValue("BandDescriptions",m_bandDescription);
|
|
|
|
m_settings->setValue("AntennaDescriptions",m_antDescription);
|
|
|
|
m_settings->setValue("toRTTY",m_toRTTY);
|
|
|
|
m_settings->setValue("NoSuffix",m_noSuffix);
|
|
|
|
m_settings->setValue("dBtoComments",m_dBtoComments);
|
|
|
|
m_settings->setValue("catEnabled",m_catEnabled);
|
|
|
|
m_settings->setValue("Rig",m_rig);
|
|
|
|
m_settings->setValue("RigIndex",m_rigIndex);
|
|
|
|
m_settings->setValue("CATport",m_catPort);
|
|
|
|
m_settings->setValue("CATportIndex",m_catPortIndex);
|
|
|
|
m_settings->setValue("SerialRate",m_serialRate);
|
|
|
|
m_settings->setValue("SerialRateIndex",m_serialRateIndex);
|
|
|
|
m_settings->setValue("DataBits",m_dataBits);
|
|
|
|
m_settings->setValue("DataBitsIndex",m_dataBitsIndex);
|
|
|
|
m_settings->setValue("StopBits",m_stopBits);
|
|
|
|
m_settings->setValue("StopBitsIndex",m_stopBitsIndex);
|
|
|
|
m_settings->setValue("Handshake",m_handshake);
|
|
|
|
m_settings->setValue("HandshakeIndex",m_handshakeIndex);
|
|
|
|
m_settings->setValue("BandIndex",m_band);
|
|
|
|
m_settings->setValue("PromptToLog",m_promptToLog);
|
|
|
|
m_settings->setValue("InsertBlank",m_insertBlank);
|
|
|
|
m_settings->setValue("DXCCEntity",m_displayDXCCEntity);
|
|
|
|
m_settings->setValue("ClearCallGrid",m_clearCallGrid);
|
|
|
|
m_settings->setValue("Miles",m_bMiles);
|
|
|
|
m_settings->setValue("GUItab",ui->tabWidget->currentIndex());
|
|
|
|
m_settings->setValue("QuickCall",m_quickCall);
|
|
|
|
m_settings->setValue("73TxDisable",m_73TxDisable);
|
|
|
|
m_settings->setValue("Runaway",m_runaway);
|
|
|
|
m_settings->setValue("Tx2QSO",m_tx2QSO);
|
|
|
|
m_settings->setValue("MultipleOK",m_bMultipleOK);
|
|
|
|
m_settings->setValue("DTR",m_bDTR);
|
|
|
|
m_settings->setValue("RTS",m_bRTS); m_settings->setValue("pttData",m_pttData);
|
|
|
|
m_settings->setValue("Polling",m_poll);
|
|
|
|
m_settings->setValue("OutBufSize",outBufSize);
|
|
|
|
m_settings->setValue("LockTxFreq",m_lockTxFreq);
|
|
|
|
m_settings->setValue("TxSplit",m_bSplit);
|
|
|
|
m_settings->setValue("UseXIT",m_bXIT);
|
|
|
|
m_settings->setValue("XIT",m_XIT);
|
|
|
|
m_settings->setValue("Plus2kHz",m_plus2kHz);
|
|
|
|
m_settings->endGroup();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------- readSettings()
|
|
|
|
void MainWindow::readSettings()
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings->beginGroup("MainWindow");
|
|
|
|
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
|
|
|
restoreState (m_settings->value ("state", saveState ()).toByteArray ());
|
|
|
|
ui->dxCallEntry->setText(m_settings->value("DXcall","").toString());
|
|
|
|
ui->dxGridEntry->setText(m_settings->value("DXgrid","").toString());
|
|
|
|
m_path = m_settings->value("MRUdir", m_appDir + "/save").toString();
|
|
|
|
m_txFirst = m_settings->value("TxFirst",false).toBool();
|
2012-05-22 13:09:48 -04:00
|
|
|
ui->txFirstCheckBox->setChecked(m_txFirst);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings->endGroup();
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings->beginGroup("Common");
|
|
|
|
m_myCall=m_settings->value("MyCall","").toString();
|
2013-05-23 15:35:37 -04:00
|
|
|
morse_(m_myCall.toLatin1().data(),icw,&m_ncw,m_myCall.length());
|
2013-08-10 11:29:55 -04:00
|
|
|
m_myGrid=m_settings->value("MyGrid","").toString();
|
|
|
|
m_idInt=m_settings->value("IDint",0).toInt();
|
|
|
|
m_pttMethodIndex=m_settings->value("PTTmethod",1).toInt();
|
|
|
|
m_pttPort=m_settings->value("PTTport",0).toInt();
|
|
|
|
m_saveDir=m_settings->value("SaveDir",m_appDir + "/save").toString();
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-08-05 09:57:55 -04:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// retrieve audio input device
|
|
|
|
//
|
2013-08-10 11:29:55 -04:00
|
|
|
QString savedName = m_settings->value( "SoundInName").toString();
|
2013-08-05 09:57:55 -04:00
|
|
|
QList<QAudioDeviceInfo> audioInputDevices (QAudioDeviceInfo::availableDevices (QAudio::AudioInput)); // available audio input devices
|
|
|
|
for (QList<QAudioDeviceInfo>::const_iterator p = audioInputDevices.begin (); p != audioInputDevices.end (); ++p)
|
|
|
|
{
|
|
|
|
if (p->deviceName () == savedName)
|
|
|
|
{
|
|
|
|
m_audioInputDevice = *p;
|
|
|
|
}
|
|
|
|
}
|
2013-06-05 17:28:31 -04:00
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-08-05 09:57:55 -04:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// retrieve audio output device
|
|
|
|
//
|
2013-08-10 11:29:55 -04:00
|
|
|
QString savedName = m_settings->value("SoundOutName").toString();
|
2013-08-05 09:57:55 -04:00
|
|
|
QList<QAudioDeviceInfo> audioOutputDevices (QAudioDeviceInfo::availableDevices (QAudio::AudioOutput)); // available audio output devices
|
|
|
|
for (QList<QAudioDeviceInfo>::const_iterator p = audioOutputDevices.begin (); p != audioOutputDevices.end (); ++p)
|
2013-08-07 10:49:45 -04:00
|
|
|
{
|
|
|
|
if (p->deviceName () == savedName) {
|
|
|
|
m_audioOutputDevice = *p;
|
2013-08-05 09:57:55 -04:00
|
|
|
}
|
2013-08-07 10:49:45 -04:00
|
|
|
}
|
2013-06-05 17:28:31 -04:00
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
// retrieve audio channel info
|
|
|
|
m_audioInputChannel = AudioDevice::fromString (m_settings->value ("AudioInputChannel", "Mono").toString ());
|
|
|
|
m_audioOutputChannel = AudioDevice::fromString (m_settings->value ("AudioOutputChannel", "Mono").toString ());
|
|
|
|
|
|
|
|
m_mode=m_settings->value("Mode","JT9").toString();
|
|
|
|
m_modeTx=m_settings->value("ModeTx","JT9").toString();
|
2013-07-08 15:57:01 -04:00
|
|
|
if(m_modeTx=="JT9") ui->pbTxMode->setText("Tx JT9 @");
|
|
|
|
if(m_modeTx=="JT65") ui->pbTxMode->setText("Tx JT65 #");
|
2013-08-10 11:29:55 -04:00
|
|
|
ui->actionNone->setChecked(m_settings->value("SaveNone",true).toBool());
|
|
|
|
ui->actionSave_decoded->setChecked(m_settings->value(
|
2012-10-30 12:49:24 -04:00
|
|
|
"SaveDecoded",false).toBool());
|
2013-08-10 11:29:55 -04:00
|
|
|
ui->actionSave_all->setChecked(m_settings->value("SaveAll",false).toBool());
|
|
|
|
m_dialFreq=m_settings->value("DialFreq",14.078).toDouble();
|
|
|
|
m_rxFreq=m_settings->value("RxFreq",1500).toInt();
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->RxFreqSpinBox->setValue(m_rxFreq);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_txFreq=m_settings->value("TxFreq",1500).toInt();
|
2012-10-05 15:14:45 -04:00
|
|
|
ui->TxFreqSpinBox->setValue(m_txFreq);
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT transmitFrequency (m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0));
|
2012-10-30 12:49:24 -04:00
|
|
|
m_saveDecoded=ui->actionSave_decoded->isChecked();
|
2012-05-22 13:09:48 -04:00
|
|
|
m_saveAll=ui->actionSave_all->isChecked();
|
2013-08-10 11:29:55 -04:00
|
|
|
m_ndepth=m_settings->value("NDepth",3).toInt();
|
|
|
|
m_inGain=m_settings->value("InGain",0).toInt();
|
2012-11-01 15:54:40 -04:00
|
|
|
ui->inGain->setValue(m_inGain);
|
2013-08-10 11:29:55 -04:00
|
|
|
|
|
|
|
// setup initial value of tx attenuator
|
|
|
|
ui->outAttenuation->setValue (m_settings->value ("OutAttenuation", 0).toInt ());
|
|
|
|
on_outAttenuation_valueChanged (ui->outAttenuation->value ());
|
|
|
|
|
|
|
|
m_monitorStartOFF=m_settings->value("MonitorOFF",false).toBool();
|
2012-11-24 11:18:49 -05:00
|
|
|
ui->actionMonitor_OFF_at_startup->setChecked(m_monitorStartOFF);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_pskReporter=m_settings->value("PSKReporter",false).toBool();
|
|
|
|
m_After73=m_settings->value("After73",false).toBool();
|
|
|
|
m_macro=m_settings->value("Macros","TNX 73 GL").toStringList();
|
2013-07-23 06:28:22 -04:00
|
|
|
//Band Settings
|
2013-08-10 11:29:55 -04:00
|
|
|
m_dFreq=m_settings->value("BandFrequencies","").toStringList();
|
|
|
|
m_bandDescription=m_settings->value("BandDescriptions","").toStringList();
|
|
|
|
m_antDescription=m_settings->value("AntennaDescriptions","").toStringList();
|
|
|
|
m_toRTTY=m_settings->value("toRTTY",false).toBool();
|
2013-03-23 14:24:27 -04:00
|
|
|
ui->actionConvert_JT9_x_to_RTTY->setChecked(m_toRTTY);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_noSuffix=m_settings->value("NoSuffix",false).toBool();
|
|
|
|
m_dBtoComments=m_settings->value("dBtoComments",false).toBool();
|
2013-03-23 14:24:27 -04:00
|
|
|
ui->actionLog_dB_reports_to_Comments->setChecked(m_dBtoComments);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_rig=m_settings->value("Rig",214).toInt();
|
|
|
|
m_rigIndex=m_settings->value("RigIndex",100).toInt();
|
|
|
|
m_catPort=m_settings->value("CATport","None").toString();
|
|
|
|
m_catPortIndex=m_settings->value("CATportIndex",0).toInt();
|
|
|
|
m_serialRate=m_settings->value("SerialRate",4800).toInt();
|
|
|
|
m_serialRateIndex=m_settings->value("SerialRateIndex",1).toInt();
|
|
|
|
m_dataBits=m_settings->value("DataBits",8).toInt();
|
|
|
|
m_dataBitsIndex=m_settings->value("DataBitsIndex",1).toInt();
|
|
|
|
m_stopBits=m_settings->value("StopBits",2).toInt();
|
|
|
|
m_stopBitsIndex=m_settings->value("StopBitsIndex",1).toInt();
|
|
|
|
m_handshake=m_settings->value("Handshake","None").toString();
|
|
|
|
m_handshakeIndex=m_settings->value("HandshakeIndex",0).toInt();
|
|
|
|
m_band=m_settings->value("BandIndex",7).toInt();
|
2013-03-24 21:39:20 -04:00
|
|
|
ui->bandComboBox->setCurrentIndex(m_band);
|
2013-04-25 10:41:06 -04:00
|
|
|
dialFreqChanged2(m_dialFreq);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_catEnabled=m_settings->value("catEnabled",false).toBool();
|
|
|
|
m_promptToLog=m_settings->value("PromptToLog",false).toBool();
|
2013-03-26 12:23:40 -04:00
|
|
|
ui->actionPrompt_to_log_QSO->setChecked(m_promptToLog);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_insertBlank=m_settings->value("InsertBlank",false).toBool();
|
2013-04-03 11:35:11 -04:00
|
|
|
ui->actionBlank_line_between_decoding_periods->setChecked(m_insertBlank);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_displayDXCCEntity=m_settings->value("DXCCEntity",false).toBool();
|
2013-07-31 07:29:42 -04:00
|
|
|
ui->actionEnable_DXCC_entity->setChecked(m_displayDXCCEntity);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_clearCallGrid=m_settings->value("ClearCallGrid",false).toBool();
|
2013-04-03 17:32:21 -04:00
|
|
|
ui->actionClear_DX_Call_and_Grid_after_logging->setChecked(m_clearCallGrid);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_bMiles=m_settings->value("Miles",false).toBool();
|
2013-04-03 17:32:21 -04:00
|
|
|
ui->actionDisplay_distance_in_miles->setChecked(m_bMiles);
|
2013-08-10 11:29:55 -04:00
|
|
|
int n=m_settings->value("GUItab",0).toInt();
|
2013-04-08 14:31:21 -04:00
|
|
|
ui->tabWidget->setCurrentIndex(n);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_quickCall=m_settings->value("QuickCall",false).toBool();
|
2013-04-08 14:31:21 -04:00
|
|
|
ui->actionDouble_click_on_call_sets_Tx_Enable->setChecked(m_quickCall);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_73TxDisable=m_settings->value("73TxDisable",false).toBool();
|
2013-04-11 12:51:57 -04:00
|
|
|
ui->action_73TxDisable->setChecked(m_73TxDisable);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_runaway=m_settings->value("Runaway",false).toBool();
|
2013-04-11 12:51:57 -04:00
|
|
|
ui->actionRunaway_Tx_watchdog->setChecked(m_runaway);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_tx2QSO=m_settings->value("Tx2QSO",false).toBool();
|
2013-04-12 13:57:20 -04:00
|
|
|
ui->actionTx2QSO->setChecked(m_tx2QSO);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_bMultipleOK=m_settings->value("MultipleOK",false).toBool();
|
2013-04-24 11:00:30 -04:00
|
|
|
ui->actionAllow_multiple_instances->setChecked(m_bMultipleOK);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_bDTR=m_settings->value("DTR",false).toBool();
|
|
|
|
m_bRTS=m_settings->value("RTS",false).toBool(); m_pttData=m_settings->value("pttData",false).toBool();
|
|
|
|
m_poll=m_settings->value("Polling",0).toInt();
|
|
|
|
outBufSize=m_settings->value("OutBufSize",4096).toInt();
|
|
|
|
m_lockTxFreq=m_settings->value("LockTxFreq",false).toBool();
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->cbTxLock->setChecked(m_lockTxFreq);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_bSplit=m_settings->value("TxSplit",false).toBool();
|
|
|
|
m_bXIT=m_settings->value("UseXIT",false).toBool();
|
|
|
|
m_XIT=m_settings->value("XIT",0).toInt();
|
|
|
|
m_plus2kHz=m_settings->value("Plus2kHz",false).toBool();
|
2013-07-31 16:18:52 -04:00
|
|
|
ui->cbPlus2kHz->setChecked(m_plus2kHz);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_settings->endGroup();
|
2013-04-11 12:51:57 -04:00
|
|
|
|
2012-10-31 14:33:56 -04:00
|
|
|
if(m_ndepth==1) ui->actionQuickDecode->setChecked(true);
|
|
|
|
if(m_ndepth==2) ui->actionMediumDecode->setChecked(true);
|
|
|
|
if(m_ndepth==3) ui->actionDeepestDecode->setChecked(true);
|
2013-04-23 15:16:50 -04:00
|
|
|
|
2013-03-18 09:24:50 -04:00
|
|
|
statusChanged();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------- dataSink()
|
2013-08-10 11:29:55 -04:00
|
|
|
void MainWindow::dataSink(qint64 frames)
|
2012-05-22 13:09:48 -04:00
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
static float s[NSMAX];
|
2012-09-25 16:26:12 -04:00
|
|
|
static int ihsym=0;
|
|
|
|
static int nzap=0;
|
2012-10-03 11:22:49 -04:00
|
|
|
static int trmin;
|
2012-10-16 19:32:15 -04:00
|
|
|
static int npts8;
|
2012-09-25 20:48:49 -04:00
|
|
|
static float px=0.0;
|
2012-10-03 11:22:49 -04:00
|
|
|
static float df3;
|
2013-07-08 09:17:22 -04:00
|
|
|
static float slope;
|
2012-09-25 16:26:12 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
if(m_diskData) {
|
2012-10-03 11:42:13 -04:00
|
|
|
jt9com_.ndiskdat=1;
|
2012-05-22 13:09:48 -04:00
|
|
|
} else {
|
2012-10-03 11:42:13 -04:00
|
|
|
jt9com_.ndiskdat=0;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2012-10-21 15:35:10 -04:00
|
|
|
|
|
|
|
// Get power, spectrum, and ihsym
|
2012-10-03 11:22:49 -04:00
|
|
|
trmin=m_TRperiod/60;
|
2013-07-08 09:17:22 -04:00
|
|
|
slope=0.0;
|
2013-08-10 11:29:55 -04:00
|
|
|
slope=(float)m_wideGraph->getSlope();
|
|
|
|
int k (frames - 1);
|
2013-07-08 09:17:22 -04:00
|
|
|
symspec_(&k,&trmin,&m_nsps,&m_inGain,&slope,&px,s,&df3,&ihsym,&npts8);
|
2012-09-25 20:48:49 -04:00
|
|
|
if(ihsym <=0) return;
|
2012-09-25 16:26:12 -04:00
|
|
|
QString t;
|
2012-11-12 11:33:45 -05:00
|
|
|
m_pctZap=nzap*100.0/m_nsps;
|
2013-05-07 14:19:15 -04:00
|
|
|
t.sprintf(" Rx noise: %5.1f ",px);
|
2013-07-16 17:16:57 -04:00
|
|
|
signalMeter->setValue(px); // Update thermometer
|
2012-09-25 16:26:12 -04:00
|
|
|
if(m_monitoring || m_diskData) {
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->dataSink2(s,df3,ihsym,m_diskData);
|
2012-07-12 17:22:55 -04:00
|
|
|
}
|
|
|
|
|
2012-11-12 16:06:31 -05:00
|
|
|
if(ihsym == m_hsymStop) {
|
2012-11-01 15:54:40 -04:00
|
|
|
m_dataAvailable=true;
|
2012-10-19 15:26:07 -04:00
|
|
|
jt9com_.npts8=(ihsym*m_nsps)/16;
|
2012-10-26 12:52:04 -04:00
|
|
|
jt9com_.newdat=1;
|
2012-11-24 09:36:45 -05:00
|
|
|
jt9com_.nagain=0;
|
2012-11-19 13:23:39 -05:00
|
|
|
jt9com_.nzhsym=m_hsymStop;
|
2012-09-25 16:26:12 -04:00
|
|
|
QDateTime t = QDateTime::currentDateTimeUtc();
|
|
|
|
m_dateTime=t.toString("yyyy-MMM-dd hh:mm");
|
2012-11-24 09:36:45 -05:00
|
|
|
decode(); //Start decoder
|
|
|
|
if(!m_diskData) { //Always save; may delete later
|
2012-10-26 12:01:57 -04:00
|
|
|
int ihr=t.time().toString("hh").toInt();
|
|
|
|
int imin=t.time().toString("mm").toInt();
|
|
|
|
imin=imin - (imin%(m_TRperiod/60));
|
2012-10-27 09:22:47 -04:00
|
|
|
QString t2;
|
|
|
|
t2.sprintf("%2.2d%2.2d",ihr,imin);
|
2012-11-24 09:36:45 -05:00
|
|
|
m_fname=m_saveDir + "/" + t.date().toString("yyMMdd") + "_" +
|
2012-10-26 12:01:57 -04:00
|
|
|
t2 + ".wav";
|
2012-11-24 09:36:45 -05:00
|
|
|
*future2 = QtConcurrent::run(savewav, m_fname, m_TRperiod);
|
2012-05-22 13:09:48 -04:00
|
|
|
watcher2->setFuture(*future2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::showSoundInError(const QString& errorMsg)
|
2013-08-05 09:57:55 -04:00
|
|
|
{QMessageBox::critical(this, tr("Error in SoundInput"), errorMsg);}
|
|
|
|
|
|
|
|
void MainWindow::showSoundOutError(const QString& errorMsg)
|
|
|
|
{QMessageBox::critical(this, tr("Error in SoundOutput"), errorMsg);}
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
void MainWindow::showStatusMessage(const QString& statusMsg)
|
|
|
|
{statusBar()->showMessage(statusMsg);}
|
|
|
|
|
|
|
|
void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
|
|
|
{
|
|
|
|
DevSetup dlg(this);
|
|
|
|
dlg.m_myCall=m_myCall;
|
|
|
|
dlg.m_myGrid=m_myGrid;
|
|
|
|
dlg.m_idInt=m_idInt;
|
2013-03-24 08:55:13 -04:00
|
|
|
dlg.m_pttMethodIndex=m_pttMethodIndex;
|
2012-05-22 13:09:48 -04:00
|
|
|
dlg.m_pttPort=m_pttPort;
|
|
|
|
dlg.m_saveDir=m_saveDir;
|
2013-08-05 09:57:55 -04:00
|
|
|
dlg.m_audioInputDevice = m_audioInputDevice;
|
|
|
|
dlg.m_audioOutputDevice = m_audioOutputDevice;
|
2013-08-10 11:29:55 -04:00
|
|
|
dlg.m_audioInputChannel = m_audioInputChannel;
|
|
|
|
dlg.m_audioOutputChannel = m_audioOutputChannel;
|
2013-03-09 21:45:12 -05:00
|
|
|
dlg.m_pskReporter=m_pskReporter;
|
2013-03-24 21:24:47 -04:00
|
|
|
dlg.m_After73=m_After73;
|
2013-03-21 18:58:16 -04:00
|
|
|
dlg.m_macro=m_macro;
|
2013-03-25 15:13:49 -04:00
|
|
|
dlg.m_dFreq=m_dFreq;
|
2013-07-23 06:28:22 -04:00
|
|
|
dlg.m_antDescription=m_antDescription;
|
|
|
|
dlg.m_bandDescription=m_bandDescription;
|
2013-03-24 08:55:13 -04:00
|
|
|
dlg.m_catEnabled=m_catEnabled;
|
|
|
|
dlg.m_rig=m_rig;
|
|
|
|
dlg.m_rigIndex=m_rigIndex;
|
|
|
|
dlg.m_catPort=m_catPort;
|
|
|
|
dlg.m_catPortIndex=m_catPortIndex;
|
|
|
|
dlg.m_serialRate=m_serialRate;
|
|
|
|
dlg.m_serialRateIndex=m_serialRateIndex;
|
|
|
|
dlg.m_dataBits=m_dataBits;
|
|
|
|
dlg.m_dataBitsIndex=m_dataBitsIndex;
|
|
|
|
dlg.m_stopBits=m_stopBits;
|
|
|
|
dlg.m_stopBitsIndex=m_stopBitsIndex;
|
|
|
|
dlg.m_handshake=m_handshake;
|
|
|
|
dlg.m_handshakeIndex=m_handshakeIndex;
|
2013-07-23 13:32:59 -04:00
|
|
|
dlg.m_bDTR=m_bDTR;
|
|
|
|
dlg.m_bRTS=m_bRTS; dlg.m_pttData=m_pttData;
|
2013-04-30 10:34:45 -04:00
|
|
|
dlg.m_poll=m_poll;
|
2013-07-08 09:17:22 -04:00
|
|
|
dlg.m_bSplit=m_bSplit;
|
|
|
|
dlg.m_bXIT=m_bXIT;
|
2013-04-05 12:48:10 -04:00
|
|
|
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_bRigOpen) {
|
|
|
|
rig->close();
|
2013-05-03 20:12:27 -04:00
|
|
|
ui->readFreq->setStyleSheet("");
|
|
|
|
ui->readFreq->setEnabled(false);
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_rig<9900) delete rig;
|
2013-04-23 16:46:04 -04:00
|
|
|
m_bRigOpen=false;
|
|
|
|
m_catEnabled=false;
|
2013-07-08 09:17:22 -04:00
|
|
|
m_CATerror=false;
|
2013-04-23 16:46:04 -04:00
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
dlg.initDlg();
|
|
|
|
if(dlg.exec() == QDialog::Accepted) {
|
|
|
|
m_myCall=dlg.m_myCall;
|
|
|
|
m_myGrid=dlg.m_myGrid;
|
|
|
|
m_idInt=dlg.m_idInt;
|
2013-03-24 08:55:13 -04:00
|
|
|
m_pttMethodIndex=dlg.m_pttMethodIndex;
|
2012-07-04 10:40:11 -04:00
|
|
|
m_pttPort=dlg.m_pttPort;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_saveDir=dlg.m_saveDir;
|
2013-08-05 09:57:55 -04:00
|
|
|
m_audioInputDevice = dlg.m_audioInputDevice;
|
|
|
|
m_audioOutputDevice = dlg.m_audioOutputDevice;
|
2013-08-10 11:29:55 -04:00
|
|
|
m_audioInputChannel = dlg.m_audioInputChannel;
|
|
|
|
m_audioOutputChannel = dlg.m_audioOutputChannel;
|
2013-03-21 18:58:16 -04:00
|
|
|
m_macro=dlg.m_macro;
|
2013-03-25 15:13:49 -04:00
|
|
|
m_dFreq=dlg.m_dFreq;
|
2013-07-23 06:28:22 -04:00
|
|
|
m_antDescription=dlg.m_antDescription;
|
|
|
|
m_bandDescription=dlg.m_bandDescription;
|
2013-03-24 08:55:13 -04:00
|
|
|
m_catEnabled=dlg.m_catEnabled;
|
|
|
|
m_rig=dlg.m_rig;
|
|
|
|
m_rigIndex=dlg.m_rigIndex;
|
|
|
|
m_catPort=dlg.m_catPort;
|
|
|
|
m_catPortIndex=dlg.m_catPortIndex;
|
|
|
|
m_serialRate=dlg.m_serialRate;
|
|
|
|
m_serialRateIndex=dlg.m_serialRateIndex;
|
|
|
|
m_dataBits=dlg.m_dataBits;
|
|
|
|
m_dataBitsIndex=dlg.m_dataBitsIndex;
|
|
|
|
m_stopBits=dlg.m_stopBits;
|
|
|
|
m_stopBitsIndex=dlg.m_stopBitsIndex;
|
|
|
|
m_handshake=dlg.m_handshake;
|
|
|
|
m_handshakeIndex=dlg.m_handshakeIndex;
|
2013-07-23 13:32:59 -04:00
|
|
|
m_bDTR=dlg.m_bDTR;
|
|
|
|
m_bRTS=dlg.m_bRTS;
|
2013-04-25 18:57:08 -04:00
|
|
|
m_pttData=dlg.m_pttData;
|
2013-04-30 10:34:45 -04:00
|
|
|
m_poll=dlg.m_poll;
|
2013-03-21 18:58:16 -04:00
|
|
|
|
2013-07-23 06:28:22 -04:00
|
|
|
//Band Settings
|
|
|
|
ui->bandComboBox->clear();
|
|
|
|
ui->bandComboBox->addItems(dlg.m_bandDescription);
|
|
|
|
ui->bandComboBox->setCurrentIndex(m_band);
|
2013-07-08 09:17:22 -04:00
|
|
|
m_pskReporter=dlg.m_pskReporter;
|
2013-04-16 16:15:25 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_pskReporter) {
|
2013-07-23 06:28:22 -04:00
|
|
|
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
2013-04-16 16:15:25 -04:00
|
|
|
|
2013-03-24 21:24:47 -04:00
|
|
|
m_After73=dlg.m_After73;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
if(dlg.m_restartSoundIn) {
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT stopAudioInputStream ();
|
|
|
|
Q_EMIT detectorClose ();
|
|
|
|
Q_EMIT startDetector (m_audioInputChannel);
|
|
|
|
Q_EMIT startAudioInputStream (m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(dlg.m_restartSoundOut) {
|
2013-08-10 21:30:05 -04:00
|
|
|
Q_EMIT stopAudioOutputStream ();
|
|
|
|
Q_EMIT startAudioOutputStream (m_audioOutputDevice, AudioDevice::Mono == m_audioOutputChannel ? 1 : 2);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
2013-04-23 16:46:04 -04:00
|
|
|
m_catEnabled=dlg.m_catEnabled;
|
2013-05-21 15:49:41 -04:00
|
|
|
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_catEnabled) {
|
|
|
|
rigOpen();
|
2013-07-08 09:17:22 -04:00
|
|
|
} else {
|
|
|
|
ui->readFreq->setStyleSheet("");
|
2013-04-23 16:46:04 -04:00
|
|
|
}
|
2013-07-08 19:08:25 -04:00
|
|
|
|
|
|
|
if(dlg.m_bSplit!=m_bSplit or dlg.m_bXIT!=m_bXIT) {
|
|
|
|
m_bSplit=dlg.m_bSplit;
|
2013-08-06 13:22:33 -04:00
|
|
|
if(m_bSplit) ui->readFreq->setText("S");
|
|
|
|
if(!m_bSplit) ui->readFreq->setText("");
|
2013-07-08 19:08:25 -04:00
|
|
|
m_bXIT=dlg.m_bXIT;
|
|
|
|
if(m_bSplit or m_bXIT) setXIT(m_txFreq);
|
2013-07-09 12:05:23 -04:00
|
|
|
if(m_bRigOpen and !m_bSplit) {
|
|
|
|
int ret=rig->setSplitFreq(MHz(m_dialFreq),RIG_VFO_B);
|
|
|
|
if(ret!=RIG_OK) {
|
|
|
|
QString rt;
|
|
|
|
rt.sprintf("Setting VFO_B failed: %d",ret);
|
|
|
|
msgBox(rt);
|
|
|
|
}
|
|
|
|
}
|
2013-07-08 19:08:25 -04:00
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_monitorButton_clicked() //Monitor
|
|
|
|
{
|
|
|
|
m_monitoring=true;
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (true);
|
|
|
|
// Q_EMIT startAudioInputStream (m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
2012-05-22 13:09:48 -04:00
|
|
|
m_diskData=false;
|
|
|
|
}
|
2013-04-09 13:52:44 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
void MainWindow::on_actionAbout_triggered() //Display "About"
|
|
|
|
{
|
|
|
|
CAboutDlg dlg(this,Program_Title_Version);
|
|
|
|
dlg.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_autoButton_clicked() //Auto
|
|
|
|
{
|
|
|
|
m_auto = !m_auto;
|
|
|
|
if(m_auto) {
|
|
|
|
ui->autoButton->setStyleSheet(m_pbAutoOn_style);
|
|
|
|
} else {
|
2013-07-31 20:49:58 -04:00
|
|
|
m_btxok=false;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT muteAudioOutput ();
|
2012-05-22 13:09:48 -04:00
|
|
|
ui->autoButton->setStyleSheet("");
|
|
|
|
on_monitorButton_clicked();
|
2013-04-15 12:06:22 -04:00
|
|
|
m_repeatMsg=0;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent
|
|
|
|
{
|
2012-11-23 11:05:50 -05:00
|
|
|
int n;
|
2012-05-22 13:09:48 -04:00
|
|
|
switch(e->key())
|
|
|
|
{
|
2013-05-24 08:36:41 -04:00
|
|
|
case Qt::Key_1:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-07-08 09:17:22 -04:00
|
|
|
on_txb1_clicked();
|
2013-05-24 08:36:41 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Qt::Key_2:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-07-08 09:17:22 -04:00
|
|
|
on_txb2_clicked();
|
2013-05-24 08:36:41 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Qt::Key_3:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-07-08 09:17:22 -04:00
|
|
|
on_txb3_clicked();
|
2013-05-24 08:36:41 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Qt::Key_4:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-07-08 09:17:22 -04:00
|
|
|
on_txb4_clicked();
|
2013-05-24 08:36:41 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Qt::Key_5:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-07-08 09:17:22 -04:00
|
|
|
on_txb5_clicked();
|
2013-05-24 08:36:41 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Qt::Key_6:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-07-08 09:17:22 -04:00
|
|
|
on_txb6_clicked();
|
2013-05-24 08:36:41 -04:00
|
|
|
break;
|
|
|
|
}
|
2013-04-11 12:51:57 -04:00
|
|
|
case Qt::Key_D:
|
|
|
|
if(e->modifiers() & Qt::ShiftModifier) {
|
|
|
|
if(!m_decoderBusy) {
|
|
|
|
jt9com_.newdat=0;
|
|
|
|
jt9com_.nagain=0;
|
|
|
|
decode();
|
2013-07-09 17:19:22 -04:00
|
|
|
break;
|
2013-04-11 12:51:57 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2012-05-22 13:09:48 -04:00
|
|
|
case Qt::Key_F4:
|
|
|
|
ui->dxCallEntry->setText("");
|
|
|
|
ui->dxGridEntry->setText("");
|
2013-07-09 17:19:22 -04:00
|
|
|
genStdMsgs("");
|
2013-07-15 17:13:45 -04:00
|
|
|
m_ntx=6;
|
|
|
|
ui->txrb6->setChecked(true);
|
2013-07-09 17:19:22 -04:00
|
|
|
break;
|
2012-05-22 13:09:48 -04:00
|
|
|
case Qt::Key_F6:
|
|
|
|
if(e->modifiers() & Qt::ShiftModifier) {
|
|
|
|
on_actionDecode_remaining_files_in_directory_triggered();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Qt::Key_F11:
|
2012-11-23 11:05:50 -05:00
|
|
|
n=11;
|
|
|
|
if(e->modifiers() & Qt::ControlModifier) n+=100;
|
|
|
|
bumpFqso(n);
|
2012-05-22 13:09:48 -04:00
|
|
|
break;
|
|
|
|
case Qt::Key_F12:
|
2012-11-23 11:05:50 -05:00
|
|
|
n=12;
|
|
|
|
if(e->modifiers() & Qt::ControlModifier) n+=100;
|
|
|
|
bumpFqso(n);
|
2012-05-22 13:09:48 -04:00
|
|
|
break;
|
2013-04-11 12:51:57 -04:00
|
|
|
case Qt::Key_F:
|
|
|
|
if(e->modifiers() & Qt::ControlModifier) {
|
|
|
|
if(ui->tabWidget->currentIndex()==0) {
|
|
|
|
ui->tx5->clear();
|
|
|
|
ui->tx5->setFocus();
|
|
|
|
} else {
|
|
|
|
ui->freeTextMsg->clear();
|
|
|
|
ui->freeTextMsg->setFocus();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
case Qt::Key_G:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
2013-04-08 14:31:21 -04:00
|
|
|
genStdMsgs(m_rpt);
|
2012-05-22 13:09:48 -04:00
|
|
|
break;
|
|
|
|
}
|
2013-04-11 12:51:57 -04:00
|
|
|
case Qt::Key_H:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
|
|
|
on_stopTxButton_clicked();
|
|
|
|
break;
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
case Qt::Key_L:
|
|
|
|
if(e->modifiers() & Qt::ControlModifier) {
|
|
|
|
lookup();
|
2013-04-08 14:31:21 -04:00
|
|
|
genStdMsgs(m_rpt);
|
2012-05-22 13:09:48 -04:00
|
|
|
break;
|
|
|
|
}
|
2013-04-12 13:57:20 -04:00
|
|
|
case Qt::Key_V:
|
|
|
|
if(e->modifiers() & Qt::AltModifier) {
|
|
|
|
m_fileToSave=m_fname;
|
|
|
|
break;
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-23 11:05:50 -05:00
|
|
|
void MainWindow::bumpFqso(int n) //bumpFqso()
|
|
|
|
{
|
2012-11-23 11:44:40 -05:00
|
|
|
int i;
|
|
|
|
bool ctrl = (n>=100);
|
|
|
|
n=n%100;
|
2013-08-10 11:29:55 -04:00
|
|
|
i=m_wideGraph->rxFreq();
|
2012-11-23 11:44:40 -05:00
|
|
|
if(n==11) i--;
|
|
|
|
if(n==12) i++;
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setRxFreq(i);
|
2013-04-09 11:16:34 -04:00
|
|
|
if(ctrl) {
|
2012-11-23 11:44:40 -05:00
|
|
|
ui->TxFreqSpinBox->setValue(i);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setTxFreq(i);
|
2012-11-23 11:05:50 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-18 09:24:50 -04:00
|
|
|
void MainWindow::dialFreqChanged2(double f)
|
|
|
|
{
|
|
|
|
m_dialFreq=f;
|
2013-07-10 09:57:13 -04:00
|
|
|
if(m_band<0 or m_band>15 or m_dFreq.length()<=1) return;
|
2013-03-25 08:45:37 -04:00
|
|
|
QString t;
|
|
|
|
t.sprintf("%.6f",m_dialFreq);
|
|
|
|
int n=t.length();
|
2013-03-25 15:13:49 -04:00
|
|
|
t=t.mid(0,n-3) + " " + t.mid(n-3,3);
|
2013-07-10 09:57:13 -04:00
|
|
|
double fBand=m_dFreq[m_band].toDouble();
|
|
|
|
if(qAbs(m_dialFreq-fBand)<0.01) {
|
2013-04-24 13:55:33 -04:00
|
|
|
ui->labDialFreq->setStyleSheet( \
|
|
|
|
"QLabel { background-color : black; color : yellow; }");
|
|
|
|
} else {
|
|
|
|
ui->labDialFreq->setStyleSheet( \
|
|
|
|
"QLabel { background-color : red; color : yellow; }");
|
|
|
|
ui->labDialFreq->setText(t);
|
|
|
|
}
|
2013-03-25 08:45:37 -04:00
|
|
|
ui->labDialFreq->setText(t);
|
2013-03-18 09:24:50 -04:00
|
|
|
statusChanged();
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setDialFreq(m_dialFreq);
|
2013-03-18 09:24:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::statusChanged()
|
|
|
|
{
|
|
|
|
QFile f("wsjtx_status.txt");
|
2013-04-22 20:52:51 -04:00
|
|
|
if(f.open(QFile::WriteOnly | QIODevice::Text)) {
|
|
|
|
QTextStream out(&f);
|
2013-05-08 11:23:02 -04:00
|
|
|
out << m_dialFreq << ";" << m_mode << ";" << m_hisCall << ";"
|
2013-07-08 19:08:25 -04:00
|
|
|
<< ui->rptSpinBox->value() << ";" << m_modeTx << endl;
|
2013-04-22 20:52:51 -04:00
|
|
|
f.close();
|
|
|
|
} else {
|
2013-03-18 09:24:50 -04:00
|
|
|
msgBox("Cannot open file \"wsjtx_status.txt\".");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
bool MainWindow::eventFilter(QObject *object, QEvent *event) //eventFilter()
|
|
|
|
{
|
|
|
|
if (event->type() == QEvent::KeyPress) {
|
|
|
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
|
|
|
MainWindow::keyPressEvent(keyEvent);
|
|
|
|
return QObject::eventFilter(object, event);
|
|
|
|
}
|
|
|
|
return QObject::eventFilter(object, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::createStatusBar() //createStatusBar
|
|
|
|
{
|
|
|
|
lab1 = new QLabel("Receiving");
|
|
|
|
lab1->setAlignment(Qt::AlignHCenter);
|
2012-11-13 15:23:03 -05:00
|
|
|
lab1->setMinimumSize(QSize(80,18));
|
2012-05-22 13:09:48 -04:00
|
|
|
lab1->setStyleSheet("QLabel{background-color: #00ff00}");
|
|
|
|
lab1->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
|
|
|
statusBar()->addWidget(lab1);
|
|
|
|
|
2013-08-08 10:26:53 -04:00
|
|
|
|
2012-07-05 15:37:59 -04:00
|
|
|
lab2 = new QLabel("");
|
2012-05-22 13:09:48 -04:00
|
|
|
lab2->setAlignment(Qt::AlignHCenter);
|
2013-08-08 10:26:53 -04:00
|
|
|
lab2->setMinimumSize(QSize(80,18));
|
2012-05-22 13:09:48 -04:00
|
|
|
lab2->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
|
|
|
statusBar()->addWidget(lab2);
|
|
|
|
|
2012-10-20 12:37:01 -04:00
|
|
|
lab3 = new QLabel("");
|
2012-05-22 13:09:48 -04:00
|
|
|
lab3->setAlignment(Qt::AlignHCenter);
|
2013-08-08 10:26:53 -04:00
|
|
|
lab3->setMinimumSize(QSize(150,18));
|
2012-05-22 13:09:48 -04:00
|
|
|
lab3->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
|
|
|
statusBar()->addWidget(lab3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionExit_triggered() //Exit()
|
|
|
|
{
|
|
|
|
OnExit();
|
|
|
|
}
|
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
void MainWindow::closeEvent(QCloseEvent * e)
|
2012-05-22 13:09:48 -04:00
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
writeSettings ();
|
2012-05-22 13:09:48 -04:00
|
|
|
OnExit();
|
2013-08-10 11:29:55 -04:00
|
|
|
QMainWindow::closeEvent (e);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::OnExit()
|
|
|
|
{
|
2013-08-07 19:09:13 -04:00
|
|
|
m_guiTimer.stop ();
|
2013-05-07 12:35:50 -04:00
|
|
|
if(m_fname != "") killFile();
|
2012-11-20 15:39:41 -05:00
|
|
|
m_killAll=true;
|
2013-04-13 08:28:03 -04:00
|
|
|
mem_jt9->detach();
|
2012-11-20 15:39:41 -05:00
|
|
|
QFile quitFile(m_appDir + "/.quit");
|
|
|
|
quitFile.open(QIODevice::ReadWrite);
|
|
|
|
QFile lockFile(m_appDir + "/.lock");
|
2012-11-21 12:42:53 -05:00
|
|
|
lockFile.remove(); // Allow jt9 to terminate
|
2012-11-20 15:39:41 -05:00
|
|
|
bool b=proc_jt9.waitForFinished(1000);
|
|
|
|
if(!b) proc_jt9.kill();
|
|
|
|
quitFile.remove();
|
2013-08-07 19:09:13 -04:00
|
|
|
|
|
|
|
Q_EMIT finished ();
|
2013-08-17 15:21:14 -04:00
|
|
|
m_audioThread.wait ();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_stopButton_clicked() //stopButton
|
|
|
|
{
|
|
|
|
m_monitoring=false;
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (m_monitoring);
|
2012-05-22 13:09:48 -04:00
|
|
|
m_loopall=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::msgBox(QString t) //msgBox
|
|
|
|
{
|
|
|
|
msgBox0.setText(t);
|
|
|
|
msgBox0.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionOnline_Users_Guide_triggered() //Display manual
|
|
|
|
{
|
|
|
|
QDesktopServices::openUrl(QUrl(
|
2013-08-06 13:22:33 -04:00
|
|
|
"http://www.physics.princeton.edu/pulsar/K1JT/WSJT-X_Users_Guide_v1.2.pdf",
|
2012-05-22 13:09:48 -04:00
|
|
|
QUrl::TolerantMode));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionWide_Waterfall_triggered() //Display Waterfalls
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->show();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionOpen_triggered() //Open File
|
|
|
|
{
|
|
|
|
m_monitoring=false;
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (m_monitoring);
|
2012-05-22 13:09:48 -04:00
|
|
|
QString fname;
|
2012-07-02 11:33:33 -04:00
|
|
|
fname=QFileDialog::getOpenFileName(this, "Open File", m_path,
|
2012-09-24 11:20:48 -04:00
|
|
|
"WSJT Files (*.wav)");
|
2012-05-22 13:09:48 -04:00
|
|
|
if(fname != "") {
|
|
|
|
m_path=fname;
|
|
|
|
int i;
|
2012-09-26 11:20:43 -04:00
|
|
|
i=fname.indexOf(".wav") - 11;
|
2012-05-22 13:09:48 -04:00
|
|
|
if(i>=0) {
|
|
|
|
lab1->setStyleSheet("QLabel{background-color: #66ff66}");
|
|
|
|
lab1->setText(" " + fname.mid(i,15) + " ");
|
|
|
|
}
|
|
|
|
on_stopButton_clicked();
|
|
|
|
m_diskData=true;
|
2012-09-26 11:20:43 -04:00
|
|
|
*future1 = QtConcurrent::run(getfile, fname, m_TRperiod);
|
2012-10-05 13:13:21 -04:00
|
|
|
watcher1->setFuture(*future1); // call diskDat() when done
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next
|
|
|
|
{
|
|
|
|
int i,len;
|
|
|
|
QFileInfo fi(m_path);
|
|
|
|
QStringList list;
|
2012-07-12 17:22:55 -04:00
|
|
|
list= fi.dir().entryList().filter(".wav");
|
2012-05-22 13:09:48 -04:00
|
|
|
for (i = 0; i < list.size()-1; ++i) {
|
|
|
|
if(i==list.size()-2) m_loopall=false;
|
2012-07-12 17:22:55 -04:00
|
|
|
len=list.at(i).length();
|
2012-05-22 13:09:48 -04:00
|
|
|
if(list.at(i)==m_path.right(len)) {
|
|
|
|
int n=m_path.length();
|
|
|
|
QString fname=m_path.replace(n-len,len,list.at(i+1));
|
|
|
|
m_path=fname;
|
|
|
|
int i;
|
2012-07-12 17:22:55 -04:00
|
|
|
i=fname.indexOf(".wav") - 11;
|
2012-05-22 13:09:48 -04:00
|
|
|
if(i>=0) {
|
|
|
|
lab1->setStyleSheet("QLabel{background-color: #66ff66}");
|
|
|
|
lab1->setText(" " + fname.mid(i,len) + " ");
|
|
|
|
}
|
|
|
|
m_diskData=true;
|
2012-09-26 11:20:43 -04:00
|
|
|
*future1 = QtConcurrent::run(getfile, fname, m_TRperiod);
|
2012-05-22 13:09:48 -04:00
|
|
|
watcher1->setFuture(*future1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Open all remaining files
|
|
|
|
void MainWindow::on_actionDecode_remaining_files_in_directory_triggered()
|
|
|
|
{
|
|
|
|
m_loopall=true;
|
|
|
|
on_actionOpen_next_in_directory_triggered();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::diskDat() //diskDat()
|
|
|
|
{
|
2012-10-19 15:26:07 -04:00
|
|
|
int k;
|
2012-09-26 11:20:43 -04:00
|
|
|
int kstep=m_nsps/2;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_diskData=true;
|
2012-10-11 14:33:50 -04:00
|
|
|
for(int n=1; n<=m_hsymStop; n++) { // Do the half-symbol FFTs
|
2012-10-19 15:26:07 -04:00
|
|
|
k=(n+1)*kstep;
|
|
|
|
jt9com_.npts8=k/8;
|
2013-08-05 09:57:55 -04:00
|
|
|
dataSink(k * sizeof (jt9com_.d2[0]));
|
2012-11-12 11:33:45 -05:00
|
|
|
if(n%10 == 1 or n == m_hsymStop)
|
|
|
|
qApp->processEvents(); //Keep GUI responsive
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::diskWriteFinished() //diskWriteFinished
|
|
|
|
{
|
|
|
|
}
|
2012-10-15 15:18:45 -04:00
|
|
|
|
|
|
|
//Delete ../save/*.wav
|
2012-07-02 12:13:21 -04:00
|
|
|
void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered()
|
2012-05-22 13:09:48 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
QString fname;
|
|
|
|
int ret = QMessageBox::warning(this, "Confirm Delete",
|
2012-07-02 12:13:21 -04:00
|
|
|
"Are you sure you want to delete all *.wav files in\n" +
|
2012-05-22 13:09:48 -04:00
|
|
|
QDir::toNativeSeparators(m_saveDir) + " ?",
|
|
|
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
|
if(ret==QMessageBox::Yes) {
|
|
|
|
QDir dir(m_saveDir);
|
|
|
|
QStringList files=dir.entryList(QDir::Files);
|
|
|
|
QList<QString>::iterator f;
|
|
|
|
for(f=files.begin(); f!=files.end(); ++f) {
|
|
|
|
fname=*f;
|
2012-07-05 12:16:03 -04:00
|
|
|
i=(fname.indexOf(".wav"));
|
2012-07-05 15:18:58 -04:00
|
|
|
if(i>10) dir.remove(fname);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionNone_triggered() //Save None
|
|
|
|
{
|
2012-10-30 12:49:24 -04:00
|
|
|
m_saveDecoded=false;
|
|
|
|
m_saveAll=false;
|
|
|
|
ui->actionNone->setChecked(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionSave_decoded_triggered()
|
|
|
|
{
|
|
|
|
m_saveDecoded=true;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_saveAll=false;
|
2012-10-30 12:49:24 -04:00
|
|
|
ui->actionSave_decoded->setChecked(true);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionSave_all_triggered() //Save All
|
|
|
|
{
|
2012-10-30 12:49:24 -04:00
|
|
|
m_saveDecoded=false;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_saveAll=true;
|
2012-10-30 12:49:24 -04:00
|
|
|
ui->actionSave_all->setChecked(true);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2012-07-18 09:35:54 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
void MainWindow::on_actionKeyboard_shortcuts_triggered()
|
|
|
|
{
|
2013-04-26 12:23:18 -04:00
|
|
|
pShortcuts = new QTextEdit(0);
|
|
|
|
pShortcuts->setReadOnly(true);
|
|
|
|
pShortcuts->setFontPointSize(10);
|
|
|
|
pShortcuts->setWindowTitle("Keyboard Shortcuts");
|
2013-05-28 08:43:58 -04:00
|
|
|
pShortcuts->setGeometry(QRect(45,50,430,460));
|
2013-04-26 12:23:18 -04:00
|
|
|
Qt::WindowFlags flags = Qt::WindowCloseButtonHint |
|
|
|
|
Qt::WindowMinimizeButtonHint;
|
|
|
|
pShortcuts->setWindowFlags(flags);
|
|
|
|
QString shortcuts = m_appDir + "/shortcuts.txt";
|
|
|
|
QFile f(shortcuts);
|
|
|
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
|
|
msgBox("Cannot open " + shortcuts);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QTextStream s(&f);
|
|
|
|
QString t;
|
|
|
|
for(int i=0; i<100; i++) {
|
|
|
|
t=s.readLine();
|
|
|
|
pShortcuts->append(t);
|
|
|
|
if(s.atEnd()) break;
|
|
|
|
}
|
|
|
|
pShortcuts->show();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2012-07-18 09:35:54 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
void MainWindow::on_actionSpecial_mouse_commands_triggered()
|
|
|
|
{
|
2013-04-26 12:23:18 -04:00
|
|
|
QTextEdit* pMouseCmnds;
|
|
|
|
pMouseCmnds = new QTextEdit(0);
|
|
|
|
pMouseCmnds->setReadOnly(true);
|
|
|
|
pMouseCmnds->setFontPointSize(10);
|
|
|
|
pMouseCmnds->setWindowTitle("Special Mouse Commands");
|
|
|
|
pMouseCmnds->setGeometry(QRect(45,50,440,300));
|
|
|
|
Qt::WindowFlags flags = Qt::WindowCloseButtonHint |
|
|
|
|
Qt::WindowMinimizeButtonHint;
|
|
|
|
pMouseCmnds->setWindowFlags(flags);
|
|
|
|
QString mouseCmnds = m_appDir + "/mouse_commands.txt";
|
|
|
|
QFile f(mouseCmnds);
|
|
|
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
|
|
msgBox("Cannot open " + mouseCmnds);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QTextStream s(&f);
|
|
|
|
QString t;
|
|
|
|
for(int i=0; i<100; i++) {
|
|
|
|
t=s.readLine();
|
|
|
|
pMouseCmnds->append(t);
|
|
|
|
if(s.atEnd()) break;
|
|
|
|
}
|
|
|
|
pMouseCmnds->show();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_DecodeButton_clicked() //Decode request
|
|
|
|
{
|
2012-10-26 12:52:04 -04:00
|
|
|
if(!m_decoderBusy) {
|
|
|
|
jt9com_.newdat=0;
|
2012-11-21 16:08:17 -05:00
|
|
|
jt9com_.nagain=1;
|
2013-08-29 21:08:10 -04:00
|
|
|
m_blankLine=false; // don't insert the separator again
|
2012-10-26 12:52:04 -04:00
|
|
|
decode();
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::freezeDecode(int n) //freezeDecode()
|
|
|
|
{
|
2013-04-09 11:16:34 -04:00
|
|
|
bool ctrl = (n>=100);
|
2013-08-10 11:29:55 -04:00
|
|
|
int i=m_wideGraph->rxFreq();
|
2013-04-09 11:16:34 -04:00
|
|
|
if(ctrl) {
|
|
|
|
ui->TxFreqSpinBox->setValue(i);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setTxFreq(i);
|
2012-10-26 12:52:04 -04:00
|
|
|
}
|
2013-04-09 11:16:34 -04:00
|
|
|
if((n%100)==2) on_DecodeButton_clicked();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
2012-11-20 15:39:41 -05:00
|
|
|
void MainWindow::decode() //decode()
|
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
if(!m_dataAvailable) return;
|
2012-11-20 15:39:41 -05:00
|
|
|
ui->DecodeButton->setStyleSheet(m_pbdecoding_style1);
|
2013-07-09 12:45:22 -04:00
|
|
|
if(jt9com_.newdat==1 && (!m_diskData)) {
|
2012-11-20 15:39:41 -05:00
|
|
|
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
|
|
|
int imin=ms/60000;
|
|
|
|
int ihr=imin/60;
|
|
|
|
imin=imin % 60;
|
2012-11-30 08:56:55 -05:00
|
|
|
imin=imin - (imin % (m_TRperiod/60));
|
2012-11-21 16:08:17 -05:00
|
|
|
jt9com_.nutc=100*ihr + imin;
|
2012-11-20 15:39:41 -05:00
|
|
|
}
|
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
jt9com_.nfqso=m_wideGraph->rxFreq();
|
2012-11-21 12:42:53 -05:00
|
|
|
jt9com_.ndepth=m_ndepth;
|
|
|
|
jt9com_.ndiskdat=0;
|
|
|
|
if(m_diskData) jt9com_.ndiskdat=1;
|
2013-08-10 11:29:55 -04:00
|
|
|
jt9com_.nfa=m_wideGraph->nStartFreq();
|
|
|
|
jt9com_.nfSplit=m_wideGraph->getFmin();
|
|
|
|
jt9com_.nfb=m_wideGraph->getFmax();
|
2013-07-08 09:17:22 -04:00
|
|
|
jt9com_.ntol=20;
|
2013-08-09 13:22:08 -04:00
|
|
|
if(jt9com_.nutc < m_nutc0) m_RxLog |= 1; //Date and Time to all.txt
|
2012-11-21 12:42:53 -05:00
|
|
|
m_nutc0=jt9com_.nutc;
|
2013-07-08 09:17:22 -04:00
|
|
|
jt9com_.ntxmode=9;
|
|
|
|
if(m_modeTx=="JT65") jt9com_.ntxmode=65;
|
|
|
|
jt9com_.nmode=9;
|
|
|
|
if(m_mode=="JT65") jt9com_.nmode=65;
|
|
|
|
if(m_mode=="JT9+JT65") jt9com_.nmode=9+65;
|
2012-11-21 12:42:53 -05:00
|
|
|
jt9com_.ntrperiod=m_TRperiod;
|
|
|
|
m_nsave=0;
|
|
|
|
if(m_saveDecoded) m_nsave=2;
|
|
|
|
jt9com_.nsave=m_nsave;
|
2013-05-23 15:35:37 -04:00
|
|
|
strncpy(jt9com_.datetime, m_dateTime.toLatin1(), 20);
|
2012-11-20 15:39:41 -05:00
|
|
|
|
|
|
|
//newdat=1 ==> this is new data, must do the big FFT
|
|
|
|
//nagain=1 ==> decode only at fQSO +/- Tol
|
|
|
|
|
2013-04-13 08:28:03 -04:00
|
|
|
char *to = (char*)mem_jt9->data();
|
2012-11-21 12:42:53 -05:00
|
|
|
char *from = (char*) jt9com_.ss;
|
|
|
|
int size=sizeof(jt9com_);
|
|
|
|
if(jt9com_.newdat==0) {
|
2013-07-08 09:17:22 -04:00
|
|
|
int noffset = 4*184*NSMAX + 4*NSMAX + 2*NTMAX*12000;
|
2012-11-20 15:39:41 -05:00
|
|
|
to += noffset;
|
|
|
|
from += noffset;
|
|
|
|
size -= noffset;
|
|
|
|
}
|
2013-04-13 08:28:03 -04:00
|
|
|
memcpy(to, from, qMin(mem_jt9->size(), size));
|
2012-11-20 15:39:41 -05:00
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
QFile lockFile(m_appDir + "/.lock"); // Allow jt9 to start
|
2012-11-20 15:39:41 -05:00
|
|
|
lockFile.remove();
|
|
|
|
decodeBusy(true);
|
|
|
|
}
|
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
void MainWindow::jt9_error() //jt9_error
|
2012-11-20 15:39:41 -05:00
|
|
|
{
|
|
|
|
if(!m_killAll) {
|
2012-11-21 12:42:53 -05:00
|
|
|
msgBox("Error starting or running\n" + m_appDir + "/jt9 -s");
|
2012-11-20 15:39:41 -05:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::readFromStderr() //readFromStderr
|
|
|
|
{
|
|
|
|
QByteArray t=proc_jt9.readAllStandardError();
|
|
|
|
msgBox(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::readFromStdout() //readFromStdout
|
|
|
|
{
|
2013-08-24 21:48:45 -04:00
|
|
|
while(proc_jt9.canReadLine())
|
|
|
|
{
|
2012-11-20 15:39:41 -05:00
|
|
|
QByteArray t=proc_jt9.readLine();
|
2013-08-24 21:48:45 -04:00
|
|
|
if(t.indexOf("<DecodeFinished>") >= 0)
|
|
|
|
{
|
2012-11-24 09:36:45 -05:00
|
|
|
m_bdecoded = (t.mid(23,1).toInt()==1);
|
2013-07-08 09:17:22 -04:00
|
|
|
bool keepFile=m_saveAll or (m_saveDecoded and m_bdecoded);
|
2013-04-12 13:57:20 -04:00
|
|
|
if(!keepFile and !m_diskData) killFileTimer->start(45*1000); //Kill in 45 s
|
2012-11-24 09:36:45 -05:00
|
|
|
jt9com_.nagain=0;
|
|
|
|
jt9com_.ndiskdat=0;
|
2012-11-20 15:39:41 -05:00
|
|
|
QFile lockFile(m_appDir + "/.lock");
|
|
|
|
lockFile.open(QIODevice::ReadWrite);
|
|
|
|
ui->DecodeButton->setStyleSheet("");
|
|
|
|
decodeBusy(false);
|
2012-11-21 12:42:53 -05:00
|
|
|
m_RxLog=0;
|
2012-11-20 15:39:41 -05:00
|
|
|
m_startAnother=m_loopall;
|
2013-03-28 20:21:26 -04:00
|
|
|
m_blankLine=true;
|
2012-11-20 15:39:41 -05:00
|
|
|
return;
|
2012-11-21 12:42:53 -05:00
|
|
|
} else {
|
2013-03-18 12:14:18 -04:00
|
|
|
QFile f("ALL.TXT");
|
|
|
|
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
|
|
|
QTextStream out(&f);
|
2013-04-27 09:11:29 -04:00
|
|
|
if(m_RxLog && 1) {
|
2013-03-18 12:14:18 -04:00
|
|
|
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
2013-04-27 09:29:46 -04:00
|
|
|
<< " " << m_dialFreq << " MHz " << m_mode << endl;
|
2013-03-18 16:12:23 -04:00
|
|
|
m_RxLog=0;
|
2013-03-18 12:14:18 -04:00
|
|
|
}
|
2013-03-18 16:12:23 -04:00
|
|
|
int n=t.length();
|
|
|
|
out << t.mid(0,n-2) << endl;
|
2013-03-18 12:14:18 -04:00
|
|
|
f.close();
|
|
|
|
|
2013-08-29 21:08:10 -04:00
|
|
|
if(m_insertBlank and m_blankLine)
|
2013-07-31 07:29:42 -04:00
|
|
|
{
|
2013-08-15 08:24:12 -04:00
|
|
|
ui->decodedTextBrowser->insertLineSpacer();
|
|
|
|
m_blankLine=false;
|
2013-07-31 07:29:42 -04:00
|
|
|
}
|
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
DecodedText decodedtext;
|
|
|
|
decodedtext = t.replace("\n",""); //t.replace("\n","").mid(0,t.length()-4);
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2013-08-15 08:24:12 -04:00
|
|
|
// the left band display
|
2013-08-24 21:48:45 -04:00
|
|
|
ui->decodedTextBrowser->displayDecodedText(decodedtext,m_myCall,m_displayDXCCEntity,m_logBook);
|
2013-08-15 08:24:12 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
if (abs(decodedtext.frequencyOffset() - m_wideGraph->rxFreq()) <= 10) // this msg is within 10 hertz of our tuned frequency
|
2013-08-15 08:24:12 -04:00
|
|
|
{
|
|
|
|
// the right QSO window
|
2013-08-24 21:48:45 -04:00
|
|
|
ui->decodedTextBrowser2->displayDecodedText(decodedtext,m_myCall,false,m_logBook);
|
2013-04-08 17:01:30 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
bool b65=decodedtext.isJT65();
|
2013-08-15 08:24:12 -04:00
|
|
|
if(b65 and m_modeTx!="JT65") on_pbTxMode_clicked();
|
|
|
|
if(!b65 and m_modeTx=="JT65") on_pbTxMode_clicked();
|
2013-08-24 21:48:45 -04:00
|
|
|
m_QSOText=decodedtext;
|
2013-04-08 17:01:30 -04:00
|
|
|
}
|
2013-03-24 14:01:22 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
// find and extract any report for myCall
|
|
|
|
bool stdMsg = decodedtext.report(m_myCall,/*mod*/m_rptRcvd);
|
2013-03-18 16:12:23 -04:00
|
|
|
|
2013-08-15 08:24:12 -04:00
|
|
|
// extract details and send to PSKreporter
|
2013-04-18 06:35:58 -04:00
|
|
|
int nsec=QDateTime::currentMSecsSinceEpoch()/1000-m_secBandChanged;
|
|
|
|
bool okToPost=(nsec>50);
|
2013-08-24 21:48:45 -04:00
|
|
|
if(m_pskReporter and stdMsg and !m_diskData and okToPost)
|
|
|
|
{
|
|
|
|
QString msgmode="JT9";
|
|
|
|
if (decodedtext.isJT65())
|
|
|
|
msgmode="JT65";
|
|
|
|
|
|
|
|
QString deCall;
|
|
|
|
QString grid;
|
|
|
|
decodedtext.deCallAndGrid(/*out*/deCall,grid);
|
|
|
|
int audioFrequency = decodedtext.frequencyOffset();
|
|
|
|
int snr = decodedtext.snr();
|
|
|
|
uint frequency = 1000000.0*m_dialFreq + audioFrequency + 0.5;
|
|
|
|
|
|
|
|
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
|
|
|
|
if(gridOK(grid))
|
|
|
|
psk_Reporter->addRemoteStation(deCall,grid,QString::number(frequency),msgmode,QString::number(snr),
|
|
|
|
QString::number(QDateTime::currentDateTime().toTime_t()));
|
2013-04-16 16:15:25 -04:00
|
|
|
}
|
2012-11-20 15:39:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-12 13:57:20 -04:00
|
|
|
void MainWindow::killFile()
|
|
|
|
{
|
|
|
|
if(m_fname==m_fileToSave) {
|
|
|
|
} else {
|
|
|
|
QFile savedFile(m_fname);
|
|
|
|
savedFile.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
void MainWindow::on_EraseButton_clicked() //Erase
|
|
|
|
{
|
2013-04-11 12:51:57 -04:00
|
|
|
qint64 ms=QDateTime::currentMSecsSinceEpoch();
|
2013-05-13 20:22:22 -04:00
|
|
|
ui->decodedTextBrowser2->clear();
|
2013-08-24 21:48:45 -04:00
|
|
|
m_QSOText.clear();
|
2013-04-22 11:43:02 -04:00
|
|
|
if((ms-m_msErase)<500) {
|
2013-05-13 20:22:22 -04:00
|
|
|
ui->decodedTextBrowser->clear();
|
2013-04-22 11:43:02 -04:00
|
|
|
QFile f(m_appDir + "/decoded.txt");
|
|
|
|
if(f.exists()) f.remove();
|
|
|
|
}
|
2013-04-11 12:51:57 -04:00
|
|
|
m_msErase=ms;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::decodeBusy(bool b) //decodeBusy()
|
|
|
|
{
|
|
|
|
m_decoderBusy=b;
|
|
|
|
ui->DecodeButton->setEnabled(!b);
|
|
|
|
ui->actionOpen->setEnabled(!b);
|
|
|
|
ui->actionOpen_next_in_directory->setEnabled(!b);
|
|
|
|
ui->actionDecode_remaining_files_in_directory->setEnabled(!b);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------- //guiUpdate()
|
|
|
|
void MainWindow::guiUpdate()
|
|
|
|
{
|
|
|
|
static int iptt0=0;
|
|
|
|
static bool btxok0=false;
|
2012-11-18 09:02:50 -05:00
|
|
|
static char message[29];
|
2012-07-12 15:10:39 -04:00
|
|
|
static char msgsent[29];
|
2012-05-22 13:09:48 -04:00
|
|
|
static int nsendingsh=0;
|
2013-07-08 09:17:22 -04:00
|
|
|
static int giptt00=-1;
|
|
|
|
static int gcomport00=-1;
|
2013-07-11 15:37:01 -04:00
|
|
|
static double onAirFreq0=0.0;
|
2013-04-30 14:54:11 -04:00
|
|
|
int ret=0;
|
|
|
|
QString rt;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
double tx1=0.0;
|
2013-03-26 12:23:40 -04:00
|
|
|
double tx2=1.0 + 85.0*m_nsps/12000.0 + icw[0]*2560.0/48000.0;
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_modeTx=="JT65") tx2=1.0 + 126*4096/11025.0 + icw[0]*2560.0/48000.0;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
if(!m_txFirst) {
|
2012-09-24 15:11:31 -04:00
|
|
|
tx1 += m_TRperiod;
|
|
|
|
tx2 += m_TRperiod;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
|
|
|
int nsec=ms/1000;
|
|
|
|
double tsec=0.001*ms;
|
2012-09-24 15:11:31 -04:00
|
|
|
double t2p=fmod(tsec,2*m_TRperiod);
|
2013-04-14 10:11:20 -04:00
|
|
|
bool bTxTime = ((t2p >= tx1) and (t2p < tx2)) or m_tune;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-04-14 10:11:20 -04:00
|
|
|
if(m_auto or m_tune) {
|
2012-10-26 12:01:57 -04:00
|
|
|
QFile f("txboth");
|
2013-03-24 18:34:57 -04:00
|
|
|
if(f.exists() and fmod(tsec,m_TRperiod) < (1.0 + 85.0*m_nsps/12000.0)) {
|
2012-10-26 12:01:57 -04:00
|
|
|
bTxTime=true;
|
2013-03-24 18:34:57 -04:00
|
|
|
}
|
2012-10-26 12:01:57 -04:00
|
|
|
|
2013-07-11 15:37:01 -04:00
|
|
|
double onAirFreq=m_dialFreq+1.e-6*m_txFreq;
|
|
|
|
if(onAirFreq>10.139900 and onAirFreq<10.140320) {
|
|
|
|
bTxTime=false;
|
2013-07-12 13:31:23 -04:00
|
|
|
if(m_tune) on_tuneButton_clicked();
|
2013-07-11 15:37:01 -04:00
|
|
|
if(onAirFreq!=onAirFreq0) {
|
|
|
|
onAirFreq0=onAirFreq;
|
|
|
|
on_autoButton_clicked();
|
2013-07-12 09:45:28 -04:00
|
|
|
QString t="Please choose another Tx frequency.\n";
|
|
|
|
t+="WSJT-X will not knowingly transmit\n";
|
|
|
|
t+="in the WSPR sub-band on 30 m.";
|
2013-07-11 15:37:01 -04:00
|
|
|
msgBox0.setText(t);
|
|
|
|
msgBox0.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-13 11:18:29 -04:00
|
|
|
float fTR=float((nsec%m_TRperiod))/m_TRperiod;
|
2013-07-31 20:49:58 -04:00
|
|
|
if(g_iptt==0 and ((bTxTime and !m_btxMute and fTR<0.4) or m_tune )) {
|
2013-03-24 21:24:47 -04:00
|
|
|
icw[0]=m_ncw;
|
2013-03-27 16:08:00 -04:00
|
|
|
|
2013-04-17 10:53:58 -04:00
|
|
|
//Raise PTT
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
2013-07-08 09:17:22 -04:00
|
|
|
g_iptt=1;
|
2013-04-30 14:54:11 -04:00
|
|
|
if(m_pttData) ret=rig->setPTT(RIG_PTT_ON_DATA, RIG_VFO_CURR);
|
|
|
|
if(!m_pttData) ret=rig->setPTT(RIG_PTT_ON_MIC, RIG_VFO_CURR);
|
|
|
|
if(ret!=RIG_OK) {
|
|
|
|
rt.sprintf("CAT control PTT failed: %d",ret);
|
|
|
|
msgBox(rt);
|
|
|
|
}
|
|
|
|
|
2013-03-24 10:13:37 -04:00
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-03-27 16:08:00 -04:00
|
|
|
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) { //DTR or RTS
|
2013-07-08 09:17:22 -04:00
|
|
|
ptt(m_pttPort,1,&g_iptt,&g_COMportOpen);
|
2013-03-24 10:13:37 -04:00
|
|
|
}
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_pttMethodIndex==3) { //VOX
|
2013-07-08 09:17:22 -04:00
|
|
|
g_iptt=1;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2013-03-27 16:08:00 -04:00
|
|
|
ptt1Timer->start(200); //Sequencer delay
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2013-07-31 20:49:58 -04:00
|
|
|
if(!bTxTime || m_btxMute) {
|
|
|
|
m_btxok=false;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT muteAudioOutput ();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-18 12:14:18 -04:00
|
|
|
// Calculate Tx tones when needed
|
2013-07-08 09:17:22 -04:00
|
|
|
if((g_iptt==1 && iptt0==0) || m_restart) {
|
2012-05-22 13:09:48 -04:00
|
|
|
QByteArray ba;
|
|
|
|
if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit();
|
|
|
|
if(m_ntx == 2) ba=ui->tx2->text().toLocal8Bit();
|
|
|
|
if(m_ntx == 3) ba=ui->tx3->text().toLocal8Bit();
|
|
|
|
if(m_ntx == 4) ba=ui->tx4->text().toLocal8Bit();
|
|
|
|
if(m_ntx == 5) ba=ui->tx5->text().toLocal8Bit();
|
|
|
|
if(m_ntx == 6) ba=ui->tx6->text().toLocal8Bit();
|
2013-04-07 21:50:49 -04:00
|
|
|
if(m_ntx == 7) ba=ui->genMsg->text().toLocal8Bit();
|
|
|
|
if(m_ntx == 8) ba=ui->freeTextMsg->text().toLocal8Bit();
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
ba2msg(ba,message);
|
2012-11-12 11:33:45 -05:00
|
|
|
// ba2msg(ba,msgsent);
|
2012-10-05 13:13:21 -04:00
|
|
|
int len1=22;
|
2012-12-11 13:50:07 -05:00
|
|
|
int ichk=0,itext=0;
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_modeTx=="JT9") genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1);
|
|
|
|
if(m_modeTx=="JT65") gen65_(message,&ichk,msgsent,itone,&itext,len1,len1);
|
2012-11-12 11:33:45 -05:00
|
|
|
msgsent[22]=0;
|
2013-05-23 15:35:37 -04:00
|
|
|
QString t=QString::fromLatin1(msgsent);
|
2013-04-14 10:11:20 -04:00
|
|
|
if(m_tune) t="TUNE";
|
2013-08-08 10:26:53 -04:00
|
|
|
lab3->setText("Last Tx: " + t);
|
2012-05-22 13:09:48 -04:00
|
|
|
if(m_restart) {
|
2013-03-18 12:14:18 -04:00
|
|
|
QFile f("ALL.TXT");
|
2012-05-22 13:09:48 -04:00
|
|
|
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
|
|
|
QTextStream out(&f);
|
2013-03-18 16:12:23 -04:00
|
|
|
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
2013-07-08 15:57:01 -04:00
|
|
|
<< " Transmitting " << m_dialFreq << " MHz " << m_modeTx
|
2013-04-27 09:11:29 -04:00
|
|
|
<< ": " << t << endl;
|
2012-05-22 13:09:48 -04:00
|
|
|
f.close();
|
2013-08-24 21:48:45 -04:00
|
|
|
if(m_tx2QSO)
|
|
|
|
ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,m_txFreq);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2013-04-12 13:57:20 -04:00
|
|
|
|
2013-03-18 12:14:18 -04:00
|
|
|
QStringList w=t.split(" ",QString::SkipEmptyParts);
|
2013-03-28 08:05:59 -04:00
|
|
|
t="";
|
|
|
|
if(w.length()==3) t=w[2];
|
2013-03-24 21:24:47 -04:00
|
|
|
icw[0]=0;
|
2013-04-11 12:51:57 -04:00
|
|
|
m_sent73=(t=="73" or itext!=0);
|
2013-04-15 20:34:17 -04:00
|
|
|
if(m_sent73) {
|
|
|
|
if(m_After73) icw[0]=m_ncw;
|
2013-04-28 15:48:15 -04:00
|
|
|
if(m_promptToLog and !m_tune) logQSOTimer->start(200);
|
2013-03-26 12:23:40 -04:00
|
|
|
}
|
2013-03-24 21:24:47 -04:00
|
|
|
|
|
|
|
if(m_idInt>0) {
|
|
|
|
int nmin=(m_sec0-m_secID)/60;
|
|
|
|
if(nmin >= m_idInt) {
|
|
|
|
icw[0]=m_ncw;
|
|
|
|
m_secID=m_sec0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-18 12:14:18 -04:00
|
|
|
QString t2=QDateTime::currentDateTimeUtc().toString("hhmm");
|
2013-04-11 14:39:05 -04:00
|
|
|
if(itext==0 and w.length()>=3 and w[1]==m_myCall) {
|
2013-03-18 12:14:18 -04:00
|
|
|
int i1;
|
|
|
|
bool ok;
|
|
|
|
i1=t.toInt(&ok);
|
|
|
|
if(ok and i1>=-50 and i1<50) {
|
|
|
|
m_rptSent=t;
|
|
|
|
m_qsoStart=t2;
|
|
|
|
} else {
|
|
|
|
if(t.mid(0,1)=="R") {
|
|
|
|
i1=t.mid(1).toInt(&ok);
|
|
|
|
if(ok and i1>=-50 and i1<50) {
|
|
|
|
m_rptSent=t.mid(1);
|
|
|
|
m_qsoStart=t2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-02 19:12:19 -04:00
|
|
|
if(itext==1 or (w.length()==3 and w[2]=="73")) m_qsoStop=t2;
|
2012-05-22 13:09:48 -04:00
|
|
|
m_restart=false;
|
|
|
|
}
|
|
|
|
|
2013-03-24 18:34:57 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
// If PTT was just raised, start a countdown for raising TxOK:
|
2013-07-08 09:17:22 -04:00
|
|
|
// NB: could be better implemented with a timer
|
|
|
|
if(g_iptt == 1 && iptt0 == 0) {
|
2013-03-24 18:34:57 -04:00
|
|
|
nc1=-9; // TxDelay = 0.8 s
|
|
|
|
}
|
|
|
|
if(nc1 <= 0) {
|
|
|
|
nc1++;
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
if(nc1 == 0) {
|
2013-05-23 15:35:37 -04:00
|
|
|
QString t=QString::fromLatin1(msgsent);
|
2013-04-08 14:31:21 -04:00
|
|
|
if(t==m_msgSent0) {
|
|
|
|
m_repeatMsg++;
|
|
|
|
} else {
|
|
|
|
m_repeatMsg=0;
|
|
|
|
m_msgSent0=t;
|
|
|
|
}
|
2013-04-11 16:59:17 -04:00
|
|
|
|
2013-07-16 17:16:57 -04:00
|
|
|
signalMeter->setValue(0);
|
2012-05-22 13:09:48 -04:00
|
|
|
m_monitoring=false;
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (false);
|
2013-07-31 20:49:58 -04:00
|
|
|
m_btxok=true;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT muteAudioOutput (false);
|
2012-05-22 13:09:48 -04:00
|
|
|
m_transmitting=true;
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->pbTxMode->setEnabled(false);
|
2013-04-27 09:11:29 -04:00
|
|
|
if(!m_tune) {
|
|
|
|
QFile f("ALL.TXT");
|
|
|
|
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
|
|
|
QTextStream out(&f);
|
|
|
|
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
2013-07-08 15:57:01 -04:00
|
|
|
<< " Transmitting " << m_dialFreq << " MHz " << m_modeTx
|
2013-04-27 09:11:29 -04:00
|
|
|
<< ": " << t << endl;
|
|
|
|
f.close();
|
|
|
|
}
|
2013-08-24 21:48:45 -04:00
|
|
|
if(m_tx2QSO and !m_tune)
|
|
|
|
ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,m_txFreq);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
2013-07-31 20:49:58 -04:00
|
|
|
if(!m_btxok && btxok0 && g_iptt==1) stopTx();
|
2013-03-24 13:29:26 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
/*
|
2013-07-31 20:49:58 -04:00
|
|
|
// If m_btxok was just lowered, start a countdown for lowering PTT
|
|
|
|
if(!m_btxok && btxok0 && g_iptt==1) nc0=-11; //RxDelay = 1.0 s
|
2012-11-28 18:55:32 -05:00
|
|
|
if(nc0 <= 0) {
|
|
|
|
nc0++;
|
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
*/
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
if(m_monitoring) {
|
|
|
|
ui->monitorButton->setStyleSheet(m_pbmonitor_style);
|
|
|
|
} else {
|
|
|
|
ui->monitorButton->setStyleSheet("");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(m_startAnother) {
|
|
|
|
m_startAnother=false;
|
|
|
|
on_actionOpen_next_in_directory_triggered();
|
|
|
|
}
|
|
|
|
|
2013-04-22 20:52:51 -04:00
|
|
|
if(m_catEnabled and !m_bRigOpen) {
|
2013-07-31 16:18:52 -04:00
|
|
|
rigOpen();
|
|
|
|
if(m_bSplit or m_bXIT) setXIT(m_txFreq);
|
|
|
|
if(m_bRigOpen and !m_bSplit) {
|
|
|
|
int ret=rig->setSplitFreq(MHz(m_dialFreq),RIG_VFO_B);
|
|
|
|
if(ret!=RIG_OK) {
|
|
|
|
QString rt;
|
|
|
|
rt.sprintf("Setting VFO_B failed: %d",ret);
|
|
|
|
msgBox(rt);
|
|
|
|
}
|
|
|
|
}
|
2013-04-22 20:52:51 -04:00
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
if(nsec != m_sec0) { //Once per second
|
2012-10-26 12:01:57 -04:00
|
|
|
QDateTime t = QDateTime::currentDateTimeUtc();
|
2012-05-22 13:09:48 -04:00
|
|
|
if(m_transmitting) {
|
|
|
|
if(nsendingsh==1) {
|
|
|
|
lab1->setStyleSheet("QLabel{background-color: #66ffff}");
|
|
|
|
} else if(nsendingsh==-1) {
|
|
|
|
lab1->setStyleSheet("QLabel{background-color: #ffccff}");
|
|
|
|
} else {
|
|
|
|
lab1->setStyleSheet("QLabel{background-color: #ffff33}");
|
|
|
|
}
|
2013-04-17 10:53:58 -04:00
|
|
|
if(m_tune) {
|
|
|
|
lab1->setText("Tx: TUNE");
|
|
|
|
} else {
|
|
|
|
char s[37];
|
|
|
|
sprintf(s,"Tx: %s",msgsent);
|
|
|
|
lab1->setText(s);
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
} else if(m_monitoring) {
|
|
|
|
lab1->setStyleSheet("QLabel{background-color: #00ff00}");
|
2012-09-25 20:48:49 -04:00
|
|
|
lab1->setText("Receiving ");
|
2012-05-22 13:09:48 -04:00
|
|
|
} else if (!m_diskData) {
|
|
|
|
lab1->setStyleSheet("");
|
|
|
|
lab1->setText("");
|
|
|
|
}
|
|
|
|
|
|
|
|
m_setftx=0;
|
2012-11-12 11:33:45 -05:00
|
|
|
QString utc = t.date().toString("yyyy MMM dd") + "\n " +
|
|
|
|
t.time().toString() + " ";
|
2012-05-22 13:09:48 -04:00
|
|
|
ui->labUTC->setText(utc);
|
2012-09-25 20:48:49 -04:00
|
|
|
if(!m_monitoring and !m_diskData) {
|
2013-07-16 17:16:57 -04:00
|
|
|
signalMeter->setValue(0);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2013-04-22 20:52:51 -04:00
|
|
|
|
2013-07-23 13:32:59 -04:00
|
|
|
if(m_catEnabled and m_poll>0 and (nsec%m_poll)==0 and
|
|
|
|
!m_decoderBusy) pollRigFreq();
|
2013-04-30 14:54:11 -04:00
|
|
|
m_sec0=nsec;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2013-04-13 14:51:25 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
if(g_iptt!=giptt00 or g_COMportOpen!=gcomport00) {
|
|
|
|
giptt00=g_iptt;
|
|
|
|
gcomport00=g_COMportOpen;
|
|
|
|
}
|
|
|
|
|
|
|
|
iptt0=g_iptt;
|
2013-07-31 20:49:58 -04:00
|
|
|
btxok0=m_btxok;
|
2013-03-28 20:21:26 -04:00
|
|
|
} //End of GUIupdate
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-04-12 13:57:20 -04:00
|
|
|
|
2013-03-24 13:29:26 -04:00
|
|
|
void MainWindow::startTx2()
|
|
|
|
{
|
2013-08-07 19:09:13 -04:00
|
|
|
if (!m_modulator.isActive ()) {
|
2013-04-17 10:53:58 -04:00
|
|
|
QString t=ui->tx6->text();
|
|
|
|
double snr=t.mid(1,5).toDouble();
|
|
|
|
if(snr>0.0 or snr < -50.0) snr=99.0;
|
2013-08-05 09:57:55 -04:00
|
|
|
transmit (snr);
|
2013-07-16 17:16:57 -04:00
|
|
|
signalMeter->setValue(0);
|
2013-03-24 13:29:26 -04:00
|
|
|
m_monitoring=false;
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (false);
|
2013-07-31 20:49:58 -04:00
|
|
|
m_btxok=true;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT muteAudioOutput (false);
|
2013-03-24 13:29:26 -04:00
|
|
|
m_transmitting=true;
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->pbTxMode->setEnabled(false);
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::stopTx()
|
|
|
|
{
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT endTransmitMessage ();
|
|
|
|
Q_EMIT stopAudioOutputStream ();
|
2013-03-24 13:29:26 -04:00
|
|
|
m_transmitting=false;
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->pbTxMode->setEnabled(true);
|
|
|
|
g_iptt=0;
|
2013-03-24 13:29:26 -04:00
|
|
|
lab1->setStyleSheet("");
|
|
|
|
lab1->setText("");
|
|
|
|
ptt0Timer->start(200); //Sequencer delay
|
|
|
|
m_monitoring=true;
|
2013-08-17 15:21:14 -04:00
|
|
|
Q_EMIT detectorSetMonitoring (true);
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::stopTx2()
|
|
|
|
{
|
2013-04-30 14:54:11 -04:00
|
|
|
int ret=0;
|
|
|
|
QString rt;
|
|
|
|
|
2013-03-24 13:29:26 -04:00
|
|
|
//Lower PTT
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
2013-04-30 14:54:11 -04:00
|
|
|
ret=rig->setPTT(RIG_PTT_OFF, RIG_VFO_CURR); //CAT control for PTT=0
|
|
|
|
if(ret!=RIG_OK) {
|
|
|
|
rt.sprintf("CAT control PTT failed: %d",ret);
|
|
|
|
msgBox(rt);
|
|
|
|
}
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
|
|
|
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
|
2013-07-08 09:17:22 -04:00
|
|
|
ptt(m_pttPort,0,&g_iptt,&g_COMportOpen);
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
2013-04-11 12:51:57 -04:00
|
|
|
if(m_73TxDisable and m_sent73) on_stopTxButton_clicked();
|
2013-04-11 16:59:17 -04:00
|
|
|
|
|
|
|
if(m_runaway and m_repeatMsg>m_watchdogLimit) {
|
|
|
|
on_stopTxButton_clicked();
|
|
|
|
msgBox0.setText("Runaway Tx watchdog");
|
|
|
|
msgBox0.show();
|
|
|
|
m_repeatMsg=0;
|
|
|
|
}
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
void MainWindow::ba2msg(QByteArray ba, char message[]) //ba2msg()
|
|
|
|
{
|
2012-11-16 11:42:28 -05:00
|
|
|
int iz=ba.length();
|
2012-11-29 14:01:48 -05:00
|
|
|
for(int i=0;i<22; i++) {
|
|
|
|
if(i<iz) {
|
2012-05-22 13:09:48 -04:00
|
|
|
message[i]=ba[i];
|
2012-11-29 14:01:48 -05:00
|
|
|
} else {
|
|
|
|
message[i]=32;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
2012-11-29 14:01:48 -05:00
|
|
|
message[22]=0;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txFirstCheckBox_stateChanged(int nstate) //TxFirst
|
|
|
|
{
|
|
|
|
m_txFirst = (nstate==2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::set_ntx(int n) //set_ntx()
|
|
|
|
{
|
|
|
|
m_ntx=n;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txb1_clicked() //txb1
|
|
|
|
{
|
|
|
|
m_ntx=1;
|
|
|
|
ui->txrb1->setChecked(true);
|
|
|
|
m_restart=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txb2_clicked() //txb2
|
|
|
|
{
|
|
|
|
m_ntx=2;
|
|
|
|
ui->txrb2->setChecked(true);
|
|
|
|
m_restart=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txb3_clicked() //txb3
|
|
|
|
{
|
|
|
|
m_ntx=3;
|
|
|
|
ui->txrb3->setChecked(true);
|
|
|
|
m_restart=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txb4_clicked() //txb4
|
|
|
|
{
|
|
|
|
m_ntx=4;
|
|
|
|
ui->txrb4->setChecked(true);
|
|
|
|
m_restart=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txb5_clicked() //txb5
|
|
|
|
{
|
|
|
|
m_ntx=5;
|
|
|
|
ui->txrb5->setChecked(true);
|
|
|
|
m_restart=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_txb6_clicked() //txb6
|
|
|
|
{
|
|
|
|
m_ntx=6;
|
|
|
|
ui->txrb6->setChecked(true);
|
|
|
|
m_restart=true;
|
|
|
|
}
|
|
|
|
|
2013-04-03 20:09:25 -04:00
|
|
|
void MainWindow::doubleClickOnCall2(bool shift, bool ctrl)
|
|
|
|
{
|
|
|
|
m_decodedText2=true;
|
|
|
|
doubleClickOnCall(shift,ctrl);
|
|
|
|
m_decodedText2=false;
|
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2013-03-01 16:25:33 -05:00
|
|
|
void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
|
2012-05-22 13:09:48 -04:00
|
|
|
{
|
2013-04-03 20:09:25 -04:00
|
|
|
QTextCursor cursor;
|
2013-05-13 20:22:22 -04:00
|
|
|
if(!m_decodedText2) cursor=ui->decodedTextBrowser2->textCursor();
|
|
|
|
if(m_decodedText2) cursor=ui->decodedTextBrowser->textCursor();
|
2013-03-01 09:49:26 -05:00
|
|
|
cursor.select(QTextCursor::LineUnderCursor);
|
|
|
|
int i2=cursor.position();
|
2013-05-29 09:41:57 -04:00
|
|
|
if(shift and i2==-9999) return; //Silence compiler warning
|
2013-04-03 20:09:25 -04:00
|
|
|
|
|
|
|
QString t;
|
2013-05-13 20:22:22 -04:00
|
|
|
if(!m_decodedText2) t= ui->decodedTextBrowser2->toPlainText(); //Full contents
|
|
|
|
if(m_decodedText2) t= ui->decodedTextBrowser->toPlainText();
|
2013-04-03 20:09:25 -04:00
|
|
|
|
2012-11-15 11:34:14 -05:00
|
|
|
QString t1 = t.mid(0,i2); //contents up to \n on selected line
|
2012-10-24 15:44:29 -04:00
|
|
|
int i1=t1.lastIndexOf("\n") + 1; //points to first char of line
|
2013-08-24 21:48:45 -04:00
|
|
|
DecodedText decodedtext;
|
|
|
|
decodedtext = t1.mid(i1,i2-i1); //selected line
|
2013-08-15 08:24:12 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
if (decodedtext.indexOf(" CQ ") > 0)
|
|
|
|
decodedtext = decodedtext.left(36); // to remove DXCC entity and worked B4 status. TODO need a better way to do this
|
2013-08-15 08:24:12 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
// if(decodedtext.indexOf("Tx")==6) return; //Ignore Tx line
|
2013-02-28 18:35:04 -05:00
|
|
|
int i4=t.mid(i1).length();
|
2013-04-03 20:09:25 -04:00
|
|
|
if(i4>55) i4=55;
|
2013-02-28 18:35:04 -05:00
|
|
|
QString t3=t.mid(i1,i4);
|
2013-04-03 11:35:11 -04:00
|
|
|
int i5=t3.indexOf(" CQ DX ");
|
|
|
|
if(i5>0) t3=t3.mid(0,i5+3) + "_" + t3.mid(i5+4); //Make it "CQ_DX" (one word)
|
2013-02-28 18:35:04 -05:00
|
|
|
QStringList t4=t3.split(" ",QString::SkipEmptyParts);
|
2013-04-09 13:52:44 -04:00
|
|
|
if(t4.length() <5) return; //Skip the rest if no decoded text
|
2013-05-16 19:52:04 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
int i9=m_QSOText.indexOf(decodedtext.string());
|
|
|
|
if (i9<0 and !decodedtext.isTX())
|
|
|
|
{
|
|
|
|
ui->decodedTextBrowser2->displayDecodedText(decodedtext,m_myCall,false,m_logBook);
|
|
|
|
m_QSOText=decodedtext;
|
2013-05-16 19:52:04 -04:00
|
|
|
}
|
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
/*
|
|
|
|
int nfreq=t4.at(3).toInt();
|
|
|
|
if(t4.at(1)=="Tx") nfreq=t4.at(2).toInt();
|
|
|
|
m_wideGraph->setRxFreq(nfreq); //Set Rx freq
|
|
|
|
if(t4.at(1)=="Tx") {
|
|
|
|
if(ctrl) ui->TxFreqSpinBox->setValue(nfreq); //Set Tx freq
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
int frequency = decodedtext.frequencyOffset();
|
|
|
|
m_wideGraph->setRxFreq(frequency); //Set Rx freq
|
|
|
|
if (decodedtext.isTX())
|
|
|
|
{
|
|
|
|
if (ctrl)
|
|
|
|
ui->TxFreqSpinBox->setValue(frequency); //Set Tx freq
|
2013-07-17 10:18:18 -04:00
|
|
|
return;
|
|
|
|
}
|
2013-08-24 21:48:45 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
QString firstcall=t4.at(5);
|
|
|
|
// Don't change Tx freq if a station is calling me, unless m_lockTxFreq
|
|
|
|
// is true or CTRL is held down or
|
|
|
|
if((firstcall!=m_myCall) or m_lockTxFreq or ctrl) {
|
|
|
|
ui->TxFreqSpinBox->setValue(nfreq);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
QString firstcall = decodedtext.call();
|
|
|
|
// Don't change Tx freq if a station is calling me, unless m_lockTxFreq
|
|
|
|
// is true or CTRL is held down
|
|
|
|
if ((firstcall!=m_myCall) or m_lockTxFreq or ctrl)
|
|
|
|
ui->TxFreqSpinBox->setValue(frequency);
|
|
|
|
|
|
|
|
/*
|
|
|
|
if(t4.at(4)=="@") {
|
|
|
|
m_modeTx="JT9";
|
|
|
|
ui->pbTxMode->setText("Tx JT9 @");
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
|
|
|
}
|
|
|
|
if(t4.at(4)=="#") {
|
|
|
|
m_modeTx="JT65";
|
|
|
|
ui->pbTxMode->setText("Tx JT65 #");
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (decodedtext.isJT9())
|
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
m_modeTx="JT9";
|
2013-07-08 15:57:01 -04:00
|
|
|
ui->pbTxMode->setText("Tx JT9 @");
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
2013-08-24 21:48:45 -04:00
|
|
|
else
|
|
|
|
if (decodedtext.isJT65())
|
|
|
|
{
|
|
|
|
m_modeTx="JT65";
|
|
|
|
ui->pbTxMode->setText("Tx JT65 #");
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
|
|
|
}
|
|
|
|
/*
|
2013-07-08 09:17:22 -04:00
|
|
|
QString hiscall=t4.at(6);
|
2013-03-19 09:18:23 -04:00
|
|
|
QString hisgrid="";
|
2013-07-08 09:17:22 -04:00
|
|
|
if(t4.length()>=8) hisgrid=t4.at(7);
|
|
|
|
if(hiscall!=ui->dxCallEntry->text()) ui->dxGridEntry->setText("");
|
2013-02-28 18:35:04 -05:00
|
|
|
ui->dxCallEntry->setText(hiscall);
|
2013-06-06 15:47:56 -04:00
|
|
|
if(gridOK(hisgrid)) ui->dxGridEntry->setText(hisgrid);
|
|
|
|
if(ui->dxGridEntry->text()=="") lookup();
|
|
|
|
m_hisGrid=ui->dxGridEntry->text();
|
2013-08-24 21:48:45 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
QString hiscall;
|
|
|
|
QString hisgrid;
|
|
|
|
decodedtext.deCallAndGrid(/*out*/hiscall,hisgrid);
|
|
|
|
if (hiscall != ui->dxCallEntry->text())
|
|
|
|
ui->dxGridEntry->setText("");
|
|
|
|
ui->dxCallEntry->setText(hiscall);
|
|
|
|
if (gridOK(hisgrid))
|
|
|
|
ui->dxGridEntry->setText(hisgrid);
|
|
|
|
if (ui->dxGridEntry->text()=="")
|
|
|
|
lookup();
|
|
|
|
m_hisGrid = ui->dxGridEntry->text();
|
|
|
|
|
|
|
|
/*
|
|
|
|
int n = 60*decodedtext.mid(0,2).toInt() + decodedtext.mid(2,2).toInt();
|
2012-10-24 15:44:29 -04:00
|
|
|
int nmod=n%(m_TRperiod/30);
|
|
|
|
m_txFirst=(nmod!=0);
|
2012-05-22 13:09:48 -04:00
|
|
|
ui->txFirstCheckBox->setChecked(m_txFirst);
|
2013-08-24 21:48:45 -04:00
|
|
|
*/
|
|
|
|
int n = decodedtext.timeInSeconds();
|
|
|
|
int nmod=n%(m_TRperiod/30);
|
|
|
|
m_txFirst=(nmod!=0);
|
|
|
|
ui->txFirstCheckBox->setChecked(m_txFirst);
|
|
|
|
|
|
|
|
/*
|
2013-04-03 20:09:25 -04:00
|
|
|
QString rpt=t4.at(1);
|
2012-11-28 12:03:58 -05:00
|
|
|
if(rpt.indexOf(" ")==0) rpt="+" + rpt.mid(2,2);
|
|
|
|
if(rpt.indexOf(" -")==0) rpt=rpt.mid(1,2);
|
|
|
|
if(rpt.indexOf(" ")==0) rpt="+" + rpt.mid(1,2);
|
2013-03-24 21:24:47 -04:00
|
|
|
int nr=rpt.toInt();
|
|
|
|
if(nr<-50) rpt="-50";
|
|
|
|
if(nr>49) rpt="+49";
|
2013-03-24 21:39:20 -04:00
|
|
|
if(nr>=-9 and nr<=-1) rpt="-0" + rpt.mid(1);
|
2013-03-24 21:24:47 -04:00
|
|
|
if(nr>=0 and nr<=9) rpt="+0" + rpt;
|
|
|
|
if(nr>=10) rpt="+" + rpt;
|
2013-08-24 21:48:45 -04:00
|
|
|
*/
|
|
|
|
QString rpt = decodedtext.report();
|
2013-04-08 14:31:21 -04:00
|
|
|
ui->rptSpinBox->setValue(rpt.toInt());
|
2012-05-22 13:09:48 -04:00
|
|
|
genStdMsgs(rpt);
|
2013-08-24 21:48:45 -04:00
|
|
|
|
|
|
|
// determine the appropriate response to the received msg
|
|
|
|
if(decodedtext.indexOf(m_myCall)>=0)
|
|
|
|
{
|
|
|
|
if (t4.length()>=7 // enough fields for a normal msg
|
|
|
|
and !gridOK(t4.at(7))) // but no grid on end of msg
|
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
QString r=t4.at(7);
|
2013-04-29 14:35:58 -04:00
|
|
|
if(r.mid(0,3)=="RRR") {
|
|
|
|
m_ntx=5;
|
|
|
|
ui->txrb5->setChecked(true);
|
|
|
|
if(ui->tabWidget->currentIndex()==1) {
|
|
|
|
ui->genMsg->setText(ui->tx5->text());
|
|
|
|
m_ntx=7;
|
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
}
|
|
|
|
} else if(r.mid(0,1)=="R") {
|
|
|
|
m_ntx=4;
|
|
|
|
ui->txrb4->setChecked(true);
|
|
|
|
if(ui->tabWidget->currentIndex()==1) {
|
|
|
|
ui->genMsg->setText(ui->tx4->text());
|
|
|
|
m_ntx=7;
|
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
}
|
|
|
|
} else if(r.toInt()>=-50 and r.toInt()<=49) {
|
|
|
|
m_ntx=3;
|
|
|
|
ui->txrb3->setChecked(true);
|
|
|
|
if(ui->tabWidget->currentIndex()==1) {
|
|
|
|
ui->genMsg->setText(ui->tx3->text());
|
|
|
|
m_ntx=7;
|
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
}
|
|
|
|
} else if(r.toInt()==73) {
|
2013-05-29 11:09:04 -04:00
|
|
|
m_ntx=5;
|
|
|
|
ui->txrb5->setChecked(true);
|
2013-04-29 14:35:58 -04:00
|
|
|
if(ui->tabWidget->currentIndex()==1) {
|
2013-05-29 11:09:04 -04:00
|
|
|
ui->genMsg->setText(ui->tx5->text());
|
2013-04-29 14:35:58 -04:00
|
|
|
m_ntx=7;
|
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
m_ntx=2;
|
|
|
|
ui->txrb2->setChecked(true);
|
|
|
|
if(ui->tabWidget->currentIndex()==1) {
|
|
|
|
ui->genMsg->setText(ui->tx2->text());
|
|
|
|
m_ntx=7;
|
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
}
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
2013-04-29 14:35:58 -04:00
|
|
|
|
2013-08-24 21:48:45 -04:00
|
|
|
}
|
|
|
|
else // myCall not in msg
|
|
|
|
{
|
2012-05-22 13:09:48 -04:00
|
|
|
m_ntx=1;
|
|
|
|
ui->txrb1->setChecked(true);
|
2013-04-07 21:50:49 -04:00
|
|
|
if(ui->tabWidget->currentIndex()==1) {
|
|
|
|
ui->genMsg->setText(ui->tx1->text());
|
|
|
|
m_ntx=7;
|
2013-04-10 16:01:17 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2013-04-08 14:31:21 -04:00
|
|
|
if(m_quickCall) {
|
|
|
|
m_auto=true;
|
|
|
|
ui->autoButton->setStyleSheet(m_pbAutoOn_style);
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::genStdMsgs(QString rpt) //genStdMsgs()
|
|
|
|
{
|
2013-07-09 17:19:22 -04:00
|
|
|
QString t;
|
2013-04-08 14:31:21 -04:00
|
|
|
QString hisCall=ui->dxCallEntry->text().toUpper().trimmed();
|
|
|
|
ui->dxCallEntry->setText(hisCall);
|
2013-07-08 15:57:01 -04:00
|
|
|
if(hisCall=="") {
|
|
|
|
ui->labAz->setText("");
|
|
|
|
ui->labDist->setText("");
|
|
|
|
ui->tx1->setText("");
|
|
|
|
ui->tx2->setText("");
|
|
|
|
ui->tx3->setText("");
|
|
|
|
ui->tx4->setText("");
|
|
|
|
ui->tx5->setText("");
|
2013-07-10 09:57:13 -04:00
|
|
|
ui->tx6->setText("");
|
|
|
|
if(m_myCall!="" and m_myGrid!="") {
|
|
|
|
t="CQ " + m_myCall + " " + m_myGrid.mid(0,4);
|
|
|
|
msgtype(t, ui->tx6);
|
|
|
|
}
|
2013-07-08 15:57:01 -04:00
|
|
|
ui->genMsg->setText("");
|
|
|
|
ui->freeTextMsg->setText("");
|
|
|
|
return;
|
|
|
|
}
|
2013-04-08 14:31:21 -04:00
|
|
|
QString hisBase=baseCall(hisCall);
|
|
|
|
QString myBase=baseCall(m_myCall);
|
|
|
|
QString t0=hisBase + " " + myBase + " ";
|
2013-07-09 17:19:22 -04:00
|
|
|
t=t0 + m_myGrid.mid(0,4);
|
2013-04-08 14:31:21 -04:00
|
|
|
if(myBase!=m_myCall) t="DE " + m_myCall + " " + m_myGrid.mid(0,4);
|
2012-05-22 13:09:48 -04:00
|
|
|
msgtype(t, ui->tx1);
|
|
|
|
if(rpt == "") {
|
|
|
|
t=t+" OOO";
|
|
|
|
msgtype(t, ui->tx2);
|
|
|
|
msgtype("RO", ui->tx3);
|
|
|
|
msgtype("RRR", ui->tx4);
|
|
|
|
msgtype("73", ui->tx5);
|
|
|
|
} else {
|
|
|
|
t=t0 + rpt;
|
|
|
|
msgtype(t, ui->tx2);
|
|
|
|
t=t0 + "R" + rpt;
|
|
|
|
msgtype(t, ui->tx3);
|
|
|
|
t=t0 + "RRR";
|
|
|
|
msgtype(t, ui->tx4);
|
|
|
|
t=t0 + "73";
|
2013-04-08 14:31:21 -04:00
|
|
|
if(myBase!=m_myCall) t="DE " + m_myCall + " 73";
|
2012-05-22 13:09:48 -04:00
|
|
|
msgtype(t, ui->tx5);
|
|
|
|
}
|
2012-11-16 11:08:33 -05:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
t="CQ " + m_myCall + " " + m_myGrid.mid(0,4);
|
|
|
|
msgtype(t, ui->tx6);
|
|
|
|
m_ntx=1;
|
|
|
|
ui->txrb1->setChecked(true);
|
2013-04-07 21:50:49 -04:00
|
|
|
m_rpt=rpt;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
2013-04-08 14:31:21 -04:00
|
|
|
QString MainWindow::baseCall(QString t)
|
|
|
|
{
|
|
|
|
int n1=t.indexOf("/");
|
|
|
|
if(n1<0) return t;
|
|
|
|
int n2=t.length()-n1-1;
|
|
|
|
if(n2>=n1) return t.mid(n1+1);
|
|
|
|
return t.mid(0,n1);
|
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
void MainWindow::lookup() //lookup()
|
|
|
|
{
|
2013-04-08 14:31:21 -04:00
|
|
|
QString hisCall=ui->dxCallEntry->text().toUpper().trimmed();
|
|
|
|
ui->dxCallEntry->setText(hisCall);
|
2012-05-22 13:09:48 -04:00
|
|
|
QString call3File = m_appDir + "/CALL3.TXT";
|
|
|
|
QFile f(call3File);
|
|
|
|
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
|
|
msgBox("Cannot open " + call3File);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
char c[132];
|
|
|
|
qint64 n=0;
|
|
|
|
for(int i=0; i<999999; i++) {
|
|
|
|
n=f.readLine(c,sizeof(c));
|
|
|
|
if(n <= 0) {
|
|
|
|
ui->dxGridEntry->setText("");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
QString t=QString(c);
|
2013-04-08 14:31:21 -04:00
|
|
|
if(t.indexOf(hisCall)==0) {
|
2012-05-22 13:09:48 -04:00
|
|
|
int i1=t.indexOf(",");
|
|
|
|
QString hisgrid=t.mid(i1+1,6);
|
|
|
|
i1=hisgrid.indexOf(",");
|
|
|
|
if(i1>0) {
|
|
|
|
hisgrid=hisgrid.mid(0,4);
|
|
|
|
} else {
|
|
|
|
hisgrid=hisgrid.mid(0,4) + hisgrid.mid(4,2).toLower();
|
|
|
|
}
|
|
|
|
ui->dxGridEntry->setText(hisgrid);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_lookupButton_clicked() //Lookup button
|
|
|
|
{
|
|
|
|
lookup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_addButton_clicked() //Add button
|
|
|
|
{
|
2012-10-27 14:06:48 -04:00
|
|
|
if(ui->dxGridEntry->text()=="") {
|
|
|
|
msgBox("Please enter a valid grid locator.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_call3Modified=false;
|
2013-04-08 14:31:21 -04:00
|
|
|
QString hisCall=ui->dxCallEntry->text().toUpper().trimmed();
|
2012-10-27 14:06:48 -04:00
|
|
|
QString hisgrid=ui->dxGridEntry->text().trimmed();
|
2013-04-08 14:31:21 -04:00
|
|
|
QString newEntry=hisCall + "," + hisgrid;
|
2012-10-27 14:06:48 -04:00
|
|
|
|
|
|
|
// int ret = QMessageBox::warning(this, "Add",
|
|
|
|
// newEntry + "\n" + "Is this station known to be active on EME?",
|
|
|
|
// QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
|
// if(ret==QMessageBox::Yes) {
|
|
|
|
// newEntry += ",EME,,";
|
|
|
|
// } else {
|
|
|
|
newEntry += ",,,";
|
|
|
|
// }
|
|
|
|
|
|
|
|
QString call3File = m_appDir + "/CALL3.TXT";
|
|
|
|
QFile f1(call3File);
|
|
|
|
if(!f1.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
|
|
msgBox("Cannot open " + call3File);
|
|
|
|
return;
|
|
|
|
}
|
2013-03-19 09:18:23 -04:00
|
|
|
if(f1.size()==0) {
|
|
|
|
f1.close();
|
|
|
|
f1.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
|
|
QTextStream out(&f1);
|
|
|
|
out << "ZZZZZZ" << endl;
|
|
|
|
f1.close();
|
|
|
|
f1.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
|
|
}
|
2012-10-27 14:06:48 -04:00
|
|
|
QString tmpFile = m_appDir + "/CALL3.TMP";
|
|
|
|
QFile f2(tmpFile);
|
|
|
|
if(!f2.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
msgBox("Cannot open " + tmpFile);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QTextStream in(&f1);
|
|
|
|
QTextStream out(&f2);
|
2013-04-08 14:31:21 -04:00
|
|
|
QString hc=hisCall;
|
2012-10-27 14:06:48 -04:00
|
|
|
QString hc1="";
|
|
|
|
QString hc2="AAAAAA";
|
|
|
|
QString s;
|
|
|
|
do {
|
|
|
|
s=in.readLine();
|
|
|
|
hc1=hc2;
|
|
|
|
if(s.mid(0,2)=="//") {
|
|
|
|
out << s + "\n";
|
|
|
|
} else {
|
|
|
|
int i1=s.indexOf(",");
|
|
|
|
hc2=s.mid(0,i1);
|
|
|
|
if(hc>hc1 && hc<hc2) {
|
|
|
|
out << newEntry + "\n";
|
|
|
|
if(s.mid(0,6)=="ZZZZZZ") {
|
|
|
|
out << s + "\n";
|
2012-11-14 12:02:54 -05:00
|
|
|
// exit; //Statement has no effect!
|
2012-10-27 14:06:48 -04:00
|
|
|
}
|
|
|
|
m_call3Modified=true;
|
|
|
|
} else if(hc==hc2) {
|
|
|
|
QString t=s + "\n\n is already in CALL3.TXT\n" +
|
|
|
|
"Do you wish to replace it?";
|
|
|
|
int ret = QMessageBox::warning(this, "Add",t,
|
|
|
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
|
if(ret==QMessageBox::Yes) {
|
|
|
|
out << newEntry + "\n";
|
|
|
|
m_call3Modified=true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(s!="") out << s + "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while(!s.isNull());
|
|
|
|
|
|
|
|
f1.close();
|
|
|
|
if(hc>hc1 && !m_call3Modified) {
|
|
|
|
out << newEntry + "\n";
|
|
|
|
}
|
|
|
|
if(m_call3Modified) {
|
|
|
|
QFile f0(m_appDir + "/CALL3.OLD");
|
|
|
|
if(f0.exists()) f0.remove();
|
|
|
|
QFile f1(m_appDir + "/CALL3.TXT");
|
|
|
|
f1.rename(m_appDir + "/CALL3.OLD");
|
|
|
|
f2.rename(m_appDir + "/CALL3.TXT");
|
|
|
|
f2.close();
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
2012-11-16 11:42:28 -05:00
|
|
|
void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
|
2012-05-22 13:09:48 -04:00
|
|
|
{
|
|
|
|
char message[23];
|
|
|
|
char msgsent[23];
|
|
|
|
int len1=22;
|
2012-12-11 13:50:07 -05:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
t=t.toUpper();
|
|
|
|
QByteArray s=t.toUpper().toLocal8Bit();
|
|
|
|
ba2msg(s,message);
|
2012-12-11 13:50:07 -05:00
|
|
|
int ichk=1,itext=0;
|
|
|
|
genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1);
|
2012-11-24 12:03:54 -05:00
|
|
|
msgsent[22]=0;
|
|
|
|
bool text=false;
|
2012-12-11 13:50:07 -05:00
|
|
|
if(itext!=0) text=true;
|
2012-11-24 12:03:54 -05:00
|
|
|
QString t1;
|
2013-05-23 15:35:37 -04:00
|
|
|
t1.fromLatin1(msgsent);
|
2012-11-24 12:03:54 -05:00
|
|
|
if(text) t1=t1.mid(0,13);
|
2012-05-22 13:09:48 -04:00
|
|
|
QPalette p(tx->palette());
|
2012-11-24 12:03:54 -05:00
|
|
|
if(text) {
|
2012-05-22 13:09:48 -04:00
|
|
|
p.setColor(QPalette::Base,"#ffccff");
|
|
|
|
} else {
|
|
|
|
p.setColor(QPalette::Base,Qt::white);
|
|
|
|
}
|
|
|
|
tx->setPalette(p);
|
|
|
|
int len=t.length();
|
2012-11-24 12:03:54 -05:00
|
|
|
if(text) {
|
2012-05-22 13:09:48 -04:00
|
|
|
len=qMin(len,13);
|
2012-11-24 12:03:54 -05:00
|
|
|
tx->setText(t.mid(0,len).toUpper());
|
2012-05-22 13:09:48 -04:00
|
|
|
} else {
|
|
|
|
tx->setText(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_tx1_editingFinished() //tx1 edited
|
|
|
|
{
|
|
|
|
QString t=ui->tx1->text();
|
|
|
|
msgtype(t, ui->tx1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_tx2_editingFinished() //tx2 edited
|
|
|
|
{
|
|
|
|
QString t=ui->tx2->text();
|
|
|
|
msgtype(t, ui->tx2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_tx3_editingFinished() //tx3 edited
|
|
|
|
{
|
|
|
|
QString t=ui->tx3->text();
|
|
|
|
msgtype(t, ui->tx3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_tx4_editingFinished() //tx4 edited
|
|
|
|
{
|
|
|
|
QString t=ui->tx4->text();
|
|
|
|
msgtype(t, ui->tx4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_tx5_editingFinished() //tx5 edited
|
|
|
|
{
|
|
|
|
QString t=ui->tx5->text();
|
|
|
|
msgtype(t, ui->tx5);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_tx6_editingFinished() //tx6 edited
|
|
|
|
{
|
|
|
|
QString t=ui->tx6->text();
|
|
|
|
msgtype(t, ui->tx6);
|
2013-07-31 20:49:58 -04:00
|
|
|
|
|
|
|
// G4WJS: disabled setting of snr from msg 6 on live edit, will
|
|
|
|
// still generate noise on next full tx period
|
|
|
|
|
|
|
|
// double snr=t.mid(1,5).toDouble();
|
|
|
|
// if(snr>0.0 or snr < -50.0) snr=99.0;
|
2013-08-07 19:09:13 -04:00
|
|
|
// m_modulator.setTxSNR(snr);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_dxCallEntry_textChanged(const QString &t) //dxCall changed
|
|
|
|
{
|
|
|
|
m_hisCall=t.toUpper().trimmed();
|
|
|
|
ui->dxCallEntry->setText(m_hisCall);
|
2013-03-18 09:24:50 -04:00
|
|
|
statusChanged();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_dxGridEntry_textChanged(const QString &t) //dxGrid changed
|
|
|
|
{
|
|
|
|
int n=t.length();
|
2013-07-08 15:57:01 -04:00
|
|
|
if(n!=4 and n!=6) {
|
|
|
|
ui->labAz->setText("");
|
|
|
|
ui->labDist->setText("");
|
|
|
|
return;
|
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
if(!t[0].isLetter() or !t[1].isLetter()) return;
|
|
|
|
if(!t[2].isDigit() or !t[3].isDigit()) return;
|
|
|
|
if(n==4) m_hisGrid=t.mid(0,2).toUpper() + t.mid(2,2);
|
|
|
|
if(n==6) m_hisGrid=t.mid(0,2).toUpper() + t.mid(2,2) +
|
|
|
|
t.mid(4,2).toLower();
|
|
|
|
ui->dxGridEntry->setText(m_hisGrid);
|
2013-03-23 11:41:31 -04:00
|
|
|
if(gridOK(m_hisGrid)) {
|
|
|
|
qint64 nsec = QDateTime::currentMSecsSinceEpoch() % 86400;
|
|
|
|
double utch=nsec/3600.0;
|
|
|
|
int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
|
|
|
|
|
2013-05-23 15:35:37 -04:00
|
|
|
azdist_(m_myGrid.toLatin1().data(),m_hisGrid.toLatin1().data(),&utch,
|
2013-03-23 11:41:31 -04:00
|
|
|
&nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6);
|
|
|
|
QString t;
|
2013-03-25 07:26:11 -04:00
|
|
|
t.sprintf("Az: %d",nAz);
|
|
|
|
ui->labAz->setText(t);
|
2013-04-03 17:32:21 -04:00
|
|
|
if(m_bMiles) t.sprintf("%d mi",int(0.621371*nDkm));
|
|
|
|
if(!m_bMiles) t.sprintf("%d km",nDkm);
|
2013-03-25 07:26:11 -04:00
|
|
|
ui->labDist->setText(t);
|
2013-03-23 11:41:31 -04:00
|
|
|
} else {
|
2013-03-25 07:26:11 -04:00
|
|
|
ui->labAz->setText("");
|
|
|
|
ui->labDist->setText("");
|
2013-03-23 11:41:31 -04:00
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button
|
|
|
|
{
|
2013-04-08 14:31:21 -04:00
|
|
|
genStdMsgs(m_rpt);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_logQSOButton_clicked() //Log QSO button
|
|
|
|
{
|
2013-03-28 08:05:59 -04:00
|
|
|
if(m_hisCall=="") return;
|
2013-06-06 11:09:49 -04:00
|
|
|
m_dateTimeQSO=QDateTime::currentDateTimeUtc();
|
2013-04-28 09:35:01 -04:00
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
m_logDlg->initLogQSO(m_hisCall,m_hisGrid,m_modeTx,m_rptSent,m_rptRcvd,
|
2013-06-06 14:02:10 -04:00
|
|
|
m_dateTimeQSO,m_dialFreq+m_txFreq/1.0e6,
|
|
|
|
m_myCall,m_myGrid,m_noSuffix,m_toRTTY,m_dBtoComments);
|
2013-04-28 09:35:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::acceptQSO2(bool accepted)
|
|
|
|
{
|
2013-05-29 09:41:57 -04:00
|
|
|
if(accepted) {
|
2013-07-31 07:29:42 -04:00
|
|
|
m_logBook.addAsWorked(m_hisCall);
|
2013-05-29 09:41:57 -04:00
|
|
|
if(m_clearCallGrid) {
|
|
|
|
m_hisCall="";
|
|
|
|
ui->dxCallEntry->setText("");
|
|
|
|
m_hisGrid="";
|
|
|
|
ui->dxGridEntry->setText("");
|
|
|
|
m_rptSent="";
|
|
|
|
m_rptRcvd="";
|
|
|
|
m_qsoStart="";
|
|
|
|
m_qsoStop="";
|
|
|
|
}
|
2013-04-03 17:32:21 -04:00
|
|
|
}
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
2012-09-24 15:11:31 -04:00
|
|
|
|
2012-10-04 17:39:48 -04:00
|
|
|
void MainWindow::on_actionJT9_1_triggered()
|
2012-09-24 15:11:31 -04:00
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
m_mode="JT9";
|
|
|
|
if(m_modeTx!="JT9") on_pbTxMode_clicked();
|
2013-03-18 09:24:50 -04:00
|
|
|
statusChanged();
|
2012-09-24 15:11:31 -04:00
|
|
|
m_TRperiod=60;
|
2012-09-28 19:59:50 -04:00
|
|
|
m_nsps=6912;
|
2013-03-23 14:24:27 -04:00
|
|
|
m_hsymStop=173;
|
2013-08-08 10:26:53 -04:00
|
|
|
lab2->setStyleSheet("QLabel{background-color: #ff6ec7}");
|
|
|
|
lab2->setText(m_mode);
|
2012-10-04 17:39:48 -04:00
|
|
|
ui->actionJT9_1->setChecked(true);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setPeriod(m_TRperiod,m_nsps);
|
|
|
|
m_wideGraph->setMode(m_mode);
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->pbTxMode->setEnabled(false);
|
2012-09-24 15:11:31 -04:00
|
|
|
}
|
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
void MainWindow::on_actionJT65_triggered()
|
2012-09-24 15:11:31 -04:00
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
m_mode="JT65";
|
|
|
|
if(m_modeTx!="JT65") on_pbTxMode_clicked();
|
2013-03-18 09:24:50 -04:00
|
|
|
statusChanged();
|
2013-07-08 09:17:22 -04:00
|
|
|
m_TRperiod=60;
|
|
|
|
m_nsps=6912; //For symspec only
|
|
|
|
m_hsymStop=173;
|
2013-08-08 10:26:53 -04:00
|
|
|
lab2->setStyleSheet("QLabel{background-color: #ffff00}");
|
|
|
|
lab2->setText(m_mode);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->actionJT65->setChecked(true);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setPeriod(m_TRperiod,m_nsps);
|
|
|
|
m_wideGraph->setMode(m_mode);
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->pbTxMode->setEnabled(false);
|
2012-09-24 15:11:31 -04:00
|
|
|
}
|
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
void MainWindow::on_actionJT9_JT65_triggered()
|
2012-09-24 15:11:31 -04:00
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
m_mode="JT9+JT65";
|
|
|
|
// if(m_modeTx!="JT9") on_pbTxMode_clicked();
|
2013-03-18 09:24:50 -04:00
|
|
|
statusChanged();
|
2013-07-08 09:17:22 -04:00
|
|
|
m_TRperiod=60;
|
|
|
|
m_nsps=6912;
|
|
|
|
m_hsymStop=173;
|
2013-08-08 10:26:53 -04:00
|
|
|
lab2->setStyleSheet("QLabel{background-color: #ffa500}");
|
|
|
|
lab2->setText(m_mode);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->actionJT9_JT65->setChecked(true);
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setPeriod(m_TRperiod,m_nsps);
|
|
|
|
m_wideGraph->setMode(m_mode);
|
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui->pbTxMode->setEnabled(true);
|
2012-09-24 15:11:31 -04:00
|
|
|
}
|
2012-09-25 16:26:12 -04:00
|
|
|
|
2012-10-05 15:14:45 -04:00
|
|
|
void MainWindow::on_TxFreqSpinBox_valueChanged(int n)
|
|
|
|
{
|
|
|
|
m_txFreq=n;
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setTxFreq(n);
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_lockTxFreq) ui->RxFreqSpinBox->setValue(n);
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT transmitFrequency (m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0));
|
2012-10-05 15:14:45 -04:00
|
|
|
}
|
2012-10-20 16:52:29 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
void MainWindow::on_RxFreqSpinBox_valueChanged(int n)
|
|
|
|
{
|
|
|
|
m_rxFreq=n;
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setRxFreq(n);
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_lockTxFreq) ui->TxFreqSpinBox->setValue(n);
|
|
|
|
}
|
|
|
|
|
2012-10-31 14:33:56 -04:00
|
|
|
void MainWindow::on_actionQuickDecode_triggered()
|
|
|
|
{
|
|
|
|
m_ndepth=1;
|
|
|
|
ui->actionQuickDecode->setChecked(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionMediumDecode_triggered()
|
|
|
|
{
|
|
|
|
m_ndepth=2;
|
|
|
|
ui->actionMediumDecode->setChecked(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionDeepestDecode_triggered()
|
|
|
|
{
|
|
|
|
m_ndepth=3;
|
|
|
|
ui->actionDeepestDecode->setChecked(true);
|
|
|
|
}
|
2012-11-01 15:54:40 -04:00
|
|
|
|
|
|
|
void MainWindow::on_inGain_valueChanged(int n)
|
|
|
|
{
|
|
|
|
m_inGain=n;
|
|
|
|
}
|
2012-11-24 11:18:49 -05:00
|
|
|
|
|
|
|
void MainWindow::on_actionMonitor_OFF_at_startup_triggered()
|
|
|
|
{
|
|
|
|
m_monitorStartOFF=!m_monitorStartOFF;
|
|
|
|
}
|
2013-03-18 12:14:18 -04:00
|
|
|
|
|
|
|
void MainWindow::on_actionErase_ALL_TXT_triggered() //Erase ALL.TXT
|
|
|
|
{
|
|
|
|
int ret = QMessageBox::warning(this, "Confirm Erase",
|
|
|
|
"Are you sure you want to erase file ALL.TXT ?",
|
|
|
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
|
if(ret==QMessageBox::Yes) {
|
|
|
|
QFile f("ALL.TXT");
|
|
|
|
f.remove();
|
2013-03-18 16:22:51 -04:00
|
|
|
m_RxLog=1;
|
2013-03-18 12:14:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionErase_wsjtx_log_adi_triggered()
|
|
|
|
{
|
|
|
|
int ret = QMessageBox::warning(this, "Confirm Erase",
|
|
|
|
"Are you sure you want to erase file wsjtx_log.adi ?",
|
|
|
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
|
if(ret==QMessageBox::Yes) {
|
|
|
|
QFile f("wsjtx_log.adi");
|
|
|
|
f.remove();
|
|
|
|
}
|
|
|
|
}
|
2013-03-18 18:47:24 -04:00
|
|
|
|
|
|
|
void MainWindow::showMacros(const QPoint &pos)
|
|
|
|
{
|
2013-03-23 11:41:31 -04:00
|
|
|
if(m_macro.length()<10) return;
|
2013-03-18 18:47:24 -04:00
|
|
|
QPoint globalPos = ui->tx5->mapToGlobal(pos);
|
|
|
|
QMenu popupMenu;
|
2013-03-21 18:58:16 -04:00
|
|
|
QAction* popup1 = new QAction(m_macro[0],ui->tx5);
|
|
|
|
QAction* popup2 = new QAction(m_macro[1],ui->tx5);
|
|
|
|
QAction* popup3 = new QAction(m_macro[2],ui->tx5);
|
|
|
|
QAction* popup4 = new QAction(m_macro[3],ui->tx5);
|
|
|
|
QAction* popup5 = new QAction(m_macro[4],ui->tx5);
|
|
|
|
QAction* popup6 = new QAction(m_macro[5],ui->tx5);
|
|
|
|
QAction* popup7 = new QAction(m_macro[6],ui->tx5);
|
|
|
|
QAction* popup8 = new QAction(m_macro[7],ui->tx5);
|
|
|
|
QAction* popup9 = new QAction(m_macro[8],ui->tx5);
|
|
|
|
QAction* popup10 = new QAction(m_macro[9],ui->tx5);
|
|
|
|
|
|
|
|
if(m_macro[0]!="") popupMenu.addAction(popup1);
|
|
|
|
if(m_macro[1]!="") popupMenu.addAction(popup2);
|
|
|
|
if(m_macro[2]!="") popupMenu.addAction(popup3);
|
|
|
|
if(m_macro[3]!="") popupMenu.addAction(popup4);
|
|
|
|
if(m_macro[4]!="") popupMenu.addAction(popup5);
|
|
|
|
if(m_macro[5]!="") popupMenu.addAction(popup6);
|
|
|
|
if(m_macro[6]!="") popupMenu.addAction(popup7);
|
|
|
|
if(m_macro[7]!="") popupMenu.addAction(popup8);
|
|
|
|
if(m_macro[8]!="") popupMenu.addAction(popup9);
|
|
|
|
if(m_macro[9]!="") popupMenu.addAction(popup10);
|
|
|
|
|
2013-03-18 18:47:24 -04:00
|
|
|
connect(popup1,SIGNAL(triggered()), this, SLOT(onPopup1()));
|
|
|
|
connect(popup2,SIGNAL(triggered()), this, SLOT(onPopup2()));
|
2013-03-21 18:58:16 -04:00
|
|
|
connect(popup3,SIGNAL(triggered()), this, SLOT(onPopup3()));
|
|
|
|
connect(popup4,SIGNAL(triggered()), this, SLOT(onPopup4()));
|
|
|
|
connect(popup5,SIGNAL(triggered()), this, SLOT(onPopup5()));
|
|
|
|
connect(popup6,SIGNAL(triggered()), this, SLOT(onPopup6()));
|
|
|
|
connect(popup7,SIGNAL(triggered()), this, SLOT(onPopup7()));
|
|
|
|
connect(popup8,SIGNAL(triggered()), this, SLOT(onPopup8()));
|
|
|
|
connect(popup9,SIGNAL(triggered()), this, SLOT(onPopup9()));
|
|
|
|
connect(popup10,SIGNAL(triggered()), this, SLOT(onPopup10()));
|
2013-03-19 09:18:23 -04:00
|
|
|
popupMenu.exec(globalPos);
|
2013-03-18 18:47:24 -04:00
|
|
|
}
|
|
|
|
|
2013-04-07 21:50:49 -04:00
|
|
|
void MainWindow::onPopup1() { ui->tx5->setText(m_macro[0]); freeText(); }
|
|
|
|
void MainWindow::onPopup2() { ui->tx5->setText(m_macro[1]); freeText(); }
|
|
|
|
void MainWindow::onPopup3() { ui->tx5->setText(m_macro[2]); freeText(); }
|
|
|
|
void MainWindow::onPopup4() { ui->tx5->setText(m_macro[3]); freeText(); }
|
|
|
|
void MainWindow::onPopup5() { ui->tx5->setText(m_macro[4]); freeText(); }
|
|
|
|
void MainWindow::onPopup6() { ui->tx5->setText(m_macro[5]); freeText(); }
|
|
|
|
void MainWindow::onPopup7() { ui->tx5->setText(m_macro[6]); freeText(); }
|
|
|
|
void MainWindow::onPopup8() { ui->tx5->setText(m_macro[7]); freeText(); }
|
|
|
|
void MainWindow::onPopup9() { ui->tx5->setText(m_macro[8]); freeText(); }
|
|
|
|
void MainWindow::onPopup10() { ui->tx5->setText(m_macro[9]); freeText(); }
|
2013-03-18 18:47:24 -04:00
|
|
|
|
2013-04-07 21:50:49 -04:00
|
|
|
void MainWindow::freeText() { ui->freeTextMsg->setText(ui->tx5->text()); }
|
2013-03-19 09:18:23 -04:00
|
|
|
|
|
|
|
bool MainWindow::gridOK(QString g)
|
|
|
|
{
|
|
|
|
bool b=g.mid(0,1).compare("A")>=0 and
|
|
|
|
g.mid(0,1).compare("R")<=0 and
|
|
|
|
g.mid(1,1).compare("A")>=0 and
|
|
|
|
g.mid(1,1).compare("R")<=0 and
|
|
|
|
g.mid(2,1).compare("0")>=0 and
|
|
|
|
g.mid(2,1).compare("9")<=0 and
|
|
|
|
g.mid(3,1).compare("0")>=0 and
|
|
|
|
g.mid(3,1).compare("9")<=0;
|
|
|
|
return b;
|
|
|
|
}
|
2013-03-23 14:24:27 -04:00
|
|
|
|
|
|
|
void MainWindow::on_actionConvert_JT9_x_to_RTTY_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_toRTTY=checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionLog_dB_reports_to_Comments_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_dBtoComments=checked;
|
|
|
|
}
|
2013-03-24 13:29:26 -04:00
|
|
|
|
2013-04-29 19:53:23 -04:00
|
|
|
void MainWindow::on_bandComboBox_activated(int index)
|
2013-03-24 13:29:26 -04:00
|
|
|
{
|
2013-04-30 14:54:11 -04:00
|
|
|
int ret=0;
|
|
|
|
QString rt;
|
|
|
|
|
2013-03-24 13:29:26 -04:00
|
|
|
m_band=index;
|
2013-03-25 16:15:30 -04:00
|
|
|
QString t=m_dFreq[index];
|
|
|
|
m_dialFreq=t.toDouble();
|
2013-07-11 16:41:46 -04:00
|
|
|
if(m_plus2kHz) m_dialFreq+=0.002;
|
2013-03-25 15:48:25 -04:00
|
|
|
dialFreqChanged2(m_dialFreq);
|
2013-04-15 12:06:22 -04:00
|
|
|
m_repeatMsg=0;
|
2013-04-18 06:35:58 -04:00
|
|
|
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
2013-03-24 13:29:26 -04:00
|
|
|
if(m_catEnabled) {
|
2013-04-23 15:16:50 -04:00
|
|
|
if(!m_bRigOpen) {
|
|
|
|
rigOpen();
|
|
|
|
}
|
2013-04-30 14:54:11 -04:00
|
|
|
if(m_bRigOpen) {
|
|
|
|
m_dontReadFreq=true;
|
|
|
|
ret=rig->setFreq(MHz(m_dialFreq));
|
2013-07-08 15:57:01 -04:00
|
|
|
if(m_bSplit or m_bXIT) setXIT(m_txFreq);
|
|
|
|
|
2013-08-10 11:29:55 -04:00
|
|
|
bumpFqso(11);
|
|
|
|
bumpFqso(12);
|
|
|
|
|
2013-04-30 14:54:11 -04:00
|
|
|
if(ret!=RIG_OK) {
|
|
|
|
rt.sprintf("Set rig frequency failed: %d",ret);
|
|
|
|
msgBox(rt);
|
|
|
|
}
|
|
|
|
}
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
2013-04-27 10:21:47 -04:00
|
|
|
QFile f2("ALL.TXT");
|
|
|
|
f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
|
|
|
QTextStream out(&f2);
|
|
|
|
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
|
|
|
<< " " << m_dialFreq << " MHz " << m_mode << endl;
|
|
|
|
f2.close();
|
2013-07-23 06:28:22 -04:00
|
|
|
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
|
2013-03-24 13:29:26 -04:00
|
|
|
}
|
2013-03-26 12:23:40 -04:00
|
|
|
|
|
|
|
void MainWindow::on_actionPrompt_to_log_QSO_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_promptToLog=checked;
|
|
|
|
}
|
2013-04-03 11:35:11 -04:00
|
|
|
|
|
|
|
void MainWindow::on_actionBlank_line_between_decoding_periods_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_insertBlank=checked;
|
|
|
|
}
|
2013-04-03 12:44:31 -04:00
|
|
|
|
2013-07-31 07:29:42 -04:00
|
|
|
void MainWindow::on_actionEnable_DXCC_entity_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_displayDXCCEntity=checked;
|
|
|
|
if (checked)
|
|
|
|
m_logBook.init(); // re-read the log and cty.dat files
|
2013-08-16 06:25:28 -04:00
|
|
|
|
|
|
|
if (checked) // adjust the proportions between the two text displays
|
|
|
|
{
|
|
|
|
ui->gridLayout->setColumnStretch(0,55);
|
|
|
|
ui->gridLayout->setColumnStretch(1,45);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->gridLayout->setColumnStretch(0,0);
|
|
|
|
ui->gridLayout->setColumnStretch(1,0);
|
|
|
|
}
|
2013-07-31 07:29:42 -04:00
|
|
|
}
|
|
|
|
|
2013-04-03 17:32:21 -04:00
|
|
|
void MainWindow::on_actionClear_DX_Call_and_Grid_after_logging_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_clearCallGrid=checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionDisplay_distance_in_miles_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_bMiles=checked;
|
|
|
|
on_dxGridEntry_textChanged(m_hisGrid);
|
|
|
|
}
|
2013-04-07 21:50:49 -04:00
|
|
|
|
|
|
|
void MainWindow::on_pbCallCQ_clicked()
|
|
|
|
{
|
|
|
|
genStdMsgs(m_rpt);
|
|
|
|
ui->genMsg->setText(ui->tx6->text());
|
2013-04-08 14:31:21 -04:00
|
|
|
m_ntx=7;
|
2013-04-08 17:01:30 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
if(m_transmitting) m_restart=true;
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pbAnswerCaller_clicked()
|
|
|
|
{
|
|
|
|
genStdMsgs(m_rpt);
|
|
|
|
ui->genMsg->setText(ui->tx2->text());
|
2013-04-08 14:31:21 -04:00
|
|
|
m_ntx=7;
|
2013-04-08 17:01:30 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
if(m_transmitting) m_restart=true;
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pbSendRRR_clicked()
|
|
|
|
{
|
|
|
|
genStdMsgs(m_rpt);
|
|
|
|
ui->genMsg->setText(ui->tx4->text());
|
2013-04-08 14:31:21 -04:00
|
|
|
m_ntx=7;
|
2013-04-08 17:01:30 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
if(m_transmitting) m_restart=true;
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pbAnswerCQ_clicked()
|
|
|
|
{
|
|
|
|
genStdMsgs(m_rpt);
|
|
|
|
ui->genMsg->setText(ui->tx1->text());
|
2013-04-08 14:31:21 -04:00
|
|
|
m_ntx=7;
|
2013-04-08 17:01:30 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
if(m_transmitting) m_restart=true;
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pbSendReport_clicked()
|
|
|
|
{
|
|
|
|
genStdMsgs(m_rpt);
|
|
|
|
ui->genMsg->setText(ui->tx3->text());
|
2013-04-08 14:31:21 -04:00
|
|
|
m_ntx=7;
|
2013-04-08 17:01:30 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
if(m_transmitting) m_restart=true;
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pbSend73_clicked()
|
|
|
|
{
|
|
|
|
genStdMsgs(m_rpt);
|
|
|
|
ui->genMsg->setText(ui->tx5->text());
|
2013-04-08 14:31:21 -04:00
|
|
|
m_ntx=7;
|
2013-04-08 17:01:30 -04:00
|
|
|
ui->rbGenMsg->setChecked(true);
|
|
|
|
if(m_transmitting) m_restart=true;
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_rbGenMsg_toggled(bool checked)
|
|
|
|
{
|
2013-05-29 09:41:57 -04:00
|
|
|
m_freeText=!checked;
|
|
|
|
if(!m_freeText) {
|
|
|
|
m_ntx=7;
|
|
|
|
if(m_transmitting) m_restart=true;
|
|
|
|
}
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_rbFreeText_toggled(bool checked)
|
|
|
|
{
|
2013-05-29 09:41:57 -04:00
|
|
|
m_freeText=checked;
|
|
|
|
if(m_freeText) {
|
|
|
|
m_ntx=8;
|
|
|
|
if (m_transmitting) m_restart=true;
|
|
|
|
}
|
2013-04-07 21:50:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_freeTextMsg_editingFinished()
|
|
|
|
{
|
|
|
|
QString t=ui->freeTextMsg->text();
|
|
|
|
msgtype(t, ui->freeTextMsg);
|
2013-04-08 14:31:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionDouble_click_on_call_sets_Tx_Enable_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_quickCall=checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_rptSpinBox_valueChanged(int n)
|
|
|
|
{
|
|
|
|
m_rpt=QString::number(n);
|
2013-04-23 20:45:01 -04:00
|
|
|
int ntx0=m_ntx;
|
2013-04-24 12:05:04 -04:00
|
|
|
QString t=ui->tx5->text();
|
2013-04-08 14:31:21 -04:00
|
|
|
genStdMsgs(m_rpt);
|
2013-04-24 12:05:04 -04:00
|
|
|
ui->tx5->setText(t);
|
2013-04-23 20:45:01 -04:00
|
|
|
m_ntx=ntx0;
|
|
|
|
if(m_ntx==1) ui->txrb1->setChecked(true);
|
|
|
|
if(m_ntx==2) ui->txrb2->setChecked(true);
|
|
|
|
if(m_ntx==3) ui->txrb3->setChecked(true);
|
|
|
|
if(m_ntx==4) ui->txrb4->setChecked(true);
|
|
|
|
if(m_ntx==5) ui->txrb5->setChecked(true);
|
|
|
|
if(m_ntx==6) ui->txrb6->setChecked(true);
|
2013-05-08 11:23:02 -04:00
|
|
|
statusChanged();
|
2013-04-23 20:45:01 -04:00
|
|
|
}
|
2013-04-11 12:51:57 -04:00
|
|
|
|
|
|
|
void MainWindow::on_action_73TxDisable_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_73TxDisable=checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionRunaway_Tx_watchdog_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_runaway=checked;
|
|
|
|
}
|
2013-04-12 13:57:20 -04:00
|
|
|
|
2013-04-14 10:11:20 -04:00
|
|
|
void MainWindow::on_tuneButton_clicked()
|
|
|
|
{
|
|
|
|
if(m_tune) {
|
2013-04-17 13:59:28 -04:00
|
|
|
nc1=1; //disable the countdown timer
|
2013-04-25 13:30:20 -04:00
|
|
|
tuneButtonTimer->start(250);
|
2013-04-14 10:11:20 -04:00
|
|
|
} else {
|
2013-04-17 11:53:43 -04:00
|
|
|
m_tune=true;
|
2013-04-18 06:35:58 -04:00
|
|
|
m_sent73=false;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT tune ();
|
2013-04-17 11:53:43 -04:00
|
|
|
m_repeatMsg=0;
|
|
|
|
ui->tuneButton->setStyleSheet(m_pbTune_style);
|
2013-04-14 10:11:20 -04:00
|
|
|
}
|
|
|
|
}
|
2013-04-17 11:53:43 -04:00
|
|
|
|
|
|
|
void MainWindow::on_stopTxButton_clicked() //Stop Tx
|
|
|
|
{
|
|
|
|
if(m_tune) {
|
2013-04-25 13:30:20 -04:00
|
|
|
m_tune=false;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT tune (m_tune);
|
2013-04-17 11:53:43 -04:00
|
|
|
}
|
|
|
|
if(m_auto) on_autoButton_clicked();
|
2013-07-31 20:49:58 -04:00
|
|
|
m_btxok=false;
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT muteAudioOutput ();
|
2013-04-17 11:53:43 -04:00
|
|
|
m_repeatMsg=0;
|
|
|
|
ui->tuneButton->setStyleSheet("");
|
|
|
|
}
|
2013-04-22 20:52:51 -04:00
|
|
|
|
|
|
|
void MainWindow::rigOpen()
|
|
|
|
{
|
2013-04-30 14:54:11 -04:00
|
|
|
QString t;
|
|
|
|
int ret;
|
2013-05-01 08:21:19 -04:00
|
|
|
rig = new Rig();
|
2013-05-21 16:49:40 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_rig<9900) {
|
2013-05-21 15:49:41 -04:00
|
|
|
if (!rig->init(m_rig)) {
|
2013-05-01 08:21:19 -04:00
|
|
|
msgBox("Rig init failure");
|
|
|
|
return;
|
2013-05-21 15:49:41 -04:00
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
QString sCATport=m_catPort;
|
|
|
|
#ifdef WIN32
|
|
|
|
sCATport="\\\\.\\" + m_catPort; //Allow COM ports above 9
|
|
|
|
#endif
|
|
|
|
rig->setConf("rig_pathname", sCATport.toLatin1().data());
|
2013-05-21 16:49:40 -04:00
|
|
|
char buf[80];
|
|
|
|
sprintf(buf,"%d",m_serialRate);
|
|
|
|
rig->setConf("serial_speed",buf);
|
|
|
|
sprintf(buf,"%d",m_dataBits);
|
|
|
|
rig->setConf("data_bits",buf);
|
|
|
|
sprintf(buf,"%d",m_stopBits);
|
|
|
|
rig->setConf("stop_bits",buf);
|
2013-05-23 15:35:37 -04:00
|
|
|
rig->setConf("serial_handshake",m_handshake.toLatin1().data());
|
2013-07-23 13:32:59 -04:00
|
|
|
if(m_handshakeIndex != 2) {
|
|
|
|
rig->setConf("rts_state",m_bRTS ? "ON" : "OFF");
|
|
|
|
rig->setConf("dtr_state",m_bDTR ? "ON" : "OFF");
|
2013-05-21 16:49:40 -04:00
|
|
|
}
|
2013-05-01 08:21:19 -04:00
|
|
|
}
|
|
|
|
|
2013-05-21 15:49:41 -04:00
|
|
|
ret=rig->open(m_rig);
|
2013-04-30 14:54:11 -04:00
|
|
|
if(ret==RIG_OK) {
|
2013-04-22 20:52:51 -04:00
|
|
|
m_bRigOpen=true;
|
2013-07-23 13:32:59 -04:00
|
|
|
m_bad=0;
|
2013-05-03 20:12:27 -04:00
|
|
|
if(m_poll==0) ui->readFreq->setEnabled(true);
|
2013-07-08 09:17:22 -04:00
|
|
|
m_CATerror=false;
|
2013-04-30 14:54:11 -04:00
|
|
|
} else {
|
|
|
|
t="Open rig failed";
|
|
|
|
msgBox(t);
|
2013-05-08 11:23:02 -04:00
|
|
|
m_catEnabled=false;
|
|
|
|
m_bRigOpen=false;
|
2013-07-08 09:17:22 -04:00
|
|
|
m_CATerror=true;
|
2013-04-22 20:52:51 -04:00
|
|
|
}
|
2013-04-30 14:54:11 -04:00
|
|
|
|
2013-05-08 11:23:02 -04:00
|
|
|
if(m_bRigOpen) {
|
2013-07-27 12:15:24 -04:00
|
|
|
if(m_poll>0) {
|
|
|
|
ui->readFreq->setStyleSheet("QPushButton{background-color: #00ff00; \
|
|
|
|
border-width: 0px; border-radius: 5px;}");
|
|
|
|
} else {
|
|
|
|
ui->readFreq->setStyleSheet("QPushButton{background-color: orange; \
|
|
|
|
border-width: 0px; border-radius: 5px;}");
|
2013-08-05 09:57:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if(m_bSplit) ui->readFreq->setText("S");
|
|
|
|
if(!m_bSplit) ui->readFreq->setText("");
|
|
|
|
} else {
|
|
|
|
if(m_CATerror) ui->readFreq->setStyleSheet("QPushButton{background-color: red; \
|
2013-07-27 12:15:24 -04:00
|
|
|
border-width: 0px; border-radius: 5px;}");
|
2013-08-05 09:57:55 -04:00
|
|
|
if(!m_CATerror) ui->readFreq->setStyleSheet("");
|
|
|
|
ui->readFreq->setText("");
|
|
|
|
}
|
2013-04-22 20:52:51 -04:00
|
|
|
}
|
2013-04-24 11:00:30 -04:00
|
|
|
|
|
|
|
void MainWindow::on_actionAllow_multiple_instances_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_bMultipleOK=checked;
|
|
|
|
}
|
2013-04-24 12:05:04 -04:00
|
|
|
|
|
|
|
void MainWindow::on_pbR2T_clicked()
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
int n=m_wideGraph->rxFreq();
|
2013-04-24 12:05:04 -04:00
|
|
|
ui->TxFreqSpinBox->setValue(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pbT2R_clicked()
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setRxFreq(m_txFreq);
|
2013-04-24 12:05:04 -04:00
|
|
|
}
|
2013-04-29 19:53:23 -04:00
|
|
|
|
2013-05-03 20:12:27 -04:00
|
|
|
|
|
|
|
void MainWindow::on_readFreq_clicked()
|
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_transmitting) return;
|
2013-05-07 12:35:50 -04:00
|
|
|
m_dontReadFreq=false;
|
|
|
|
double fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
|
|
|
|
if(fMHz<0.0) {
|
|
|
|
QString rt;
|
|
|
|
rt.sprintf("Rig control error %d\nFailed to read frequency.",
|
|
|
|
int(1000000.0*fMHz));
|
|
|
|
msgBox(rt);
|
|
|
|
m_catEnabled=false;
|
|
|
|
}
|
|
|
|
if(fMHz<0.01 or fMHz>1300.0) fMHz=0;
|
|
|
|
int ndiff=1000000.0*(fMHz-m_dialFreq);
|
|
|
|
if(ndiff!=0) dialFreqChanged2(fMHz);
|
2013-05-03 20:12:27 -04:00
|
|
|
}
|
2013-05-07 12:35:50 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
void MainWindow::on_pbTxMode_clicked()
|
|
|
|
{
|
|
|
|
if(m_modeTx=="JT9") {
|
|
|
|
m_modeTx="JT65";
|
2013-07-08 15:57:01 -04:00
|
|
|
ui->pbTxMode->setText("Tx JT65 #");
|
2013-07-08 09:17:22 -04:00
|
|
|
} else {
|
|
|
|
m_modeTx="JT9";
|
2013-07-08 15:57:01 -04:00
|
|
|
ui->pbTxMode->setText("Tx JT9 @");
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setModeTx(m_modeTx);
|
2013-07-08 19:08:25 -04:00
|
|
|
statusChanged();
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::setXIT(int n)
|
|
|
|
{
|
|
|
|
int ret;
|
2013-07-31 20:49:58 -04:00
|
|
|
m_XIT = 0;
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_bRigOpen) {
|
2013-08-08 10:26:53 -04:00
|
|
|
m_XIT=(n/500)*500 - 1500;
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_bXIT) {
|
2013-07-31 20:49:58 -04:00
|
|
|
ret=rig->setXit((shortfreq_t)m_XIT,RIG_VFO_TX);
|
2013-07-09 12:05:23 -04:00
|
|
|
if(ret!=RIG_OK) {
|
|
|
|
QString rt;
|
|
|
|
rt.sprintf("Setting RIG_VFO_TX failed: %d",ret);
|
|
|
|
msgBox(rt);
|
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
2013-07-09 18:41:15 -04:00
|
|
|
if(m_bSplit) {
|
2013-07-31 20:49:58 -04:00
|
|
|
ret=rig->setSplitFreq(MHz(m_dialFreq)+m_XIT,RIG_VFO_B);
|
2013-07-09 18:41:15 -04:00
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
2013-08-07 19:09:13 -04:00
|
|
|
Q_EMIT transmitFrequency (m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0));
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::setFreq4(int rxFreq, int txFreq)
|
|
|
|
{
|
|
|
|
m_rxFreq=rxFreq;
|
|
|
|
m_txFreq=txFreq;
|
|
|
|
ui->RxFreqSpinBox->setValue(m_rxFreq);
|
|
|
|
ui->TxFreqSpinBox->setValue(m_txFreq);
|
|
|
|
}
|
2013-05-28 15:34:18 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
void MainWindow::on_cbTxLock_clicked(bool checked)
|
2013-05-28 15:34:18 -04:00
|
|
|
{
|
|
|
|
m_lockTxFreq=checked;
|
2013-08-10 11:29:55 -04:00
|
|
|
m_wideGraph->setLockTxFreq(m_lockTxFreq);
|
2013-07-08 09:17:22 -04:00
|
|
|
if(m_lockTxFreq) on_pbR2T_clicked();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionTx2QSO_triggered(bool checked)
|
|
|
|
{
|
|
|
|
m_tx2QSO=checked;
|
2013-05-28 15:34:18 -04:00
|
|
|
}
|
2013-07-11 16:41:46 -04:00
|
|
|
|
|
|
|
void MainWindow::on_cbPlus2kHz_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_plus2kHz=checked;
|
|
|
|
on_bandComboBox_activated(m_band);
|
|
|
|
}
|
2013-07-23 13:32:59 -04:00
|
|
|
|
|
|
|
void MainWindow::pollRigFreq()
|
|
|
|
{
|
|
|
|
double fMHz;
|
|
|
|
if(m_dontReadFreq) {
|
|
|
|
m_dontReadFreq=false;
|
|
|
|
} else if(!m_transmitting) {
|
|
|
|
fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
|
|
|
|
if(fMHz<0.0) {
|
|
|
|
m_bad++;
|
|
|
|
if(m_bad>=20) {
|
|
|
|
QString rt;
|
|
|
|
rt.sprintf("Rig control error %d\nFailed to read frequency.",
|
|
|
|
int(1000000.0*fMHz));
|
|
|
|
msgBox(rt);
|
|
|
|
m_catEnabled=false;
|
|
|
|
ui->readFreq->setStyleSheet("QPushButton{background-color: red; \
|
|
|
|
border-width: 0px; border-radius: 5px;}");
|
2013-08-05 09:57:55 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int ndiff=1000000.0*(fMHz-m_dialFreq);
|
|
|
|
if(ndiff!=0) dialFreqChanged2(fMHz);
|
2013-07-23 13:32:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-05 09:57:55 -04:00
|
|
|
|
|
|
|
void MainWindow::transmit (double snr)
|
|
|
|
{
|
|
|
|
if (m_modeTx == "JT65")
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), m_audioOutputChannel, true, snr);
|
2013-08-05 09:57:55 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-08-10 11:29:55 -04:00
|
|
|
Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), m_audioOutputChannel, true, snr);
|
2013-08-05 09:57:55 -04:00
|
|
|
}
|
2013-08-10 11:29:55 -04:00
|
|
|
Q_EMIT startAudioOutputStream (m_audioOutputDevice, AudioDevice::Mono == m_audioOutputChannel ? 1 : 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_outAttenuation_valueChanged (int a)
|
|
|
|
{
|
|
|
|
qreal dBAttn (a / 10.); // slider interpreted as hundredths of a dB
|
|
|
|
ui->outAttenuation->setToolTip (tr ("Transmit digital gain ") + (a ? QString::number (-dBAttn, 'f', 1) : "0") + "dB");
|
|
|
|
Q_EMIT outAttenuationChanged (dBAttn);
|
2013-07-23 13:32:59 -04:00
|
|
|
}
|