Change PTT Port from a QComboBox to a QlineEdit.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3284 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-05-20 15:43:56 +00:00
parent 1ada32a81e
commit 921ec1e158
8 changed files with 20 additions and 164 deletions

Binary file not shown.

View File

@ -36,18 +36,6 @@ void DevSetup::initDlg()
char pa_device_name[128];
char pa_device_hostapi[128];
if(m_firstCall) {
QString t;
for(int i=14; i<100; i++) {
t.sprintf("COM%d",i);
ui.pttComboBox->addItem(t);
}
for(int i=0; i<10; i++) {
m_macro.append("");
}
m_firstCall=false;
}
k=0;
for(id=0; id<numDevices; id++ ) {
pdi=Pa_GetDeviceInfo(id);
@ -139,7 +127,7 @@ void DevSetup::initDlg()
ui.idIntSpinBox->setValue(m_idInt);
ui.pttMethodComboBox->setCurrentIndex(m_pttMethodIndex);
ui.pttComboBox->setCurrentIndex(m_pttPort);
ui.pttPortEntry->setText(m_pttPort);
ui.saveDirEntry->setText(m_saveDir);
ui.comboBoxSndIn->setCurrentIndex(m_nDevIn);
ui.comboBoxSndOut->setCurrentIndex(m_nDevOut);
@ -238,7 +226,7 @@ void DevSetup::accept()
m_myGrid=ui.myGridEntry->text();
m_idInt=ui.idIntSpinBox->value();
m_pttMethodIndex=ui.pttMethodComboBox->currentIndex();
m_pttPort=ui.pttComboBox->currentIndex();
m_pttPort=ui.pttPortEntry->text();
m_saveDir=ui.saveDirEntry->text();
m_nDevIn=ui.comboBoxSndIn->currentIndex();
m_paInDevice=m_inDevList[m_nDevIn];
@ -346,7 +334,9 @@ void DevSetup::on_cbPSKReporter_clicked(bool b)
void DevSetup::on_pttMethodComboBox_activated(int index)
{
m_pttMethodIndex=index;
bool b=m_pttMethodIndex==1 or m_pttMethodIndex==2 or
bool b=(m_pttMethodIndex==1 or m_pttMethodIndex==2);
ui.pttPortEntry->setEnabled(b);
b=m_pttMethodIndex==1 or m_pttMethodIndex==2 or
(m_catEnabled and m_pttMethodIndex==0);
ui.testPTTButton->setEnabled(b);
}
@ -503,7 +493,7 @@ void DevSetup::on_pollSpinBox_valueChanged(int n)
m_poll=n;
}
void DevSetup::on_pttComboBox_currentIndexChanged(int index)
void DevSetup::on_pttPortEntry_editingFinished()
{
m_pttPort=index;
m_pttPort=ui.pttPortEntry->text();
}

View File

@ -18,7 +18,6 @@ public:
qint32 m_idInt;
qint32 m_pttMethodIndex;
qint32 m_pttPort;
qint32 m_nDevIn;
qint32 m_nDevOut;
qint32 m_inDevList[100];
@ -56,6 +55,7 @@ public:
QString m_azelDir;
QString m_catPort;
QString m_handshake;
QString m_pttPort;
QStringList m_macro;
QStringList m_dFreq;
@ -88,7 +88,7 @@ private slots:
void on_cbDTRoff_toggled(bool checked);
void on_rbData_toggled(bool checked);
void on_pollSpinBox_valueChanged(int n);
void on_pttComboBox_currentIndexChanged(int index);
void on_pttPortEntry_editingFinished();
private:
Rig* rig;
@ -96,6 +96,6 @@ private:
Ui::DialogSndCard ui;
};
extern int ptt(int nport, int ntx, int* iptt, int* nopen);
extern int ptt(QString pttPort, int ntx, int* iptt, int* nopen);
#endif // DEVSETUP_H

View File

@ -148,7 +148,7 @@
</property>
<property name="maximumSize">
<size>
<width>60</width>
<width>80</width>
<height>16777215</height>
</size>
</property>
@ -273,7 +273,7 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="pttComboBox">
<widget class="QLineEdit" name="pttPortEntry">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -288,95 +288,10 @@
</property>
<property name="maximumSize">
<size>
<width>60</width>
<width>80</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>COM1</string>
</property>
</item>
<item>
<property name="text">
<string>COM2</string>
</property>
</item>
<item>
<property name="text">
<string>COM3</string>
</property>
</item>
<item>
<property name="text">
<string>COM4</string>
</property>
</item>
<item>
<property name="text">
<string>COM5</string>
</property>
</item>
<item>
<property name="text">
<string>COM6</string>
</property>
</item>
<item>
<property name="text">
<string>COM7</string>
</property>
</item>
<item>
<property name="text">
<string>COM8</string>
</property>
</item>
<item>
<property name="text">
<string>COM9</string>
</property>
</item>
<item>
<property name="text">
<string>COM10</string>
</property>
</item>
<item>
<property name="text">
<string>COM11</string>
</property>
</item>
<item>
<property name="text">
<string>COM12</string>
</property>
</item>
<item>
<property name="text">
<string>COM13</string>
</property>
</item>
<item>
<property name="text">
<string>COM14</string>
</property>
</item>
<item>
<property name="text">
<string>COM15</string>
</property>
</item>
<item>
<property name="text">
<string>USB</string>
</property>
</item>
</widget>
</item>
</layout>
@ -2458,7 +2373,6 @@
<tabstop>myCallEntry</tabstop>
<tabstop>myGridEntry</tabstop>
<tabstop>pttMethodComboBox</tabstop>
<tabstop>pttComboBox</tabstop>
<tabstop>idIntSpinBox</tabstop>
<tabstop>cbID73</tabstop>
<tabstop>cbPSKReporter</tabstop>

View File

@ -121,57 +121,15 @@ float gran()
return v2*fac;
}
/*
int ptt(int nport, int ntx, int *iptt)
{
#ifdef WIN32
static HANDLE hFile;
static int open=0;
char s[10];
int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1;
if(nport==0) {
*iptt=ntx;
return(0);
}
if(ntx && (!open)) {
sprintf(s,"\\\\.\\COM%d",nport);
hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE) {
// printf("PTT: Cannot open COM port %d.\n",nport);
return 1;
}
open=1;
}
if(ntx && open) {
i3=EscapeCommFunction(hFile,SETRTS);
i5=EscapeCommFunction(hFile,SETDTR);
*iptt=1;
}
else {
i4=EscapeCommFunction(hFile,CLRRTS);
i6=EscapeCommFunction(hFile,CLRDTR);
i9=EscapeCommFunction(hFile,CLRBREAK);
i00=CloseHandle(hFile);
*iptt=0;
open=0;
}
return 0;
#endif
}
*/
int ptt(int nport, int ntx, int* iptt, int* nopen)
int ptt(QString pttPort, int ntx, int* iptt, int* nopen)
{
#ifdef WIN32
int nport;
static HANDLE hFile;
char s[10];
int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1;
nport=pttPort.mid(3).toInt();
if(nport==0) {
*iptt=ntx;
return(0);
@ -206,8 +164,3 @@ int ptt(int nport, int ntx, int* iptt, int* nopen)
return 0;
#endif
}
int hamlibError(int retcode)
{
qDebug() << "Hamlib error" << retcode;
}

View File

@ -8,7 +8,7 @@
void getfile(QString fname, int ntrperiod);
float gran();
//int ptt(int* nport, int* ntx, int* iptt);
int ptt(int nport, int ntx, int* iptt, int* nopen);
int ptt(QString pttPort, int ntx, int* iptt, int* nopen);
#endif // GETFILE_H

View File

@ -182,6 +182,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
m_dontReadFreq=false;
ui->readFreq->setEnabled(false);
m_QSOmsg="";
m_pttPort="None";
decodeBusy(false);
ui->xThermo->setFillBrush(Qt::green);
@ -439,7 +440,7 @@ void MainWindow::readSettings()
m_myGrid=settings.value("MyGrid","").toString();
m_idInt=settings.value("IDint",0).toInt();
m_pttMethodIndex=settings.value("PTTmethod",1).toInt();
m_pttPort=settings.value("PTTport",0).toInt();
m_pttPort=settings.value("PTTport","None").toString();
m_saveDir=settings.value("SaveDir",m_appDir + "/save").toString();
m_nDevIn = settings.value("SoundInIndex", 0).toInt();
m_paInDevice = settings.value("paInDevice",0).toInt();
@ -552,8 +553,6 @@ void MainWindow::dataSink(int k)
static int npts8;
static float px=0.0;
static float df3;
static uchar lstrong[1024];
static float slimit;
if(m_diskData) {
jt9com_.ndiskdat=1;

View File

@ -171,7 +171,6 @@ private:
qint32 m_pttMethodIndex;
qint32 m_QSOfreq0;
qint32 m_ntx;
qint32 m_pttPort;
qint32 m_timeout;
qint32 m_txFreq;
qint32 m_setftx;
@ -315,6 +314,7 @@ private:
QString m_msgSent0;
QString m_fileToSave;
QString m_QSOmsg;
QString m_pttPort;
QStringList m_macro;
QStringList m_dFreq;