mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Revert to ComboBox for selecting PTT Port. (Straightened out the bizarre
ordering of items on the drop-down list.) git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3285 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
a4dd062938
commit
63f6cd9000
53
devsetup.cpp
53
devsetup.cpp
@ -36,6 +36,19 @@ 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);
|
||||
@ -127,7 +140,6 @@ void DevSetup::initDlg()
|
||||
|
||||
ui.idIntSpinBox->setValue(m_idInt);
|
||||
ui.pttMethodComboBox->setCurrentIndex(m_pttMethodIndex);
|
||||
ui.pttPortEntry->setText(m_pttPort);
|
||||
ui.saveDirEntry->setText(m_saveDir);
|
||||
ui.comboBoxSndIn->setCurrentIndex(m_nDevIn);
|
||||
ui.comboBoxSndOut->setCurrentIndex(m_nDevOut);
|
||||
@ -148,7 +160,9 @@ void DevSetup::initDlg()
|
||||
ui.rbData->setEnabled(m_catEnabled);
|
||||
ui.rbMic->setEnabled(m_catEnabled);
|
||||
ui.pollSpinBox->setEnabled(m_catEnabled);
|
||||
bool b=m_pttMethodIndex==1 or m_pttMethodIndex==2 or m_catEnabled;
|
||||
bool b=m_pttMethodIndex==1 or m_pttMethodIndex==2;
|
||||
ui.pttComboBox->setEnabled(b);
|
||||
b=b or m_catEnabled;
|
||||
ui.testPTTButton->setEnabled(b);
|
||||
ui.rigComboBox->setCurrentIndex(m_rigIndex);
|
||||
ui.catPortComboBox->setCurrentIndex(m_catPortIndex);
|
||||
@ -160,12 +174,17 @@ void DevSetup::initDlg()
|
||||
ui.pollSpinBox->setValue(m_poll);
|
||||
|
||||
// PY2SDR -- Per OS serial port names
|
||||
m_tmp=m_pttPort;
|
||||
ui.pttComboBox->clear();
|
||||
ui.catPortComboBox->clear();
|
||||
ui.pttComboBox->addItem("None");
|
||||
ui.catPortComboBox->addItem("None");
|
||||
#ifdef WIN32
|
||||
for ( int i = 1; i < 100; i++ ) {
|
||||
ui.pttComboBox->addItem("COM" + QString::number(i));
|
||||
ui.catPortComboBox->addItem("COM" + QString::number(i));
|
||||
}
|
||||
ui.pttComboBox->addItem("USB");
|
||||
ui.catPortComboBox->addItem("USB");
|
||||
#else
|
||||
ui.catPortComboBox->addItem("/dev/ttyS0");
|
||||
@ -176,9 +195,18 @@ void DevSetup::initDlg()
|
||||
ui.catPortComboBox->addItem("/dev/ttyUSB1");
|
||||
ui.catPortComboBox->addItem("/dev/ttyUSB2");
|
||||
ui.catPortComboBox->addItem("/dev/ttyUSB3");
|
||||
#endif
|
||||
ui.catPortComboBox->setCurrentIndex(m_catPortIndex);
|
||||
|
||||
ui.pttComboBox->addItem("/dev/ttyS0");
|
||||
ui.pttComboBox->addItem("/dev/ttyS1");
|
||||
ui.pttComboBox->addItem("/dev/ttyS2");
|
||||
ui.pttComboBox->addItem("/dev/ttyS3");
|
||||
ui.pttComboBox->addItem("/dev/ttyUSB0");
|
||||
ui.pttComboBox->addItem("/dev/ttyUSB1");
|
||||
ui.pttComboBox->addItem("/dev/ttyUSB2");
|
||||
ui.pttComboBox->addItem("/dev/ttyUSB3");
|
||||
#endif
|
||||
ui.pttComboBox->setCurrentIndex(m_tmp);
|
||||
ui.catPortComboBox->setCurrentIndex(m_catPortIndex);
|
||||
|
||||
ui.macro1->setText(m_macro[0].toUpper());
|
||||
ui.macro2->setText(m_macro[1].toUpper());
|
||||
@ -226,7 +254,7 @@ void DevSetup::accept()
|
||||
m_myGrid=ui.myGridEntry->text();
|
||||
m_idInt=ui.idIntSpinBox->value();
|
||||
m_pttMethodIndex=ui.pttMethodComboBox->currentIndex();
|
||||
m_pttPort=ui.pttPortEntry->text();
|
||||
m_pttPort=ui.pttComboBox->currentIndex();
|
||||
m_saveDir=ui.saveDirEntry->text();
|
||||
m_nDevIn=ui.comboBoxSndIn->currentIndex();
|
||||
m_paInDevice=m_inDevList[m_nDevIn];
|
||||
@ -334,9 +362,7 @@ 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);
|
||||
ui.pttPortEntry->setEnabled(b);
|
||||
b=m_pttMethodIndex==1 or m_pttMethodIndex==2 or
|
||||
bool b=m_pttMethodIndex==1 or m_pttMethodIndex==2 or
|
||||
(m_catEnabled and m_pttMethodIndex==0);
|
||||
ui.testPTTButton->setEnabled(b);
|
||||
}
|
||||
@ -493,7 +519,14 @@ void DevSetup::on_pollSpinBox_valueChanged(int n)
|
||||
m_poll=n;
|
||||
}
|
||||
|
||||
void DevSetup::on_pttPortEntry_editingFinished()
|
||||
void DevSetup::on_pttComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
m_pttPort=ui.pttPortEntry->text();
|
||||
m_pttPort=index;
|
||||
}
|
||||
|
||||
void DevSetup::on_pttMethodComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
m_pttMethodIndex=index;
|
||||
bool b=m_pttMethodIndex==1 or m_pttMethodIndex==2;
|
||||
ui.pttComboBox->setEnabled(b);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
|
||||
qint32 m_idInt;
|
||||
qint32 m_pttMethodIndex;
|
||||
qint32 m_pttPort;
|
||||
qint32 m_nDevIn;
|
||||
qint32 m_nDevOut;
|
||||
qint32 m_inDevList[100];
|
||||
@ -38,6 +39,7 @@ public:
|
||||
qint32 m_test;
|
||||
qint32 m_COMportOpen;
|
||||
qint32 m_poll;
|
||||
qint32 m_tmp;
|
||||
|
||||
bool m_restartSoundIn;
|
||||
bool m_restartSoundOut;
|
||||
@ -55,7 +57,6 @@ public:
|
||||
QString m_azelDir;
|
||||
QString m_catPort;
|
||||
QString m_handshake;
|
||||
QString m_pttPort;
|
||||
|
||||
QStringList m_macro;
|
||||
QStringList m_dFreq;
|
||||
@ -88,7 +89,9 @@ private slots:
|
||||
void on_cbDTRoff_toggled(bool checked);
|
||||
void on_rbData_toggled(bool checked);
|
||||
void on_pollSpinBox_valueChanged(int n);
|
||||
void on_pttPortEntry_editingFinished();
|
||||
void on_pttComboBox_currentIndexChanged(int index);
|
||||
|
||||
void on_pttMethodComboBox_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Rig* rig;
|
||||
@ -96,6 +99,6 @@ private:
|
||||
Ui::DialogSndCard ui;
|
||||
};
|
||||
|
||||
extern int ptt(QString pttPort, int ntx, int* iptt, int* nopen);
|
||||
extern int ptt(int nport, int ntx, int* iptt, int* nopen);
|
||||
|
||||
#endif // DEVSETUP_H
|
||||
|
14
devsetup.ui
14
devsetup.ui
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>548</width>
|
||||
<height>521</height>
|
||||
<height>465</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
@ -148,7 +148,7 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -273,7 +273,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="pttPortEntry">
|
||||
<widget class="QComboBox" name="pttComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -288,10 +288,15 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -2373,6 +2378,7 @@
|
||||
<tabstop>myCallEntry</tabstop>
|
||||
<tabstop>myGridEntry</tabstop>
|
||||
<tabstop>pttMethodComboBox</tabstop>
|
||||
<tabstop>pttComboBox</tabstop>
|
||||
<tabstop>idIntSpinBox</tabstop>
|
||||
<tabstop>cbID73</tabstop>
|
||||
<tabstop>cbPSKReporter</tabstop>
|
||||
|
53
getfile.cpp
53
getfile.cpp
@ -121,15 +121,57 @@ float gran()
|
||||
return v2*fac;
|
||||
}
|
||||
|
||||
int ptt(QString pttPort, int ntx, int* iptt, int* nopen)
|
||||
/*
|
||||
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)
|
||||
{
|
||||
#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);
|
||||
@ -164,3 +206,8 @@ int ptt(QString pttPort, int ntx, int* iptt, int* nopen)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int hamlibError(int retcode)
|
||||
{
|
||||
qDebug() << "Hamlib error" << retcode;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
void getfile(QString fname, int ntrperiod);
|
||||
float gran();
|
||||
//int ptt(int* nport, int* ntx, int* iptt);
|
||||
int ptt(QString pttPort, int ntx, int* iptt, int* nopen);
|
||||
int ptt(int nport, int ntx, int* iptt, int* nopen);
|
||||
|
||||
|
||||
#endif // GETFILE_H
|
||||
|
@ -182,7 +182,6 @@ 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);
|
||||
@ -440,7 +439,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","None").toString();
|
||||
m_pttPort=settings.value("PTTport",0).toInt();
|
||||
m_saveDir=settings.value("SaveDir",m_appDir + "/save").toString();
|
||||
m_nDevIn = settings.value("SoundInIndex", 0).toInt();
|
||||
m_paInDevice = settings.value("paInDevice",0).toInt();
|
||||
@ -884,6 +883,7 @@ void MainWindow::statusChanged()
|
||||
QTextStream out(&f);
|
||||
out << m_dialFreq << ";" << m_mode << ";" << m_hisCall << ";"
|
||||
<< ui->rptSpinBox->value() << endl;
|
||||
// out << m_dialFreq << ";" << m_mode << ";" << m_hisCall << endl;
|
||||
f.close();
|
||||
} else {
|
||||
msgBox("Cannot open file \"wsjtx_status.txt\".");
|
||||
@ -1243,7 +1243,7 @@ void MainWindow::decode() //decode()
|
||||
char *from = (char*) jt9com_.ss;
|
||||
int size=sizeof(jt9com_);
|
||||
if(jt9com_.newdat==0) {
|
||||
int noffset = 4*184*NSMAX + 4*NSMAX + 4*2*NTMAX*1500 + 2*NTMAX*12000;
|
||||
int noffset = 4*184*22000 + 4*22000 + 4*2*1800*1500 + 2*1800*12000;
|
||||
to += noffset;
|
||||
from += noffset;
|
||||
size -= noffset;
|
||||
|
@ -171,6 +171,7 @@ private:
|
||||
qint32 m_pttMethodIndex;
|
||||
qint32 m_QSOfreq0;
|
||||
qint32 m_ntx;
|
||||
qint32 m_pttPort;
|
||||
qint32 m_timeout;
|
||||
qint32 m_txFreq;
|
||||
qint32 m_setftx;
|
||||
@ -314,7 +315,6 @@ private:
|
||||
QString m_msgSent0;
|
||||
QString m_fileToSave;
|
||||
QString m_QSOmsg;
|
||||
QString m_pttPort;
|
||||
|
||||
QStringList m_macro;
|
||||
QStringList m_dFreq;
|
||||
|
@ -104,7 +104,8 @@ void CPlotter::draw(float swide[], float red[], int i0) //draw()
|
||||
j=0;
|
||||
|
||||
int iz=XfromFreq(2000.0);
|
||||
for(int i=0; i<m_w; i++) {
|
||||
// for(int i=0; i<m_w; i++) {
|
||||
for(int i=0; i<iz; i++) {
|
||||
if(i>iz) swide[i]=0;
|
||||
y=0.0;
|
||||
if(swide[i]>0.0) y = 10.0*log10(swide[i]);
|
||||
@ -125,7 +126,7 @@ void CPlotter::draw(float swide[], float red[], int i0) //draw()
|
||||
y2=gain*6.0*log10(sum/m_binsPerPixel) - 10.0;
|
||||
}
|
||||
if(m_bJT9Sync) y2=3.0*gain*red[i] - 15;
|
||||
if(i==m_w-2) painter2D.drawPolyline(LineBuf,j);
|
||||
if(i==iz-1) painter2D.drawPolyline(LineBuf,j);
|
||||
LineBuf[j].setX(i);
|
||||
LineBuf[j].setY(m_h-(y2+0.8*m_h));
|
||||
j++;
|
||||
|
Loading…
Reference in New Issue
Block a user