2012-05-22 13:09:48 -04:00
|
|
|
#include "devsetup.h"
|
|
|
|
#include <QDebug>
|
2013-07-08 09:17:22 -04:00
|
|
|
#include <QSettings>
|
2012-05-22 13:09:48 -04:00
|
|
|
#include <portaudio.h>
|
2013-07-29 20:51:42 -04:00
|
|
|
#include <QAudioDeviceInfo>
|
|
|
|
#include <QAudioInput>
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
#define MAXDEVICES 100
|
|
|
|
|
2013-03-25 15:13:49 -04:00
|
|
|
extern double dFreq[16];
|
2013-07-08 09:17:22 -04:00
|
|
|
qint32 g2_iptt;
|
|
|
|
qint32 g2_COMportOpen;
|
2013-03-25 15:13:49 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
//----------------------------------------------------------- DevSetup()
|
|
|
|
DevSetup::DevSetup(QWidget *parent) : QDialog(parent)
|
|
|
|
{
|
2012-11-12 11:33:45 -05:00
|
|
|
ui.setupUi(this); //setup the dialog form
|
2012-05-22 13:09:48 -04:00
|
|
|
m_restartSoundIn=false;
|
|
|
|
m_restartSoundOut=false;
|
2013-03-13 14:47:34 -04:00
|
|
|
m_firstCall=true;
|
2013-07-08 09:17:22 -04:00
|
|
|
g2_iptt=0;
|
2013-04-24 13:55:33 -04:00
|
|
|
m_test=0;
|
2013-04-23 16:46:04 -04:00
|
|
|
m_bRigOpen=false;
|
2013-07-08 09:17:22 -04:00
|
|
|
g2_COMportOpen=0;
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
DevSetup::~DevSetup()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::initDlg()
|
|
|
|
{
|
2013-07-08 09:17:22 -04:00
|
|
|
QString m_appDir = QApplication::applicationDirPath();
|
|
|
|
QString inifile = m_appDir + "/wsjtx.ini";
|
|
|
|
QSettings settings(inifile, QSettings::IniFormat);
|
|
|
|
settings.beginGroup("Common");
|
|
|
|
QString catPortDriver = settings.value("CATdriver","None").toString();
|
|
|
|
settings.endGroup();
|
|
|
|
|
2013-07-29 20:51:42 -04:00
|
|
|
/*
|
|
|
|
QList<QAudioDeviceInfo> InDevices;
|
|
|
|
QList<QAudioDeviceInfo> OutDevices;
|
|
|
|
QAudioDeviceInfo deviceInfo;
|
|
|
|
|
|
|
|
InDevices = deviceInfo.availableDevices(QAudio::AudioInput);
|
|
|
|
OutDevices = deviceInfo.availableDevices(QAudio::AudioOutput);
|
|
|
|
|
|
|
|
foreach (const QAudioDeviceInfo &deviceInfo, InDevices) {
|
|
|
|
ui.comboBoxSndIn->addItem(deviceInfo.deviceName(),
|
|
|
|
qVariantFromValue(deviceInfo));
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (const QAudioDeviceInfo &deviceInfo, OutDevices) {
|
|
|
|
ui.comboBoxSndOut->addItem(deviceInfo.deviceName(),
|
|
|
|
qVariantFromValue(deviceInfo));
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
int k,id;
|
|
|
|
int numDevices=Pa_GetDeviceCount();
|
2012-07-02 13:22:11 -04:00
|
|
|
|
|
|
|
const PaDeviceInfo *pdi;
|
|
|
|
int nchin;
|
|
|
|
int nchout;
|
|
|
|
char pa_device_name[128];
|
|
|
|
char pa_device_hostapi[128];
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
k=0;
|
|
|
|
for(id=0; id<numDevices; id++ ) {
|
|
|
|
pdi=Pa_GetDeviceInfo(id);
|
2012-07-02 13:22:11 -04:00
|
|
|
nchin=pdi->maxInputChannels;
|
2012-11-12 11:33:45 -05:00
|
|
|
if(nchin>0) {
|
2012-07-02 13:22:11 -04:00
|
|
|
m_inDevList[k]=id;
|
2013-07-08 09:17:22 -04:00
|
|
|
if (id == m_paInDevice)
|
|
|
|
m_nDevIn = k;
|
2012-07-02 13:22:11 -04:00
|
|
|
k++;
|
|
|
|
sprintf((char*)(pa_device_name),"%s",pdi->name);
|
|
|
|
sprintf((char*)(pa_device_hostapi),"%s",
|
|
|
|
Pa_GetHostApiInfo(pdi->hostApi)->name);
|
|
|
|
|
2013-03-21 10:14:26 -04:00
|
|
|
#ifdef WIN32
|
2013-05-29 09:41:57 -04:00
|
|
|
char *p,*p1;
|
|
|
|
char p2[50];
|
2012-07-02 13:22:11 -04:00
|
|
|
p1=(char*)"";
|
|
|
|
p=strstr(pa_device_hostapi,"MME");
|
|
|
|
if(p!=NULL) p1=(char*)"MME";
|
|
|
|
p=strstr(pa_device_hostapi,"Direct");
|
|
|
|
if(p!=NULL) p1=(char*)"DirectX";
|
|
|
|
p=strstr(pa_device_hostapi,"WASAPI");
|
|
|
|
if(p!=NULL) p1=(char*)"WASAPI";
|
|
|
|
p=strstr(pa_device_hostapi,"ASIO");
|
|
|
|
if(p!=NULL) p1=(char*)"ASIO";
|
|
|
|
p=strstr(pa_device_hostapi,"WDM-KS");
|
|
|
|
if(p!=NULL) p1=(char*)"WDM-KS";
|
|
|
|
|
2012-11-12 11:33:45 -05:00
|
|
|
sprintf(p2,"%2d %d %-8s %-39s",id,nchin,p1,pa_device_name);
|
2012-07-02 13:22:11 -04:00
|
|
|
QString t(p2);
|
2013-03-21 10:14:26 -04:00
|
|
|
#else
|
|
|
|
QString t;
|
2013-05-28 15:16:25 -04:00
|
|
|
t.sprintf("%2d %d %-8s %-39s",id,nchin,
|
|
|
|
Pa_GetHostApiInfo(pdi->hostApi)->name,pdi->name);
|
2013-03-21 10:14:26 -04:00
|
|
|
#endif
|
2012-07-02 13:22:11 -04:00
|
|
|
ui.comboBoxSndIn->addItem(t);
|
|
|
|
}
|
2012-07-04 10:40:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
k=0;
|
|
|
|
for(id=0; id<numDevices; id++ ) {
|
|
|
|
pdi=Pa_GetDeviceInfo(id);
|
2012-05-22 13:09:48 -04:00
|
|
|
nchout=pdi->maxOutputChannels;
|
2012-11-12 11:33:45 -05:00
|
|
|
if(nchout>0) {
|
2012-05-22 13:09:48 -04:00
|
|
|
m_outDevList[k]=id;
|
2013-07-08 09:17:22 -04:00
|
|
|
if (id == m_paOutDevice)
|
|
|
|
m_nDevOut = k;
|
2012-05-22 13:09:48 -04:00
|
|
|
k++;
|
|
|
|
sprintf((char*)(pa_device_name),"%s",pdi->name);
|
|
|
|
sprintf((char*)(pa_device_hostapi),"%s",
|
|
|
|
Pa_GetHostApiInfo(pdi->hostApi)->name);
|
|
|
|
|
2012-11-16 10:57:42 -05:00
|
|
|
#ifdef WIN32
|
2013-05-29 11:09:04 -04:00
|
|
|
char *p,*p1;
|
|
|
|
char p2[50];
|
2012-05-22 13:09:48 -04:00
|
|
|
p1=(char*)"";
|
2013-05-28 15:34:18 -04:00
|
|
|
p=strstr(pa_device_hostapi,"MME");
|
2012-05-22 13:09:48 -04:00
|
|
|
if(p!=NULL) p1=(char*)"MME";
|
|
|
|
p=strstr(pa_device_hostapi,"Direct");
|
|
|
|
if(p!=NULL) p1=(char*)"DirectX";
|
|
|
|
p=strstr(pa_device_hostapi,"WASAPI");
|
|
|
|
if(p!=NULL) p1=(char*)"WASAPI";
|
|
|
|
p=strstr(pa_device_hostapi,"ASIO");
|
|
|
|
if(p!=NULL) p1=(char*)"ASIO";
|
|
|
|
p=strstr(pa_device_hostapi,"WDM-KS");
|
|
|
|
if(p!=NULL) p1=(char*)"WDM-KS";
|
2012-11-12 11:33:45 -05:00
|
|
|
sprintf(p2,"%2d %d %-8s %-39s",id,nchout,p1,pa_device_name);
|
2012-05-22 13:09:48 -04:00
|
|
|
QString t(p2);
|
2013-03-21 10:14:26 -04:00
|
|
|
#else
|
|
|
|
QString t;
|
2013-05-28 15:16:25 -04:00
|
|
|
t.sprintf("%2d %d %-8s %-39s",id,nchout,
|
|
|
|
Pa_GetHostApiInfo(pdi->hostApi)->name,pdi->name);
|
2012-11-16 10:57:42 -05:00
|
|
|
#endif
|
2013-03-21 10:14:26 -04:00
|
|
|
ui.comboBoxSndOut->addItem(t);
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-24 08:55:13 -04:00
|
|
|
connect(&p4, SIGNAL(readyReadStandardOutput()),
|
|
|
|
this, SLOT(p4ReadFromStdout()));
|
|
|
|
connect(&p4, SIGNAL(readyReadStandardError()),
|
|
|
|
this, SLOT(p4ReadFromStderr()));
|
|
|
|
connect(&p4, SIGNAL(error(QProcess::ProcessError)),
|
|
|
|
this, SLOT(p4Error()));
|
|
|
|
p4.start("rigctl -l");
|
|
|
|
p4.waitForFinished(1000);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui.rigComboBox->addItem(" 9998 Commander");
|
2013-05-21 15:49:41 -04:00
|
|
|
ui.rigComboBox->addItem(" 9999 Ham Radio Deluxe");
|
2013-03-24 08:55:13 -04:00
|
|
|
|
2013-04-25 13:30:20 -04:00
|
|
|
QPalette pal(ui.myCallEntry->palette());
|
|
|
|
if(m_myCall=="") {
|
|
|
|
pal.setColor(QPalette::Base,"#ffccff");
|
|
|
|
} else {
|
|
|
|
pal.setColor(QPalette::Base,Qt::white);
|
|
|
|
}
|
|
|
|
ui.myCallEntry->setPalette(pal);
|
|
|
|
ui.myGridEntry->setPalette(pal);
|
2012-05-22 13:09:48 -04:00
|
|
|
ui.myCallEntry->setText(m_myCall);
|
|
|
|
ui.myGridEntry->setText(m_myGrid);
|
2013-04-25 13:30:20 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
ui.idIntSpinBox->setValue(m_idInt);
|
2013-03-24 08:55:13 -04:00
|
|
|
ui.pttMethodComboBox->setCurrentIndex(m_pttMethodIndex);
|
2012-05-22 13:09:48 -04:00
|
|
|
ui.saveDirEntry->setText(m_saveDir);
|
|
|
|
ui.comboBoxSndIn->setCurrentIndex(m_nDevIn);
|
|
|
|
ui.comboBoxSndOut->setCurrentIndex(m_nDevOut);
|
2013-03-24 21:24:47 -04:00
|
|
|
ui.cbID73->setChecked(m_After73);
|
2013-03-09 21:45:12 -05:00
|
|
|
ui.cbPSKReporter->setChecked(m_pskReporter);
|
2013-07-09 11:44:33 -04:00
|
|
|
ui.cbSplit->setChecked(m_bSplit and m_catEnabled);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui.cbXIT->setChecked(m_bXIT);
|
|
|
|
ui.cbXIT->setVisible(false);
|
2013-05-21 20:31:53 -04:00
|
|
|
|
|
|
|
enableWidgets();
|
|
|
|
|
2013-03-24 08:55:13 -04:00
|
|
|
ui.rigComboBox->setCurrentIndex(m_rigIndex);
|
|
|
|
ui.catPortComboBox->setCurrentIndex(m_catPortIndex);
|
|
|
|
ui.serialRateComboBox->setCurrentIndex(m_serialRateIndex);
|
|
|
|
ui.dataBitsComboBox->setCurrentIndex(m_dataBitsIndex);
|
|
|
|
ui.stopBitsComboBox->setCurrentIndex(m_stopBitsIndex);
|
|
|
|
ui.handshakeComboBox->setCurrentIndex(m_handshakeIndex);
|
2013-04-25 18:57:08 -04:00
|
|
|
ui.rbData->setChecked(m_pttData);
|
2013-04-30 10:34:45 -04:00
|
|
|
ui.pollSpinBox->setValue(m_poll);
|
2013-03-22 15:57:32 -04:00
|
|
|
|
2013-03-25 16:42:25 -04:00
|
|
|
// PY2SDR -- Per OS serial port names
|
2013-05-20 14:33:06 -04:00
|
|
|
m_tmp=m_pttPort;
|
|
|
|
ui.pttComboBox->clear();
|
2013-03-25 16:42:25 -04:00
|
|
|
ui.catPortComboBox->clear();
|
2013-05-20 14:33:06 -04:00
|
|
|
ui.pttComboBox->addItem("None");
|
2013-03-25 16:42:25 -04:00
|
|
|
ui.catPortComboBox->addItem("None");
|
|
|
|
#ifdef WIN32
|
|
|
|
for ( int i = 1; i < 100; i++ ) {
|
2013-05-20 14:33:06 -04:00
|
|
|
ui.pttComboBox->addItem("COM" + QString::number(i));
|
2013-03-25 16:42:25 -04:00
|
|
|
ui.catPortComboBox->addItem("COM" + QString::number(i));
|
|
|
|
}
|
2013-05-20 14:33:06 -04:00
|
|
|
ui.pttComboBox->addItem("USB");
|
2013-03-25 16:42:25 -04:00
|
|
|
ui.catPortComboBox->addItem("USB");
|
|
|
|
#else
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS0");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS1");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS2");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS3");
|
2013-06-05 17:19:29 -04:00
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS4");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS5");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS6");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyS7");
|
2013-03-25 16:42:25 -04:00
|
|
|
ui.catPortComboBox->addItem("/dev/ttyUSB0");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyUSB1");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyUSB2");
|
|
|
|
ui.catPortComboBox->addItem("/dev/ttyUSB3");
|
2013-07-08 09:17:22 -04:00
|
|
|
ui.catPortComboBox->addItem(catPortDriver);
|
2013-05-20 14:33:06 -04:00
|
|
|
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS0");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS1");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS2");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS3");
|
2013-06-05 17:19:29 -04:00
|
|
|
ui.pttComboBox->addItem("/dev/ttyS4");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS5");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS6");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyS7");
|
2013-05-20 14:33:06 -04:00
|
|
|
ui.pttComboBox->addItem("/dev/ttyUSB0");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyUSB1");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyUSB2");
|
|
|
|
ui.pttComboBox->addItem("/dev/ttyUSB3");
|
2013-03-25 16:42:25 -04:00
|
|
|
#endif
|
2013-05-20 14:33:06 -04:00
|
|
|
ui.pttComboBox->setCurrentIndex(m_tmp);
|
2013-03-25 16:42:25 -04:00
|
|
|
ui.catPortComboBox->setCurrentIndex(m_catPortIndex);
|
|
|
|
|
2013-05-22 13:35:52 -04:00
|
|
|
int n=m_macro.length();
|
|
|
|
if(n>=1) ui.macro1->setText(m_macro[0].toUpper());
|
|
|
|
if(n>=2) ui.macro2->setText(m_macro[1].toUpper());
|
|
|
|
if(n>=3) ui.macro3->setText(m_macro[2].toUpper());
|
|
|
|
if(n>=4) ui.macro4->setText(m_macro[3].toUpper());
|
|
|
|
if(n>=5) ui.macro5->setText(m_macro[4].toUpper());
|
|
|
|
if(n>=6) ui.macro6->setText(m_macro[5].toUpper());
|
|
|
|
if(n>=7) ui.macro7->setText(m_macro[6].toUpper());
|
|
|
|
if(n>=8) ui.macro8->setText(m_macro[7].toUpper());
|
|
|
|
if(n>=8) ui.macro9->setText(m_macro[8].toUpper());
|
|
|
|
if(n>=10) ui.macro10->setText(m_macro[9].toUpper());
|
2013-03-21 18:58:16 -04:00
|
|
|
|
2013-03-25 15:13:49 -04:00
|
|
|
ui.f1->setText(m_dFreq[0]);
|
|
|
|
ui.f2->setText(m_dFreq[1]);
|
|
|
|
ui.f3->setText(m_dFreq[2]);
|
|
|
|
ui.f4->setText(m_dFreq[3]);
|
|
|
|
ui.f5->setText(m_dFreq[4]);
|
|
|
|
ui.f6->setText(m_dFreq[5]);
|
|
|
|
ui.f7->setText(m_dFreq[6]);
|
|
|
|
ui.f8->setText(m_dFreq[7]);
|
|
|
|
ui.f9->setText(m_dFreq[8]);
|
|
|
|
ui.f10->setText(m_dFreq[9]);
|
|
|
|
ui.f11->setText(m_dFreq[10]);
|
|
|
|
ui.f12->setText(m_dFreq[11]);
|
|
|
|
ui.f13->setText(m_dFreq[12]);
|
|
|
|
ui.f14->setText(m_dFreq[13]);
|
|
|
|
ui.f15->setText(m_dFreq[14]);
|
|
|
|
ui.f16->setText(m_dFreq[15]);
|
2013-07-23 06:28:22 -04:00
|
|
|
|
|
|
|
ui.AntDescription1->setText(m_antDescription[0]);
|
|
|
|
ui.AntDescription2->setText(m_antDescription[1]);
|
|
|
|
ui.AntDescription3->setText(m_antDescription[2]);
|
|
|
|
ui.AntDescription4->setText(m_antDescription[3]);
|
|
|
|
ui.AntDescription5->setText(m_antDescription[4]);
|
|
|
|
ui.AntDescription6->setText(m_antDescription[5]);
|
|
|
|
ui.AntDescription7->setText(m_antDescription[6]);
|
|
|
|
ui.AntDescription8->setText(m_antDescription[7]);
|
|
|
|
ui.AntDescription9->setText(m_antDescription[8]);
|
|
|
|
ui.AntDescription10->setText(m_antDescription[9]);
|
|
|
|
ui.AntDescription11->setText(m_antDescription[10]);
|
|
|
|
ui.AntDescription12->setText(m_antDescription[11]);
|
|
|
|
ui.AntDescription13->setText(m_antDescription[12]);
|
|
|
|
ui.AntDescription14->setText(m_antDescription[13]);
|
|
|
|
ui.AntDescription15->setText(m_antDescription[14]);
|
|
|
|
ui.AntDescription16->setText(m_antDescription[15]);
|
|
|
|
|
|
|
|
ui.Band1->setText(m_bandDescription[0]);
|
|
|
|
ui.Band2->setText(m_bandDescription[1]);
|
|
|
|
ui.Band3->setText(m_bandDescription[2]);
|
|
|
|
ui.Band4->setText(m_bandDescription[3]);
|
|
|
|
ui.Band5->setText(m_bandDescription[4]);
|
|
|
|
ui.Band6->setText(m_bandDescription[5]);
|
|
|
|
ui.Band7->setText(m_bandDescription[6]);
|
|
|
|
ui.Band8->setText(m_bandDescription[7]);
|
|
|
|
ui.Band9->setText(m_bandDescription[8]);
|
|
|
|
ui.Band10->setText(m_bandDescription[9]);
|
|
|
|
ui.Band11->setText(m_bandDescription[10]);
|
|
|
|
ui.Band12->setText(m_bandDescription[11]);
|
|
|
|
ui.Band13->setText(m_bandDescription[12]);
|
|
|
|
ui.Band14->setText(m_bandDescription[13]);
|
|
|
|
ui.Band15->setText(m_bandDescription[14]);
|
|
|
|
ui.Band16->setText(m_bandDescription[15]);
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------- accept()
|
|
|
|
void DevSetup::accept()
|
|
|
|
{
|
|
|
|
// Called when OK button is clicked.
|
|
|
|
// Check to see whether SoundInThread must be restarted,
|
|
|
|
// and save user parameters.
|
|
|
|
|
2012-07-02 12:13:21 -04:00
|
|
|
if(m_nDevIn!=ui.comboBoxSndIn->currentIndex() or
|
|
|
|
m_paInDevice!=m_inDevList[m_nDevIn]) m_restartSoundIn=true;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
if(m_nDevOut!=ui.comboBoxSndOut->currentIndex() or
|
|
|
|
m_paOutDevice!=m_outDevList[m_nDevOut]) m_restartSoundOut=true;
|
|
|
|
|
|
|
|
m_myCall=ui.myCallEntry->text();
|
|
|
|
m_myGrid=ui.myGridEntry->text();
|
|
|
|
m_idInt=ui.idIntSpinBox->value();
|
2013-03-24 08:55:13 -04:00
|
|
|
m_pttMethodIndex=ui.pttMethodComboBox->currentIndex();
|
2013-05-20 14:33:06 -04:00
|
|
|
m_pttPort=ui.pttComboBox->currentIndex();
|
2012-05-22 13:09:48 -04:00
|
|
|
m_saveDir=ui.saveDirEntry->text();
|
|
|
|
m_nDevIn=ui.comboBoxSndIn->currentIndex();
|
|
|
|
m_paInDevice=m_inDevList[m_nDevIn];
|
|
|
|
m_nDevOut=ui.comboBoxSndOut->currentIndex();
|
|
|
|
m_paOutDevice=m_outDevList[m_nDevOut];
|
2013-03-21 18:58:16 -04:00
|
|
|
|
|
|
|
m_macro.clear();
|
|
|
|
m_macro.append(ui.macro1->text());
|
|
|
|
m_macro.append(ui.macro2->text());
|
|
|
|
m_macro.append(ui.macro3->text());
|
|
|
|
m_macro.append(ui.macro4->text());
|
|
|
|
m_macro.append(ui.macro5->text());
|
|
|
|
m_macro.append(ui.macro6->text());
|
|
|
|
m_macro.append(ui.macro7->text());
|
|
|
|
m_macro.append(ui.macro8->text());
|
|
|
|
m_macro.append(ui.macro9->text());
|
|
|
|
m_macro.append(ui.macro10->text());
|
|
|
|
|
2013-03-25 15:13:49 -04:00
|
|
|
m_dFreq.clear();
|
|
|
|
m_dFreq.append(ui.f1->text());
|
|
|
|
m_dFreq.append(ui.f2->text());
|
|
|
|
m_dFreq.append(ui.f3->text());
|
|
|
|
m_dFreq.append(ui.f4->text());
|
|
|
|
m_dFreq.append(ui.f5->text());
|
|
|
|
m_dFreq.append(ui.f6->text());
|
|
|
|
m_dFreq.append(ui.f7->text());
|
|
|
|
m_dFreq.append(ui.f8->text());
|
|
|
|
m_dFreq.append(ui.f9->text());
|
|
|
|
m_dFreq.append(ui.f10->text());
|
|
|
|
m_dFreq.append(ui.f11->text());
|
|
|
|
m_dFreq.append(ui.f12->text());
|
|
|
|
m_dFreq.append(ui.f13->text());
|
|
|
|
m_dFreq.append(ui.f14->text());
|
|
|
|
m_dFreq.append(ui.f15->text());
|
|
|
|
m_dFreq.append(ui.f16->text());
|
|
|
|
|
2013-07-23 06:28:22 -04:00
|
|
|
m_antDescription.clear();
|
|
|
|
m_antDescription.append(ui.AntDescription1->text());
|
|
|
|
m_antDescription.append(ui.AntDescription2->text());
|
|
|
|
m_antDescription.append(ui.AntDescription3->text());
|
|
|
|
m_antDescription.append(ui.AntDescription4->text());
|
|
|
|
m_antDescription.append(ui.AntDescription5->text());
|
|
|
|
m_antDescription.append(ui.AntDescription6->text());
|
|
|
|
m_antDescription.append(ui.AntDescription7->text());
|
|
|
|
m_antDescription.append(ui.AntDescription8->text());
|
|
|
|
m_antDescription.append(ui.AntDescription9->text());
|
|
|
|
m_antDescription.append(ui.AntDescription10->text());
|
|
|
|
m_antDescription.append(ui.AntDescription11->text());
|
|
|
|
m_antDescription.append(ui.AntDescription12->text());
|
|
|
|
m_antDescription.append(ui.AntDescription13->text());
|
|
|
|
m_antDescription.append(ui.AntDescription14->text());
|
|
|
|
m_antDescription.append(ui.AntDescription15->text());
|
|
|
|
m_antDescription.append(ui.AntDescription16->text());
|
|
|
|
|
|
|
|
m_bandDescription.clear();
|
|
|
|
m_bandDescription.append(ui.Band1->text());
|
|
|
|
m_bandDescription.append(ui.Band2->text());
|
|
|
|
m_bandDescription.append(ui.Band3->text());
|
|
|
|
m_bandDescription.append(ui.Band4->text());
|
|
|
|
m_bandDescription.append(ui.Band5->text());
|
|
|
|
m_bandDescription.append(ui.Band6->text());
|
|
|
|
m_bandDescription.append(ui.Band7->text());
|
|
|
|
m_bandDescription.append(ui.Band8->text());
|
|
|
|
m_bandDescription.append(ui.Band9->text());
|
|
|
|
m_bandDescription.append(ui.Band10->text());
|
|
|
|
m_bandDescription.append(ui.Band11->text());
|
|
|
|
m_bandDescription.append(ui.Band12->text());
|
|
|
|
m_bandDescription.append(ui.Band13->text());
|
|
|
|
m_bandDescription.append(ui.Band14->text());
|
|
|
|
m_bandDescription.append(ui.Band15->text());
|
|
|
|
m_bandDescription.append(ui.Band16->text());
|
|
|
|
|
|
|
|
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_bRigOpen) {
|
|
|
|
rig->close();
|
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;
|
|
|
|
}
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
QDialog::accept();
|
|
|
|
}
|
|
|
|
|
2013-05-07 14:19:15 -04:00
|
|
|
//------------------------------------------------------- reject()
|
|
|
|
void DevSetup::reject()
|
|
|
|
{
|
|
|
|
if(m_bRigOpen) rig->close();
|
|
|
|
QDialog::reject();
|
|
|
|
}
|
|
|
|
|
2013-03-24 08:55:13 -04:00
|
|
|
void DevSetup::p4ReadFromStdout() //p4readFromStdout
|
|
|
|
{
|
|
|
|
while(p4.canReadLine()) {
|
|
|
|
QString t(p4.readLine());
|
|
|
|
QString t1,t2,t3;
|
|
|
|
if(t.mid(0,6)!=" Rig #") {
|
|
|
|
t1=t.mid(0,6);
|
|
|
|
t2=t.mid(8,22).trimmed();
|
|
|
|
t3=t.mid(31,23).trimmed();
|
|
|
|
t=t1 + " " + t2 + " " + t3;
|
|
|
|
ui.rigComboBox->addItem(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::p4ReadFromStderr() //p4readFromStderr
|
|
|
|
{
|
|
|
|
QByteArray t=p4.readAllStandardError();
|
|
|
|
if(t.length()>0) {
|
|
|
|
msgBox(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::p4Error() //p4rror
|
|
|
|
{
|
|
|
|
msgBox("Error running 'rigctl -l'.");
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::msgBox(QString t) //msgBox
|
|
|
|
{
|
|
|
|
msgBox0.setText(t);
|
|
|
|
msgBox0.exec();
|
|
|
|
}
|
2012-11-24 11:30:39 -05:00
|
|
|
|
|
|
|
void DevSetup::on_myCallEntry_editingFinished()
|
|
|
|
{
|
|
|
|
QString t=ui.myCallEntry->text();
|
|
|
|
ui.myCallEntry->setText(t.toUpper());
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_myGridEntry_editingFinished()
|
|
|
|
{
|
|
|
|
QString t=ui.myGridEntry->text();
|
|
|
|
t=t.mid(0,4).toUpper()+t.mid(4,2).toLower();
|
|
|
|
ui.myGridEntry->setText(t);
|
|
|
|
}
|
2013-03-09 21:45:12 -05:00
|
|
|
|
2013-07-23 06:28:22 -04:00
|
|
|
void DevSetup::setEnableAntennaDescriptions(bool enable)
|
|
|
|
{
|
|
|
|
ui.AntDescription1->setEnabled(enable);
|
|
|
|
ui.AntDescription2->setEnabled(enable);
|
|
|
|
ui.AntDescription3->setEnabled(enable);
|
|
|
|
ui.AntDescription4->setEnabled(enable);
|
|
|
|
ui.AntDescription5->setEnabled(enable);
|
|
|
|
ui.AntDescription6->setEnabled(enable);
|
|
|
|
ui.AntDescription7->setEnabled(enable);
|
|
|
|
ui.AntDescription8->setEnabled(enable);
|
|
|
|
ui.AntDescription9->setEnabled(enable);
|
|
|
|
ui.AntDescription10->setEnabled(enable);
|
|
|
|
ui.AntDescription11->setEnabled(enable);
|
|
|
|
ui.AntDescription12->setEnabled(enable);
|
|
|
|
ui.AntDescription13->setEnabled(enable);
|
|
|
|
ui.AntDescription14->setEnabled(enable);
|
|
|
|
ui.AntDescription15->setEnabled(enable);
|
|
|
|
ui.AntDescription16->setEnabled(enable);
|
|
|
|
if (enable)
|
|
|
|
ui.AntDescriptionColumnLabel->setText("Antenna description");
|
|
|
|
else
|
|
|
|
ui.AntDescriptionColumnLabel->setText("Antenna description (enable PSK Reporter)");
|
|
|
|
}
|
|
|
|
|
2013-03-09 21:45:12 -05:00
|
|
|
void DevSetup::on_cbPSKReporter_clicked(bool b)
|
|
|
|
{
|
|
|
|
m_pskReporter=b;
|
2013-07-23 06:28:22 -04:00
|
|
|
setEnableAntennaDescriptions(m_pskReporter);
|
2013-03-09 21:45:12 -05:00
|
|
|
}
|
2013-03-24 08:55:13 -04:00
|
|
|
|
|
|
|
void DevSetup::on_pttMethodComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_pttMethodIndex=index;
|
2013-05-23 10:52:51 -04:00
|
|
|
enableWidgets();
|
2013-03-24 08:55:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_catPortComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_catPortIndex=index;
|
|
|
|
m_catPort=ui.catPortComboBox->itemText(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_cbEnableCAT_toggled(bool b)
|
|
|
|
{
|
|
|
|
m_catEnabled=b;
|
2013-05-21 20:31:53 -04:00
|
|
|
enableWidgets();
|
2013-07-09 11:44:33 -04:00
|
|
|
ui.cbSplit->setChecked(m_bSplit and m_catEnabled);
|
2013-03-24 08:55:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_serialRateComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_serialRateIndex=index;
|
|
|
|
m_serialRate=ui.serialRateComboBox->itemText(index).toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_handshakeComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_handshakeIndex=index;
|
|
|
|
m_handshake=ui.handshakeComboBox->itemText(index);
|
|
|
|
}
|
|
|
|
|
2013-07-23 13:32:59 -04:00
|
|
|
void DevSetup::on_handshakeComboBox_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
ui.RTSCheckBox->setEnabled(index != 2);
|
|
|
|
}
|
|
|
|
|
2013-03-24 08:55:13 -04:00
|
|
|
void DevSetup::on_dataBitsComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_dataBitsIndex=index;
|
|
|
|
m_dataBits=ui.dataBitsComboBox->itemText(index).toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_stopBitsComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_stopBitsIndex=index;
|
|
|
|
m_stopBits=ui.stopBitsComboBox->itemText(index).toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_rigComboBox_activated(int index)
|
|
|
|
{
|
|
|
|
m_rigIndex=index;
|
|
|
|
QString t=ui.rigComboBox->itemText(index);
|
|
|
|
m_rig=t.mid(0,7).toInt();
|
2013-05-21 20:31:53 -04:00
|
|
|
enableWidgets();
|
2013-03-24 08:55:13 -04:00
|
|
|
}
|
2013-03-24 21:24:47 -04:00
|
|
|
|
|
|
|
void DevSetup::on_cbID73_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_After73=checked;
|
|
|
|
}
|
2013-04-23 16:46:04 -04:00
|
|
|
|
|
|
|
void DevSetup::on_testCATButton_clicked()
|
2013-07-08 15:57:01 -04:00
|
|
|
{
|
|
|
|
openRig();
|
|
|
|
if(!m_catEnabled) return;
|
|
|
|
QString t;
|
|
|
|
double fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
|
|
|
|
if(fMHz>0.0) {
|
|
|
|
t.sprintf("Rig control appears to be working.\nDial Frequency: %.6f MHz",
|
|
|
|
fMHz);
|
|
|
|
} else {
|
|
|
|
t.sprintf("Rig control error %d\nFailed to read frequency.",
|
|
|
|
int(1000000.0*fMHz));
|
|
|
|
if(m_poll>0) {
|
|
|
|
m_catEnabled=false;
|
|
|
|
ui.cbEnableCAT->setChecked(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
msgBox(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::openRig()
|
2013-04-23 16:46:04 -04:00
|
|
|
{
|
2013-04-30 14:54:11 -04:00
|
|
|
QString t;
|
|
|
|
int ret;
|
2013-04-23 16:46:04 -04:00
|
|
|
|
|
|
|
if(!m_catEnabled) return;
|
|
|
|
if(m_bRigOpen) {
|
|
|
|
rig->close();
|
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;
|
|
|
|
}
|
2013-05-21 15:49:41 -04:00
|
|
|
|
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");
|
2013-07-08 15:57:01 -04:00
|
|
|
m_catEnabled=false;
|
2013-05-01 08:21:19 -04:00
|
|
|
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 15:49:41 -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
|
|
|
rig->setConf("dtr_state",m_bDTR ? "ON" : "OFF");
|
|
|
|
if(ui.RTSCheckBox->isEnabled()) {
|
|
|
|
rig->setConf("rts_state",m_bRTS ? "ON" : "OFF");
|
2013-05-21 15:49:41 -04:00
|
|
|
}
|
2013-04-23 16:46:04 -04:00
|
|
|
}
|
2013-04-30 14:54:11 -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) {
|
|
|
|
m_bRigOpen=true;
|
|
|
|
} else {
|
|
|
|
t="Open rig failed";
|
|
|
|
msgBox(t);
|
|
|
|
m_catEnabled=false;
|
|
|
|
ui.cbEnableCAT->setChecked(false);
|
2013-04-23 16:46:04 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_testPTTButton_clicked()
|
|
|
|
{
|
2013-04-24 13:55:33 -04:00
|
|
|
m_test=1-m_test;
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
|
2013-07-08 09:17:22 -04:00
|
|
|
ptt(m_pttPort,m_test,&g2_iptt,&g2_COMportOpen);
|
2013-04-23 16:46:04 -04:00
|
|
|
}
|
2013-04-25 18:57:08 -04:00
|
|
|
if(m_pttMethodIndex==0 and !m_bRigOpen) {
|
2013-07-08 15:57:01 -04:00
|
|
|
// on_testCATButton_clicked();
|
|
|
|
openRig();
|
2013-04-25 18:57:08 -04:00
|
|
|
}
|
2013-04-23 16:46:04 -04:00
|
|
|
if(m_pttMethodIndex==0 and m_bRigOpen) {
|
2013-04-25 18:57:08 -04:00
|
|
|
if(m_test==0) rig->setPTT(RIG_PTT_OFF, RIG_VFO_CURR);
|
|
|
|
if(m_test==1) {
|
|
|
|
if(m_pttData) rig->setPTT(RIG_PTT_ON_DATA, RIG_VFO_CURR);
|
|
|
|
if(!m_pttData) rig->setPTT(RIG_PTT_ON_MIC, RIG_VFO_CURR);
|
|
|
|
}
|
2013-04-23 16:46:04 -04:00
|
|
|
}
|
|
|
|
}
|
2013-04-24 15:41:58 -04:00
|
|
|
|
2013-07-23 13:32:59 -04:00
|
|
|
void DevSetup::on_DTRCheckBox_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_bDTR=checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_RTSCheckBox_toggled(bool checked)
|
2013-04-24 15:41:58 -04:00
|
|
|
{
|
2013-07-23 13:32:59 -04:00
|
|
|
m_bRTS=checked;
|
2013-04-24 15:41:58 -04:00
|
|
|
}
|
2013-04-25 18:57:08 -04:00
|
|
|
|
|
|
|
void DevSetup::on_rbData_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_pttData=checked;
|
|
|
|
}
|
2013-04-30 10:34:45 -04:00
|
|
|
|
|
|
|
void DevSetup::on_pollSpinBox_valueChanged(int n)
|
|
|
|
{
|
|
|
|
m_poll=n;
|
|
|
|
}
|
2013-05-02 20:04:44 -04:00
|
|
|
|
2013-05-20 14:33:06 -04:00
|
|
|
void DevSetup::on_pttComboBox_currentIndexChanged(int index)
|
2013-05-02 20:04:44 -04:00
|
|
|
{
|
2013-05-20 14:33:06 -04:00
|
|
|
m_pttPort=index;
|
2013-07-08 15:57:01 -04:00
|
|
|
enableWidgets();
|
2013-05-20 14:33:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_pttMethodComboBox_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_pttMethodIndex=index;
|
|
|
|
bool b=m_pttMethodIndex==1 or m_pttMethodIndex==2;
|
|
|
|
ui.pttComboBox->setEnabled(b);
|
2013-05-02 20:04:44 -04:00
|
|
|
}
|
2013-05-21 15:49:41 -04:00
|
|
|
|
2013-05-21 20:31:53 -04:00
|
|
|
void DevSetup::enableWidgets()
|
2013-05-21 15:49:41 -04:00
|
|
|
{
|
2013-05-21 20:31:53 -04:00
|
|
|
ui.cbEnableCAT->setChecked(m_catEnabled);
|
|
|
|
ui.rigComboBox->setEnabled(m_catEnabled);
|
|
|
|
ui.testCATButton->setEnabled(m_catEnabled);
|
|
|
|
ui.label_4->setEnabled(m_catEnabled);
|
|
|
|
ui.label_47->setEnabled(m_catEnabled);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui.cbSplit->setEnabled(m_catEnabled);
|
2013-07-10 12:45:13 -04:00
|
|
|
if(m_rig==9999) { //No Split Tx with HRD
|
|
|
|
ui.cbSplit->setChecked(false);
|
|
|
|
ui.cbSplit->setEnabled(false);
|
|
|
|
}
|
2013-07-08 09:17:22 -04:00
|
|
|
ui.cbXIT->setEnabled(m_catEnabled);
|
2013-05-21 20:31:53 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
bool bSerial=m_catEnabled and (m_rig<9900);
|
2013-05-21 20:31:53 -04:00
|
|
|
ui.catPortComboBox->setEnabled(bSerial);
|
|
|
|
ui.serialRateComboBox->setEnabled(bSerial);
|
|
|
|
ui.dataBitsComboBox->setEnabled(bSerial);
|
|
|
|
ui.stopBitsComboBox->setEnabled(bSerial);
|
|
|
|
ui.handshakeComboBox->setEnabled(bSerial);
|
2013-07-23 13:32:59 -04:00
|
|
|
ui.DTRCheckBox->setEnabled(bSerial);
|
|
|
|
ui.DTRCheckBox->setChecked(m_bDTR);
|
|
|
|
ui.RTSCheckBox->setEnabled(bSerial && m_handshakeIndex != 2);
|
|
|
|
ui.RTSCheckBox->setChecked(m_bRTS);
|
2013-05-21 20:31:53 -04:00
|
|
|
ui.rbData->setEnabled(bSerial);
|
|
|
|
ui.rbMic->setEnabled(bSerial);
|
|
|
|
ui.label_21->setEnabled(bSerial);
|
|
|
|
ui.label_22->setEnabled(bSerial);
|
|
|
|
ui.label_23->setEnabled(bSerial);
|
|
|
|
ui.label_24->setEnabled(bSerial);
|
|
|
|
ui.label_25->setEnabled(bSerial);
|
2013-05-21 15:49:41 -04:00
|
|
|
|
2013-05-21 20:31:53 -04:00
|
|
|
ui.pollSpinBox->setEnabled(m_catEnabled);
|
2013-05-23 17:42:05 -04:00
|
|
|
bool b1=(m_pttMethodIndex==1 or m_pttMethodIndex==2);
|
|
|
|
ui.pttComboBox->setEnabled(b1);
|
2013-07-08 15:57:01 -04:00
|
|
|
b1=b1 and (m_pttPort!=0);
|
2013-07-08 09:17:22 -04:00
|
|
|
bool b2 = (m_catEnabled and m_pttMethodIndex==1 and m_rig<9900) or
|
|
|
|
(m_catEnabled and m_pttMethodIndex==2 and m_rig<9900);
|
2013-07-08 19:08:25 -04:00
|
|
|
bool b3 = (m_catEnabled and m_pttMethodIndex==0);
|
2013-07-08 09:17:22 -04:00
|
|
|
ui.testPTTButton->setEnabled(b1 or b2 or b3); //Include PTT via HRD or Commander
|
2013-07-23 06:28:22 -04:00
|
|
|
setEnableAntennaDescriptions(m_pskReporter);
|
2013-07-08 09:17:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_cbSplit_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_bSplit=checked;
|
|
|
|
if(m_bSplit and m_bXIT) ui.cbXIT->setChecked(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DevSetup::on_cbXIT_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_bXIT=checked;
|
|
|
|
if(m_bSplit and m_bXIT) ui.cbSplit->setChecked(false);
|
2013-05-21 15:49:41 -04:00
|
|
|
}
|