Compare dial freq with user's default freq, not the startup default freq.

Also some minor code cleanup.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3476 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-07-10 13:57:13 +00:00
parent f226e4cbc8
commit 4cc9a9be7a
2 changed files with 14 additions and 13 deletions

View File

@ -208,9 +208,8 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
}
#endif
mem_jt9 = shdmem;
readSettings(); //Restore user's setup params
if(m_dFreq.length()<=1) {
if(m_dFreq.length()<=1) { //Use the startup default frequencies
m_dFreq.clear();
for(int i=0; i<16; i++) {
QString t;
@ -239,6 +238,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) :
border-color: black; min-width: 5em; padding: 3px;}";
genStdMsgs(m_rpt);
if(m_mode!="JT9" and m_mode!="JT65" and m_mode!="JT9+JT65") m_mode="JT9";
on_actionWide_Waterfall_triggered(); //###
g_pWideGraph->setRxFreq(m_rxFreq);
g_pWideGraph->setTxFreq(m_txFreq);
@ -971,13 +971,14 @@ void MainWindow::bumpFqso(int n) //bumpFqso()
void MainWindow::dialFreqChanged2(double f)
{
if(m_band<0 or m_band>15) return;
m_dialFreq=f;
if(m_band<0 or m_band>15 or m_dFreq.length()<=1) return;
QString t;
t.sprintf("%.6f",m_dialFreq);
int n=t.length();
t=t.mid(0,n-3) + " " + t.mid(n-3,3);
if(qAbs(m_dialFreq-dFreq[m_band])<0.01) {
double fBand=m_dFreq[m_band].toDouble();
if(qAbs(m_dialFreq-fBand)<0.01) {
ui->labDialFreq->setStyleSheet( \
"QLabel { background-color : black; color : yellow; }");
} else {
@ -2128,8 +2129,11 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs()
ui->tx3->setText("");
ui->tx4->setText("");
ui->tx5->setText("");
t="CQ " + m_myCall + " " + m_myGrid.mid(0,4);
msgtype(t, ui->tx6);
ui->tx6->setText("");
if(m_myCall!="" and m_myGrid!="") {
t="CQ " + m_myCall + " " + m_myGrid.mid(0,4);
msgtype(t, ui->tx6);
}
ui->genMsg->setText("");
ui->freeTextMsg->setText("");
return;

View File

@ -112,13 +112,11 @@ int Rig::open(int n) {
}
}
QString t;
// qint32 nkHz=14076;
// t.sprintf("<command:10>CmdSetFreq<parameters:17><xcvrfreq:5>%5d",nkHz);
t="<command:10>CmdGetFreq<parameters:0>";
QByteArray ba = t.toLocal8Bit();
const char* buf=ba.data();
int n=socket->write(buf);
bool bret=socket->waitForReadyRead(1000);
socket->write(buf);
socket->waitForReadyRead(1000);
QByteArray reply=socket->read(128);
if(reply.indexOf("<CmdFreq:")==0) {
m_cmndr=true;
@ -150,7 +148,7 @@ int Rig::setConf(const char *name, const char *val)
}
int Rig::setFreq(freq_t freq, vfo_t vfo) {
#ifdef WIN32 // Ham Radio Deluxe only on Windows
#ifdef WIN32 // Ham Radio Deluxe (only on Windows)
if(m_hrd) {
QString t;
int nhz=(int)freq;
@ -231,7 +229,7 @@ int Rig::setSplitFreq(freq_t tx_freq, vfo_t vfo) {
freq_t Rig::getFreq(vfo_t vfo)
{
freq_t freq;
#ifdef WIN32 // Ham Radio Deluxe only on Windows
#ifdef WIN32 // Ham Radio Deluxe (only on Windows)
if(m_hrd) {
const wchar_t* cmnd = (const wchar_t*) (m_context+"Get Frequency").utf16();
const wchar_t* freqString=HRDInterfaceSendMessage(cmnd);
@ -305,7 +303,6 @@ int Rig::setPTT(ptt_t ptt, vfo_t vfo)
const char* buf=ba.data();
socket->write(buf);
socket->waitForBytesWritten(1000);
// qDebug() << ptt << buf;
return 0;
} else
#endif