From 754aab7db44f0fc7d8547fddccb6ccf58b09f844 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 4 May 2013 00:12:27 +0000 Subject: [PATCH] Red/Orange indicator between "Band" spinner and Dial Frequency readout is now a button. It is enabled only when Orange, which means CAT control is essentially Program to Radio only. Clicking the button causes a one-time read of the radio's dial frequency. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3256 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 32 +++++++++++++++++++++++++++----- mainwindow.h | 2 ++ mainwindow.ui | 27 +-------------------------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index b1002da8c..47b0a17ac 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -180,6 +180,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) : m_secBandChanged=0; m_bMultipleOK=false; m_dontReadFreq=false; + ui->readFreq->setEnabled(false); decodeBusy(false); ui->xThermo->setFillBrush(Qt::green); @@ -642,7 +643,8 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog if(m_bRigOpen) { rig->close(); - ui->labRigOpen->setStyleSheet(""); + ui->readFreq->setStyleSheet(""); + ui->readFreq->setEnabled(false); delete rig; m_bRigOpen=false; m_catEnabled=false; @@ -1720,7 +1722,6 @@ void MainWindow::guiUpdate() msgBox(rt); m_catEnabled=false; } - int ndiff=1000000.0*(fMHz-m_dialFreq); if(ndiff!=0) dialFreqChanged2(fMHz); } @@ -2783,16 +2784,18 @@ void MainWindow::rigOpen() ret=rig->open(); if(ret==RIG_OK) { m_bRigOpen=true; + if(m_poll==0) ui->readFreq->setEnabled(true); } else { t="Open rig failed"; msgBox(t); } if(m_poll>0) { - ui->labRigOpen->setStyleSheet("QLabel{background-color: red}"); - ui->readFreq->setStyleSheet("QPushButton{background-color: #00ff00}"); + ui->readFreq->setStyleSheet("QPushButton{background-color: red; \ + border-width: 0px; border-radius: 5px;}"); } else { - ui->labRigOpen->setStyleSheet("QLabel{background-color: orange}"); + ui->readFreq->setStyleSheet("QPushButton{background-color: orange; \ + border-width: 0px; border-radius: 5px;}"); } } @@ -2812,3 +2815,22 @@ void MainWindow::on_pbT2R_clicked() g_pWideGraph->setQSOfreq(m_txFreq); } + +void MainWindow::on_readFreq_clicked() +{ + if(m_dontReadFreq) { + m_dontReadFreq=false; + } else { + 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; + } + int ndiff=1000000.0*(fMHz-m_dialFreq); + if(ndiff!=0) dialFreqChanged2(fMHz); + qDebug() << "A" << fMHz << ndiff; +} +} diff --git a/mainwindow.h b/mainwindow.h index 78d9966d1..26d26516e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -155,6 +155,8 @@ private slots: void acceptQSO2(bool accepted); void on_bandComboBox_activated(int index); + void on_readFreq_clicked(); + private: Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 0470465cc..329114d03 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2020,31 +2020,6 @@ p, li { white-space: pre-wrap; } - - - - - 20 - 20 - - - - - 10 - 10 - - - - - 10 - 10 - - - - - - - @@ -2209,7 +2184,7 @@ p, li { white-space: pre-wrap; } - +