diff --git a/mainwindow.cpp b/mainwindow.cpp index 503ce1e9d..9424fe03a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,9 +3,8 @@ #include "ui_mainwindow.h" #include - #include - +#include #include "devsetup.h" #include "plotter.h" #include "about.h" @@ -58,16 +57,8 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QString *thekey, \ m_modulator (TX_SAMPLE_RATE, NTMAX / 2, this) { ui->setupUi(this); - m_detector.open (); - on_EraseButton_clicked(); - QActionGroup* paletteGroup = new QActionGroup(this); - ui->actionCuteSDR->setActionGroup(paletteGroup); - ui->actionLinrad->setActionGroup(paletteGroup); - ui->actionAFMHot->setActionGroup(paletteGroup); - ui->actionBlue->setActionGroup(paletteGroup); - ui->actionGray1->setActionGroup(paletteGroup); QActionGroup* modeGroup = new QActionGroup(this); ui->actionJT9_1->setActionGroup(modeGroup); @@ -345,12 +336,6 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QString *thekey, \ } f.close(); - if(ui->actionLinrad->isChecked()) on_actionLinrad_triggered(); - if(ui->actionCuteSDR->isChecked()) on_actionCuteSDR_triggered(); - if(ui->actionAFMHot->isChecked()) on_actionAFMHot_triggered(); - if(ui->actionBlue->isChecked()) on_actionBlue_triggered(); - if(ui->actionGray1->isChecked()) on_actionGray1_triggered(); - ui->decodedTextLabel->setFont(ui->decodedTextBrowser->font()); ui->decodedTextLabel2->setFont(ui->decodedTextBrowser2->font()); t="UTC dB DT Freq Message"; @@ -419,11 +404,6 @@ void MainWindow::writeSettings() settings.setValue("SaveDir",m_saveDir); settings.setValue("SoundInName", m_audioInputDevice.deviceName ()); settings.setValue("SoundOutName", m_audioOutputDevice.deviceName ()); - settings.setValue("PaletteCuteSDR",ui->actionCuteSDR->isChecked()); - settings.setValue("PaletteLinrad",ui->actionLinrad->isChecked()); - settings.setValue("PaletteAFMHot",ui->actionAFMHot->isChecked()); - settings.setValue("PaletteBlue",ui->actionBlue->isChecked()); - settings.setValue("PaletteGray1",ui->actionGray1->isChecked()); settings.setValue("Mode",m_mode); settings.setValue("ModeTx",m_modeTx); settings.setValue("SaveNone",ui->actionNone->isChecked()); @@ -535,24 +515,13 @@ void MainWindow::readSettings() QString savedName = settings.value("SoundOutName", "default").toString(); QList audioOutputDevices (QAudioDeviceInfo::availableDevices (QAudio::AudioOutput)); // available audio output devices for (QList::const_iterator p = audioOutputDevices.begin (); p != audioOutputDevices.end (); ++p) - { - if (p->deviceName () == savedName) - { - m_audioOutputDevice = *p; - } + { + if (p->deviceName () == savedName) { + m_audioOutputDevice = *p; } + } } - ui->actionCuteSDR->setChecked(settings.value( - "PaletteCuteSDR",false).toBool()); - ui->actionLinrad->setChecked(settings.value( - "PaletteLinrad",true).toBool()); - ui->actionAFMHot->setChecked(settings.value( - "PaletteAFMHot",false).toBool()); - ui->actionBlue->setChecked(settings.value( - "PaletteBlue",false).toBool()); - ui->actionGray1->setChecked(settings.value( - "PaletteGray1",false).toBool()); m_mode=settings.value("Mode","JT9").toString(); m_modeTx=settings.value("ModeTx","JT9").toString(); if(m_modeTx=="JT9") ui->pbTxMode->setText("Tx JT9 @"); @@ -584,7 +553,6 @@ void MainWindow::readSettings() m_toRTTY=settings.value("toRTTY",false).toBool(); ui->actionConvert_JT9_x_to_RTTY->setChecked(m_toRTTY); m_noSuffix=settings.value("NoSuffix",false).toBool(); - ui->actionLog_JT9_without_submode->setChecked(m_noSuffix); m_dBtoComments=settings.value("dBtoComments",false).toBool(); ui->actionLog_dB_reports_to_Comments->setChecked(m_dBtoComments); m_rig=settings.value("Rig",214).toInt(); @@ -644,12 +612,6 @@ void MainWindow::readSettings() ui->cbPlus2kHz->setChecked(m_plus2kHz); settings.endGroup(); - if(!ui->actionLinrad->isChecked() and !ui->actionCuteSDR->isChecked()and - !ui->actionAFMHot->isChecked() and !ui->actionBlue->isChecked() and - !ui->actionGray1->isChecked()) { - on_actionLinrad_triggered(); - ui->actionLinrad->setChecked(true); - } if(m_ndepth==1) ui->actionQuickDecode->setChecked(true); if(m_ndepth==2) ui->actionMediumDecode->setChecked(true); if(m_ndepth==3) ui->actionDeepestDecode->setChecked(true); @@ -852,31 +814,6 @@ void MainWindow::on_monitorButton_clicked() //Monitor m_diskData=false; } -void MainWindow::on_actionLinrad_triggered() //Linrad palette -{ - if(g_pWideGraph != NULL) g_pWideGraph->setPalette("Linrad"); -} - -void MainWindow::on_actionCuteSDR_triggered() //CuteSDR palette -{ - if(g_pWideGraph != NULL) g_pWideGraph->setPalette("CuteSDR"); -} - -void MainWindow::on_actionAFMHot_triggered() -{ - if(g_pWideGraph != NULL) g_pWideGraph->setPalette("AFMHot"); -} - -void MainWindow::on_actionBlue_triggered() -{ - if(g_pWideGraph != NULL) g_pWideGraph->setPalette("Blue"); -} - -void MainWindow::on_actionGray1_triggered() -{ - if(g_pWideGraph != NULL) g_pWideGraph->setPalette("Gray1"); -} - void MainWindow::on_actionAbout_triggered() //Display "About" { CAboutDlg dlg(this,Program_Title_Version); @@ -2720,11 +2657,6 @@ void MainWindow::on_actionConvert_JT9_x_to_RTTY_triggered(bool checked) m_toRTTY=checked; } -void MainWindow::on_actionLog_JT9_without_submode_triggered(bool checked) -{ - m_noSuffix=checked; -} - void MainWindow::on_actionLog_dB_reports_to_Comments_triggered(bool checked) { m_dBtoComments=checked; diff --git a/mainwindow.h b/mainwindow.h index 81eb76924..64eebdcac 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -74,8 +74,6 @@ private slots: void on_actionExit_triggered(); void on_actionAbout_triggered(); void OnExit(); - void on_actionLinrad_triggered(); - void on_actionCuteSDR_triggered(); void on_autoButton_clicked(); void on_stopTxButton_clicked(); void on_stopButton_clicked(); @@ -107,8 +105,6 @@ private slots: void on_dxGridEntry_textChanged(const QString &arg1); void on_genStdMsgsPushButton_clicked(); void on_logQSOButton_clicked(); - void on_actionAFMHot_triggered(); - void on_actionBlue_triggered(); void on_actionJT9_1_triggered(); void on_actionJT65_triggered(); void on_actionJT9_JT65_triggered(); @@ -134,7 +130,6 @@ private slots: void onPopup9(); void onPopup10(); void on_actionConvert_JT9_x_to_RTTY_triggered(bool checked); - void on_actionLog_JT9_without_submode_triggered(bool checked); void on_actionLog_dB_reports_to_Comments_triggered(bool checked); void startTx2(); void stopTx(); @@ -171,8 +166,6 @@ private slots: void on_actionTx2QSO_triggered(bool checked); void on_cbPlus2kHz_toggled(bool checked); - void on_actionGray1_triggered(); - private: Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 12ffbe46f..3915402e7 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2274,19 +2274,8 @@ p, li { white-space: pre-wrap; } View - - - Waterfall palette - - - - - - - - @@ -2354,24 +2343,6 @@ p, li { white-space: pre-wrap; } Ctrl+F1 - - - Astro Data - - - Shift+F10 - - - - - Band Map - - - - - Messages - - Waterfall @@ -2403,54 +2374,6 @@ p, li { white-space: pre-wrap; } Delete all *.wav files in SaveDir - - - Erase Band Map and Messages - - - - - true - - - true - - - Linrad - - - - - true - - - false - - - CuteSDR - - - - - Find Delta Phi - - - - - true - - - F4 sets Tx6 - - - - - true - - - No shorthand decodes if Tx1 - - true @@ -2481,57 +2404,6 @@ p, li { white-space: pre-wrap; } Save all - - - true - - - 50 - - - - - true - - - true - - - 144 - - - - - true - - - 222 - - - - - true - - - 432 - - - - - true - - - 1296 - - - - - true - - - 2304 - - Online User's Guide @@ -2556,80 +2428,6 @@ p, li { white-space: pre-wrap; } F5 - - - Available suffixes and add-on-prefixes - - - - - true - - - JT65A - - - - - true - - - true - - - JT65B - - - - - true - - - JT65C - - - - - I/Q Calibration - - - F7 - - - - - Adjust I/Q Calibration - - - - - true - - - Apply I/Q Calibration - - - - - true - - - AFMHot - - - - - true - - - Blue - - - - - FUNcube Dongle Settings - - true @@ -2641,58 +2439,6 @@ p, li { white-space: pre-wrap; } JT9 - - - true - - - JT9-2 - - - - - true - - - false - - - JT9-5 - - - - - true - - - false - - - JT9-10 - - - - - true - - - false - - - JT9-30 - - - - - true - - - false - - - Save synced - - true @@ -2744,14 +2490,6 @@ p, li { white-space: pre-wrap; } Erase wsjtx_log.adi - - - true - - - Log JT9 without submode - - true @@ -2792,11 +2530,6 @@ p, li { white-space: pre-wrap; } Clear DX Call and Grid after logging - - - Distance in miles - - true diff --git a/plotter.cpp b/plotter.cpp index 35ebe4a22..7d0e79f7c 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -134,11 +134,7 @@ void CPlotter::draw(float swide[]) //draw() m_line++; if(m_line == 13) { UTCstr(); - if(m_palette=="Gray1") { - painter1.setPen(Qt::red); - } else { - painter1.setPen(Qt::white); - } + painter1.setPen(Qt::white); painter1.drawText(5,10,m_sutc); } update(); //trigger a new paintEvent @@ -429,90 +425,6 @@ void CPlotter::setNSpan(int n) //setNSpan() m_nSpan=n; } -void CPlotter::setPalette(QString palette) //setPalette() -{ - m_palette=palette; - if(palette=="Linrad") { - float twopi=6.2831853; - float r,g,b,phi,x; - for(int i=0; i<256; i++) { - r=0.0; - if(i>105 and i<=198) { - phi=(twopi/4.0) * (i-105.0)/(198.0-105.0); - r=sin(phi); - } else if(i>=198) { - r=1.0; - } - - g=0.0; - if(i>35 and i<198) { - phi=(twopi/4.0) * (i-35.0)/(122.5-35.0); - g=0.625*sin(phi); - } else if(i>=198) { - x=(i-186.0); - g=-0.014 + 0.0144*x -0.00007*x*x +0.000002*x*x*x; - if(g>1.0) g=1.0; - } - - b=0.0; - if(i<=117) { - phi=(twopi/2.0) * i/117.0; - b=0.4531*sin(phi); - } else if(i>186) { - x=(i-186.0); - b=-0.014 + 0.0144*x -0.00007*x*x +0.000002*x*x*x; - if(b>1.0) b=1.0; - } - m_ColorTbl[i].setRgb(int(255.0*r),int(255.0*g),int(255.0*b)); - } - m_ColorTbl[255].setRgb(255,255,100); - return; - } - - if(palette=="CuteSDR") { - for( int i=0; i<256; i++) { - if( (i<43) ) - m_ColorTbl[i].setRgb( 0,0, 255*(i)/43); - if( (i>=43) && (i<87) ) - m_ColorTbl[i].setRgb( 0, 255*(i-43)/43, 255 ); - if( (i>=87) && (i<120) ) - m_ColorTbl[i].setRgb( 0,255, 255-(255*(i-87)/32)); - if( (i>=120) && (i<154) ) - m_ColorTbl[i].setRgb( (255*(i-120)/33), 255, 0); - if( (i>=154) && (i<217) ) - m_ColorTbl[i].setRgb( 255, 255 - (255*(i-154)/62), 0); - if( (i>=217) ) - m_ColorTbl[i].setRgb( 255, 0, 128*(i-217)/38); - } - m_ColorTbl[255].setRgb(255,255,100); - return; - } - - QFile f; - if(palette=="Blue") f.setFileName("blue.dat"); - if(palette=="AFMHot") f.setFileName("afmhot.dat"); - if(palette=="Gray1") f.setFileName("gray1.dat"); - if(f.open(QIODevice::ReadOnly)) { - QTextStream in(&f); - int n,r,g,b; - float xr,xg,xb; - for(int i=0; i<256; i++) { - in >> n >> xr >> xg >> xb; - r=255.0*xr + 0.5; - g=255.0*xg + 0.5; - b=255.0*xb + 0.5; - m_ColorTbl[i].setRgb(r,g,b); - } - f.close(); - } else { - QMessageBox msgBox0; - QString t="Error: Cannot find requested palette file."; - msgBox0.setText(t); - msgBox0.exec(); - return; - } -} - double CPlotter::fGreen() { return m_fGreen; diff --git a/plotter.h b/plotter.h index b6f786349..eafc8f870 100644 --- a/plotter.h +++ b/plotter.h @@ -61,7 +61,6 @@ public: void setRxFreq(int n, bool bf); void DrawOverlay(); int rxFreq(); - void setPalette(QString palette); void setFsample(int n); void setNsps(int ntrperiod, int nsps); void setTxFreq(int n); @@ -98,7 +97,6 @@ private: QString m_HDivText[483]; QString m_mode; QString m_modeTx; - QString m_palette; bool m_Running; bool m_paintEventBusy; diff --git a/widegraph.cpp b/widegraph.cpp index 01bf2b645..4bb87b6ab 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -53,7 +53,11 @@ WideGraph::WideGraph(QWidget *parent) : ui->slopeSpinBox->setValue(m_slope); ui->widePlot->setStartFreq(settings.value("StartFreq",0).toInt()); ui->fStartSpinBox->setValue(ui->widePlot->startFreq()); + m_waterfallPalette=settings.value("WaterfallPalette","default").toString(); + ui->labPalette->setText(m_waterfallPalette.mid(0,1).toUpper() + + m_waterfallPalette.mid(1)); settings.endGroup(); + readPalette("Palettes/" + m_waterfallPalette + ".pal"); } WideGraph::~WideGraph() @@ -80,6 +84,7 @@ void WideGraph::saveSettings() settings.setValue("BinsPerPixel",ui->widePlot->binsPerPixel()); settings.setValue("Slope",m_slope); settings.setValue("StartFreq",ui->widePlot->startFreq()); + settings.setValue("WaterfallPalette",m_waterfallPalette); settings.endGroup(); } @@ -227,11 +232,6 @@ void WideGraph::setFmin(int n) setRxRange(m_fMin); } -void WideGraph::setPalette(QString palette) -{ - ui->widePlot->setPalette(palette); -} - double WideGraph::fGreen() { return ui->widePlot->fGreen(); @@ -319,3 +319,54 @@ void WideGraph::on_fStartSpinBox_valueChanged(int n) { ui->widePlot->setStartFreq(n); } + +void WideGraph::on_pbPalette_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Select Palette"), + "./Palettes", tr("Files (*.pal)")); + if(fileName!="") readPalette(fileName); + /* + QColor color = QColorDialog::getColor(Qt::yellow, this ); + if(color.isValid()) { + qDebug( "ok" ); + } + */ +} + +void WideGraph::readPalette(QString fileName) +{ + QFile f; + f.setFileName(fileName); + if(f.open(QIODevice::ReadOnly)) { + QTextStream in(&f); + int r[9],g[9],b[9]; + QString t; + for(int i=0; i<9; i++) { + t=in.readLine(); + r[i]=t.mid(0,3).toInt(); + g[i]=t.mid(4,3).toInt(); + b[i]=t.mid(8,3).toInt(); + } + f.close(); + for(int i=0; i<256; i++) { + int j0=i/32; + int j1=j0+1; + int k=i-32*j0; + int rr=r[j0] + int((k*(r[j1]-r[j0]))/31 + 0.5); + int gg=g[j0] + int((k*(g[j1]-g[j0]))/31 + 0.5); + int bb=b[j0] + int((k*(b[j1]-b[j0]))/31 + 0.5); + ui->widePlot->m_ColorTbl[i].setRgb(rr,gg,bb); + } + QFileInfo fileInfo(f); + t=fileInfo.fileName(); + int n=t.length(); + m_waterfallPalette=t.mid(0,n-4); + ui->labPalette->setText(m_waterfallPalette.mid(0,1).toUpper() + + m_waterfallPalette.mid(1)); + } else { + QMessageBox msgBox0; + QString t="Error: Cannot find requested palette file " + fileName; + msgBox0.setText(t); + msgBox0.exec(); + } +} diff --git a/widegraph.h b/widegraph.h index c2987267e..1c9df8272 100644 --- a/widegraph.h +++ b/widegraph.h @@ -25,7 +25,6 @@ public: void saveSettings(); void setRxRange(int fMin); void setFmin(int n); - void setPalette(QString palette); void setFsample(int n); void setPeriod(int ntrperiod, int nsps); void setTxFreq(int n); @@ -35,6 +34,7 @@ public: void setLockTxFreq(bool b); double getSlope(); double fGreen(); + void readPalette(QString fileName); qint32 m_rxFreq; qint32 m_txFreq; @@ -62,6 +62,7 @@ private slots: void on_fMinSpinBox_valueChanged(int n); void on_slopeSpinBox_valueChanged(double d); void on_fStartSpinBox_valueChanged(int n); + void on_pbPalette_clicked(); private: double m_slope; @@ -79,6 +80,7 @@ private: QString m_mode; QString m_modeTx; + QString m_waterfallPalette; Ui::WideGraph *ui; }; diff --git a/widegraph.ui b/widegraph.ui index 1c6ff180d..6def86d5d 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -7,7 +7,7 @@ 0 0 799 - 326 + 395 @@ -51,24 +51,21 @@ - - - 0 - - - + + + Qt::Horizontal - 20 + 40 20 - + @@ -96,23 +93,7 @@ - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 8 - 20 - - - - - + @@ -155,23 +136,7 @@ - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 8 - 20 - - - - - + @@ -205,23 +170,7 @@ - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 8 - 20 - - - - - + @@ -249,23 +198,7 @@ - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 8 - 20 - - - - - + @@ -296,7 +229,7 @@ - + @@ -321,23 +254,20 @@ - - + + Qt::Horizontal - - QSizePolicy::Minimum - - 8 + 40 20 - + @@ -374,23 +304,7 @@ - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 8 - 20 - - - - - + Select data for display curve @@ -410,18 +324,19 @@ - - - - Qt::Horizontal + + + + Palette - - - 20 - 20 - + + + + + + Linrad - +