From 18f1119b1ab154d8d01ee9a5f28ceb85cb6406b7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 25 Jul 2013 16:48:10 +0000 Subject: [PATCH] Adjustable start frequency for waterfall. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3502 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- in.dat | 16 ---------------- mainwindow.cpp | 2 +- plotter.cpp | 25 +++++++++++-------------- plotter.h | 11 ++++------- shortcuts.txt | 19 ++++++++++--------- widegraph.cpp | 18 +++++++++++------- widegraph.h | 1 + widegraph.ui | 46 +++++++++++++++++++++++++++++++++++++++++++++- wsjtx.pro | 2 ++ 9 files changed, 85 insertions(+), 55 deletions(-) delete mode 100644 in.dat diff --git a/in.dat b/in.dat deleted file mode 100644 index 5294129cb..000000000 --- a/in.dat +++ /dev/null @@ -1,16 +0,0 @@ - 35 36 22 8 31 11 14 55 20 36 55 13 24 15 56 38 16 28 61 58 - 15 26 45 8 41 53 37 57 59 60 29 29 41 46 44 35 52 61 24 26 - 16 20 53 35 2 6 9 27 47 28 57 6 15 9 16 10 56 9 63 46 - 9 15 3 - 74 61 44 233 29 245 254 64 119 64 250 111 38 145 53 29 140 194 119 99 - 55 86 48 110 142 95 48 120 61 66 252 252 245 88 62 41 124 249 246 68 - 250 249 65 64 140 142 88 190 237 90 240 52 79 216 55 31 112 135 66 44 - 99 57 68 - 54 61 26 5 13 60 3 56 30 58 57 4 16 43 28 43 6 61 13 19 - 56 8 4 9 45 32 9 7 14 52 4 38 40 27 3 26 51 54 40 29 - 36 63 34 43 3 48 36 49 46 30 8 20 40 59 29 28 17 11 8 19 - 11 63 5 - 38 25 35 8 28 0 0 60 60 25 0 31 28 52 14 24 9 30 18 54 - 49 55 48 15 27 54 26 22 30 27 1 1 4 31 35 29 23 2 2 27 - 0 1 25 32 21 84 28 19 5 60 2 27 15 9 39 23 42 12 29 17 - 16 50 49 diff --git a/mainwindow.cpp b/mainwindow.cpp index 0838260c8..60c2796a1 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -35,7 +35,7 @@ QTextEdit* pShortcuts; QTcpSocket* commanderSocket = new QTcpSocket(0); QString rev="$Rev$"; -QString Program_Title_Version=" WSJT-X v1.1, r" + rev.mid(6,4) + +QString Program_Title_Version=" WSJT-X v1.1.1, r" + rev.mid(6,4) + " by K1JT"; //-------------------------------------------------- MainWindow constructor diff --git a/plotter.cpp b/plotter.cpp index a43bdbf2d..c5288df94 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -15,7 +15,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor setAttribute(Qt::WA_OpaquePaintEvent, false); setAttribute(Qt::WA_NoSystemBackground, true); - m_StartFreq = 0; + m_startFreq = 0; m_nSpan=2; //used for FFT bins/pixel m_fSpan=(float)m_nSpan; m_hdivs = HORZ_DIVS; @@ -83,12 +83,11 @@ void CPlotter::paintEvent(QPaintEvent *) // paintEvent() m_paintEventBusy=false; } -void CPlotter::draw(float swide[], int i0) //draw() +void CPlotter::draw(float swide[]) //draw() { int j,y2; float y; - m_i0=i0; double gain = pow(10.0,0.05*(m_plotGain+7)); //move current data down one line (must do this before attaching a QPainter object) @@ -306,16 +305,15 @@ void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs { float freq; for(int i=0; i<=m_hdivs; i++) { - freq = m_StartFreq + i*m_freqPerDiv; + freq = m_startFreq + i*m_freqPerDiv; m_HDivText[i].setNum((int)freq); - // StartFreq += m_freqPerDiv; } } int CPlotter::XfromFreq(float f) //XfromFreq() { // float w = m_WaterfallPixmap.width(); - int x = int(m_w * (f - m_StartFreq)/m_fSpan + 0.5); + int x = int(m_w * (f - m_startFreq)/m_fSpan + 0.5); if(x<0 ) return 0; if(x>m_w) return m_w; return x; @@ -323,8 +321,7 @@ int CPlotter::XfromFreq(float f) //XfromFreq() float CPlotter::FreqfromX(int x) //FreqfromX() { -// return float(1000.0 + x*m_binsPerPixel*m_fftBinWidth); - return float(x*m_binsPerPixel*m_fftBinWidth); + return float(m_startFreq + x*m_binsPerPixel*m_fftBinWidth); } void CPlotter::SetRunningState(bool running) //SetRunningState() @@ -352,16 +349,16 @@ int CPlotter::getPlotGain() //getPlotGain() return m_plotGain; } -void CPlotter::SetStartFreq(quint64 f) //SetStartFreq() +void CPlotter::setStartFreq(int f) //SetStartFreq() { - m_StartFreq=f; -// resizeEvent(NULL); - DrawOverlay(); + m_startFreq=f; + resizeEvent(NULL); + update(); } -qint64 CPlotter::startFreq() //startFreq() +int CPlotter::startFreq() //startFreq() { - return m_StartFreq; + return m_startFreq; } int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} diff --git a/plotter.h b/plotter.h index b491cf9ee..32bb18903 100644 --- a/plotter.h +++ b/plotter.h @@ -43,14 +43,14 @@ public: qint32 m_binsPerPixel; qint32 m_w; - void draw(float sw[], int i0); //Update the waterfall + void draw(float sw[]); //Update the waterfall void SetRunningState(bool running); void setPlotZero(int plotZero); int getPlotZero(); void setPlotGain(int plotGain); int getPlotGain(); - void SetStartFreq(quint64 f); - qint64 startFreq(); + void setStartFreq(int f); + int startFreq(); int plotWidth(); void setNSpan(int n); void UpdateOverlay(); @@ -87,7 +87,6 @@ private: void UTCstr(); int XfromFreq(float f); float FreqfromX(int x); - qint64 RoundFreq(qint64 freq, int resolution); QPixmap m_WaterfallPixmap; QPixmap m_2DPixmap; @@ -108,14 +107,11 @@ private: double m_fftBinWidth; double m_dialFreq; - qint64 m_StartFreq; - qint32 m_dBStepSize; qint32 m_FreqUnits; qint32 m_hdivs; qint32 m_line; qint32 m_fSample; - qint32 m_i0; qint32 m_xClick; qint32 m_freqPerDiv; qint32 m_nsps; @@ -128,6 +124,7 @@ private: qint32 m_txFreq; qint32 m_fMin; qint32 m_fMax; + qint32 m_startFreq; char m_sutc[6]; diff --git a/shortcuts.txt b/shortcuts.txt index 821ec702d..c82306504 100644 --- a/shortcuts.txt +++ b/shortcuts.txt @@ -5,22 +5,23 @@ F3 Display keyboard shortcuts F4 Clear Dx Call and Dx Grid entries Alt+F4 Exit program F5 Display special mouse commands -F6 Open next in directory +F6 Open next file in directory +Shift+F6 Decode all remaining files in directrory F11 Move Rx frequency down 1 Hz Ctrl+F11 Move Rx and Tx frequencies down 1 Hz F12 Move Rx frequency up 1 Hz Ctrl+F12 Move Rx and Tx frequencies up 1 Hz -Shift+F6 Decode remaining files in directory +Alt+1-6 Set next transmission to this number on Tab 1 Alt+D Decode again at QSO frequency -Shift+D Full-bandwidth decode (both windows) -Alt+E Erase() +Shift+D Full decode (both windows) +Alt+E Erase Ctrl+F Edit the free text message box Alt+G Generate standard messages -Alt+H Halt Tx() +Alt+H Halt Tx Ctrl+L Lookup callsign in database, generate standard messages -Alt M Monitor() -Alt+N Enable Tx() -Alt+Q Log QSO() -Alt+S Stop() +Alt M Monitor +Alt+N Enable Tx +Alt+Q Log QSO +Alt+S Stop monitoring Alt+T Tune Alt+V Save the most recently completed *.wav file diff --git a/widegraph.cpp b/widegraph.cpp index 3efa1f299..56e4375fa 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -49,6 +49,8 @@ WideGraph::WideGraph(QWidget *parent) : ui->widePlot->setBinsPerPixel(nbpp); m_slope=settings.value("Slope",0.0).toDouble(); ui->slopeSpinBox->setValue(m_slope); + ui->widePlot->setStartFreq(settings.value("StartFreq",0).toInt()); + ui->fStartSpinBox->setValue(ui->widePlot->startFreq()); settings.endGroup(); } @@ -75,6 +77,7 @@ void WideGraph::saveSettings() settings.setValue("Cumulative",ui->widePlot->m_bCumulative); settings.setValue("BinsPerPixel",ui->widePlot->binsPerPixel()); settings.setValue("Slope",m_slope); + settings.setValue("StartFreq",ui->widePlot->startFreq()); settings.endGroup(); } @@ -100,16 +103,12 @@ void WideGraph::dataSink2(float s[], float df3, int ihsym, for (int i=0; iwidePlot->plotWidth(); - int i0=-1; //### - int i=i0; + int i=int(ui->widePlot->startFreq()/df3 + 0.5); int jz=5000.0/(nbpp*df3); for (int j=0; jwidePlot->draw(swide,i0); + ui->widePlot->draw(swide); } } @@ -312,3 +311,8 @@ void WideGraph::setDialFreq(double d) m_dialFreq=d; ui->widePlot->setDialFreq(d); } + +void WideGraph::on_fStartSpinBox_valueChanged(int n) +{ + ui->widePlot->setStartFreq(n); +} diff --git a/widegraph.h b/widegraph.h index 194998dfd..c2f2c27b1 100644 --- a/widegraph.h +++ b/widegraph.h @@ -61,6 +61,7 @@ private slots: void on_spec2dComboBox_currentIndexChanged(const QString &arg1); void on_fMinSpinBox_valueChanged(int n); void on_slopeSpinBox_valueChanged(double d); + void on_fStartSpinBox_valueChanged(int n); private: double m_slope; diff --git a/widegraph.ui b/widegraph.ui index 42faba8dd..1c6ff180d 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -68,6 +68,50 @@ + + + + + 0 + 0 + + + + + 80 + 0 + + + + Hz + + + Start + + + 5000 + + + 100 + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 8 + 20 + + + + @@ -256,7 +300,7 @@ - 60 + 80 0 diff --git a/wsjtx.pro b/wsjtx.pro index 92270a544..a9aa52474 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -11,9 +11,11 @@ CONFIG += thread TARGET = wsjtx DESTDIR = ../wsjtx_install +#DESTDIR = ../qt5_install VERSION = 1.1 TEMPLATE = app DEFINES = QT4 +#DEFINES = QT5 win32 { DEFINES += WIN32