From 7bdc623ec6c7c1bece13ad951325954ce3d33e6d Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 7 Aug 2013 18:59:11 +0000 Subject: [PATCH] 1. Use a ComboBox for palette selection. 2. Minor adjustments to position of WideGraph controls. 3. Include the palette files. The whole directory "Palettes" should be copied into the install directory. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3529 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Palettes/banana.pal | 9 ++ Palettes/blue1.pal | 9 ++ Palettes/blue2.pal | 9 ++ Palettes/blue3.pal | 9 ++ Palettes/brown.pal | 9 ++ Palettes/cyan1.pal | 9 ++ Palettes/cyan2.pal | 9 ++ Palettes/cyan3.pal | 9 ++ Palettes/default.pal | 9 ++ Palettes/digipan.pal | 9 ++ Palettes/fldigi.pal | 9 ++ Palettes/gmfsk.pal | 9 ++ Palettes/gray1.pal | 9 ++ Palettes/gray2.pal | 9 ++ Palettes/green1.pal | 9 ++ Palettes/green2.pal | 9 ++ Palettes/jungle.pal | 9 ++ Palettes/linrad.pal | 9 ++ Palettes/negative.pal | 9 ++ Palettes/orange.pal | 9 ++ Palettes/pink.pal | 9 ++ Palettes/rainbow.pal | 9 ++ Palettes/scope.pal | 9 ++ Palettes/sunburst.pal | 9 ++ Palettes/vk4bdj.pal | 9 ++ Palettes/yellow1.pal | 9 ++ Palettes/yellow2.pal | 9 ++ Palettes/yl2kf.pal | 9 ++ Palettes/zl2fz.pal | 9 ++ mainwindow.cpp | 2 +- soundout.cpp | 2 +- widegraph.cpp | 41 +++---- widegraph.h | 2 +- widegraph.ui | 277 ++++++++++++++++++++---------------------- 34 files changed, 419 insertions(+), 166 deletions(-) create mode 100644 Palettes/banana.pal create mode 100644 Palettes/blue1.pal create mode 100644 Palettes/blue2.pal create mode 100644 Palettes/blue3.pal create mode 100644 Palettes/brown.pal create mode 100644 Palettes/cyan1.pal create mode 100644 Palettes/cyan2.pal create mode 100644 Palettes/cyan3.pal create mode 100644 Palettes/default.pal create mode 100644 Palettes/digipan.pal create mode 100644 Palettes/fldigi.pal create mode 100644 Palettes/gmfsk.pal create mode 100644 Palettes/gray1.pal create mode 100644 Palettes/gray2.pal create mode 100644 Palettes/green1.pal create mode 100644 Palettes/green2.pal create mode 100644 Palettes/jungle.pal create mode 100644 Palettes/linrad.pal create mode 100644 Palettes/negative.pal create mode 100644 Palettes/orange.pal create mode 100644 Palettes/pink.pal create mode 100644 Palettes/rainbow.pal create mode 100644 Palettes/scope.pal create mode 100644 Palettes/sunburst.pal create mode 100644 Palettes/vk4bdj.pal create mode 100644 Palettes/yellow1.pal create mode 100644 Palettes/yellow2.pal create mode 100644 Palettes/yl2kf.pal create mode 100644 Palettes/zl2fz.pal diff --git a/Palettes/banana.pal b/Palettes/banana.pal new file mode 100644 index 000000000..f0d60cf25 --- /dev/null +++ b/Palettes/banana.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 59; 59; 27 +119;119; 59 +179;179; 91 +227;227;123 +235;235;151 +239;239;183 +247;247;219 +255;255;255 diff --git a/Palettes/blue1.pal b/Palettes/blue1.pal new file mode 100644 index 000000000..579836509 --- /dev/null +++ b/Palettes/blue1.pal @@ -0,0 +1,9 @@ + 0; 0; 2 + 0; 0; 64 + 7; 11;128 + 39; 47;192 + 95;115;217 +151;179;231 +187;203;239 +219;227;247 +255;255;255 diff --git a/Palettes/blue2.pal b/Palettes/blue2.pal new file mode 100644 index 000000000..c08f1e342 --- /dev/null +++ b/Palettes/blue2.pal @@ -0,0 +1,9 @@ + 3; 3; 64 + 7; 11;128 + 39; 47;192 + 95;115;217 +151;179;231 +187;203;239 +219;227;247 +255;255;255 +255;253;108 diff --git a/Palettes/blue3.pal b/Palettes/blue3.pal new file mode 100644 index 000000000..a7e43d863 --- /dev/null +++ b/Palettes/blue3.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 31; 31; 31 + 63; 63; 63 + 91; 91;167 +119;119;191 +155;155;219 +191;191;191 +223;223;223 +255;255;255 diff --git a/Palettes/brown.pal b/Palettes/brown.pal new file mode 100644 index 000000000..68027dfdb --- /dev/null +++ b/Palettes/brown.pal @@ -0,0 +1,9 @@ + 0; 0; 0 +107; 63; 11 +175; 95; 31 +199;119; 43 +215;163; 63 +231;211; 87 +243;247;111 +247;251;179 +255;255;255 diff --git a/Palettes/cyan1.pal b/Palettes/cyan1.pal new file mode 100644 index 000000000..91e3278ee --- /dev/null +++ b/Palettes/cyan1.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 5; 10; 10 + 22; 42; 42 + 52; 99; 99 + 94;175;175 +131;209;209 +162;224;224 +202;239;239 +255;255;255 diff --git a/Palettes/cyan2.pal b/Palettes/cyan2.pal new file mode 100644 index 000000000..01b96e694 --- /dev/null +++ b/Palettes/cyan2.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 35; 51; 51 + 75;103;103 +115;159;159 +155;211;211 +183;231;231 +203;239;239 +227;247;247 +255;255;255 diff --git a/Palettes/cyan3.pal b/Palettes/cyan3.pal new file mode 100644 index 000000000..793949e53 --- /dev/null +++ b/Palettes/cyan3.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 94;114;114 +138;162;162 +171;201;201 +199;232;232 +216;243;243 +228;247;247 +241;251;251 +255;255;255 diff --git a/Palettes/default.pal b/Palettes/default.pal new file mode 100644 index 000000000..681612371 --- /dev/null +++ b/Palettes/default.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 6;136 + 0; 19;198 + 0; 32;239 +172;167;105 +194;198; 49 +225;228;107 +255;255; 0 +255; 51; 0 diff --git a/Palettes/digipan.pal b/Palettes/digipan.pal new file mode 100644 index 000000000..d07764203 --- /dev/null +++ b/Palettes/digipan.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0; 64 + 0; 0;128 + 0; 0;217 +150;147; 92 +183;186; 46 +225;228;107 +255;255; 0 +255; 51; 0 diff --git a/Palettes/fldigi.pal b/Palettes/fldigi.pal new file mode 100644 index 000000000..74732fd8f --- /dev/null +++ b/Palettes/fldigi.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0;177 + 3;110;227 + 0;204;204 +223;223;223 + 0;234; 0 +244;244; 0 +250;126; 0 +244; 0; 0 diff --git a/Palettes/gmfsk.pal b/Palettes/gmfsk.pal new file mode 100644 index 000000000..810a1e107 --- /dev/null +++ b/Palettes/gmfsk.pal @@ -0,0 +1,9 @@ + 0; 0;256 + 0; 62;194 + 0;126;130 + 0;190; 66 + 0;254; 2 + 62;194; 0 +126;130; 0 +190; 66; 0 +254; 2; 0 diff --git a/Palettes/gray1.pal b/Palettes/gray1.pal new file mode 100644 index 000000000..8b87ff252 --- /dev/null +++ b/Palettes/gray1.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 69; 69; 69 + 99; 99; 99 +121;121;121 +140;140;140 +157;157;157 +172;172;172 +186;186;186 +199;199;199 diff --git a/Palettes/gray2.pal b/Palettes/gray2.pal new file mode 100644 index 000000000..b30074962 --- /dev/null +++ b/Palettes/gray2.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 88; 88; 88 +126;126;126 +155;155;155 +179;179;179 +200;200;200 +220;220;220 +237;237;237 +254;254;254 diff --git a/Palettes/green1.pal b/Palettes/green1.pal new file mode 100644 index 000000000..194e390e2 --- /dev/null +++ b/Palettes/green1.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 32; 0 + 0; 64; 0 + 0; 96; 0 + 0;128; 0 + 0;160; 0 + 0;192; 0 + 0;224; 0 +255;255;255 diff --git a/Palettes/green2.pal b/Palettes/green2.pal new file mode 100644 index 000000000..9fa4b8572 --- /dev/null +++ b/Palettes/green2.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 60; 0 + 0;102; 0 + 0;151; 0 + 0;242; 0 +255;255; 89 +240;120; 0 +255;148; 40 +255; 0; 0 diff --git a/Palettes/jungle.pal b/Palettes/jungle.pal new file mode 100644 index 000000000..48cfe063b --- /dev/null +++ b/Palettes/jungle.pal @@ -0,0 +1,9 @@ + 0; 0; 0 +107; 67; 0 +223;143; 0 +255;123; 27 +255; 91; 71 +255;195; 95 +195;255;111 +151;255;151 +255;255;255 diff --git a/Palettes/linrad.pal b/Palettes/linrad.pal new file mode 100644 index 000000000..4ec346f25 --- /dev/null +++ b/Palettes/linrad.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0; 87 + 0; 79;114 + 0;141; 61 + 96;158; 0 +204;124; 0 +253; 50; 17 +255;138;138 +255;255;255 diff --git a/Palettes/negative.pal b/Palettes/negative.pal new file mode 100644 index 000000000..e3d726ff8 --- /dev/null +++ b/Palettes/negative.pal @@ -0,0 +1,9 @@ +255;255;255 +223;223;223 +191;191;191 +159;159;159 +127;127;127 + 95; 95; 95 + 63; 63; 63 + 31; 31; 31 + 0; 0; 0 diff --git a/Palettes/orange.pal b/Palettes/orange.pal new file mode 100644 index 000000000..23e683e9a --- /dev/null +++ b/Palettes/orange.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 63; 27; 0 +131; 63; 0 +199; 95; 0 +251;127; 11 +251;155; 71 +251;187;131 +251;219;191 +255;255;255 diff --git a/Palettes/pink.pal b/Palettes/pink.pal new file mode 100644 index 000000000..a19cb2316 --- /dev/null +++ b/Palettes/pink.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 63; 35; 35 +135; 75; 75 +203;111;111 +255;147;147 +255;175;175 +255;199;199 +255;227;227 +255;255;255 diff --git a/Palettes/rainbow.pal b/Palettes/rainbow.pal new file mode 100644 index 000000000..7ca47341a --- /dev/null +++ b/Palettes/rainbow.pal @@ -0,0 +1,9 @@ + 0; 0;163 + 0; 87;191 + 0;207;219 + 0;247;139 + 0;255; 23 + 95;255; 0 +219;255; 0 +255;171;155 +255;255;255 diff --git a/Palettes/scope.pal b/Palettes/scope.pal new file mode 100644 index 000000000..5c2ef78b6 --- /dev/null +++ b/Palettes/scope.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0;167 + 0; 79;255 + 0;239;255 + 0;255; 75 + 95;255; 0 +255;255; 0 +255;127; 0 +255; 0; 0 diff --git a/Palettes/sunburst.pal b/Palettes/sunburst.pal new file mode 100644 index 000000000..e286d77de --- /dev/null +++ b/Palettes/sunburst.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0; 59 + 0; 0;123 +131; 0;179 +235; 0; 75 +255; 43; 43 +255;215;111 +255;255;183 +255;255;255 diff --git a/Palettes/vk4bdj.pal b/Palettes/vk4bdj.pal new file mode 100644 index 000000000..9d6f09c71 --- /dev/null +++ b/Palettes/vk4bdj.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 32; 0 + 0;154; 0 + 0;161; 0 + 0;177; 0 +156;209;144 +192;185;183 +214;222;224 +255;255;255 diff --git a/Palettes/yellow1.pal b/Palettes/yellow1.pal new file mode 100644 index 000000000..ce6f30f05 --- /dev/null +++ b/Palettes/yellow1.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 31; 31; 0 + 63; 63; 0 + 95; 95; 0 +127;127; 0 +159;159; 0 +191;191; 0 +223;223; 0 +255;255; 0 diff --git a/Palettes/yellow2.pal b/Palettes/yellow2.pal new file mode 100644 index 000000000..e55bd0ded --- /dev/null +++ b/Palettes/yellow2.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 39; 39; 0 + 75; 75; 0 +111;111; 0 +147;147; 0 +183;183; 0 +219;219; 0 +255;255; 0 +255;255;255 diff --git a/Palettes/yl2kf.pal b/Palettes/yl2kf.pal new file mode 100644 index 000000000..a91167974 --- /dev/null +++ b/Palettes/yl2kf.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0;119 + 7; 11;195 + 39; 47;159 + 95;115;203 +151;179;255 +187;203;255 +219;227;255 +255;255; 5 diff --git a/Palettes/zl2fz.pal b/Palettes/zl2fz.pal new file mode 100644 index 000000000..07f11101b --- /dev/null +++ b/Palettes/zl2fz.pal @@ -0,0 +1,9 @@ + 0; 0; 0 + 0; 0; 0 + 0; 0; 0 + 0; 0; 0 + 0;255; 0 +255;255; 0 +255;255; 0 +255;255; 0 +255; 0; 0 diff --git a/mainwindow.cpp b/mainwindow.cpp index 9424fe03a..38ede38ec 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//---------------------------------------------------------------- MainWindow +//--------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" diff --git a/soundout.cpp b/soundout.cpp index abee2abf9..a21ffc5ab 100644 --- a/soundout.cpp +++ b/soundout.cpp @@ -3,7 +3,6 @@ #include #include #include - #include bool SoundOutput::audioError () const @@ -69,6 +68,7 @@ bool SoundOutput::start(QAudioDeviceInfo const& device, QIODevice * source) } connect (m_stream.data(), &QAudioOutput::stateChanged, this, &SoundOutput::handleStateChanged); + m_stream->setBufferSize(48000); m_stream->start (source); if (audioError ()) // start the input stream { diff --git a/widegraph.cpp b/widegraph.cpp index 4bb87b6ab..e2b8c1080 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -54,9 +54,22 @@ WideGraph::WideGraph(QWidget *parent) : 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(); + + QDir recoredDir("Palettes"); + QStringList allFiles = recoredDir.entryList(QDir::NoDotAndDotDot | + QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, + QDir::DirsFirst); + int index=0; + foreach(QString file, allFiles) { + QString t=file.mid(0,file.length()-4); + ui->paletteComboBox->addItem(t); + if(t==m_waterfallPalette) { + ui->paletteComboBox->setCurrentIndex(index); + } + index++; + } +// ui->paletteComboBox->lineEdit()->setAlignment(Qt::AlignHCenter); readPalette("Palettes/" + m_waterfallPalette + ".pal"); } @@ -320,19 +333,6 @@ 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; @@ -357,12 +357,6 @@ void WideGraph::readPalette(QString fileName) 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; @@ -370,3 +364,8 @@ void WideGraph::readPalette(QString fileName) msgBox0.exec(); } } + +void WideGraph::on_paletteComboBox_activated(const QString &palette) +{ + readPalette("Palettes/" + palette + ".pal"); +} diff --git a/widegraph.h b/widegraph.h index 1c9df8272..39bd4119e 100644 --- a/widegraph.h +++ b/widegraph.h @@ -62,7 +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(); + void on_paletteComboBox_activated(const QString &palette); private: double m_slope; diff --git a/widegraph.ui b/widegraph.ui index 6def86d5d..506521760 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -65,7 +65,110 @@ - + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 38 + 16777215 + + + + Number of FFTs averaged (controls waterfall scrolling rate) + + + N Avg + + + 1 + + + 20 + + + + + + + + 80 + 0 + + + + Slope + + + 1 + + + -2.000000000000000 + + + 2.000000000000000 + + + 0.100000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 80 + 0 + + + + + 38 + 16777215 + + + + Constant offset applied to waterfall data + + + + + + Zero + + + -100 + + + 100 + + + + @@ -93,7 +196,7 @@ - + @@ -136,138 +239,7 @@ - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 38 - 16777215 - - - - Number of FFTs averaged (controls waterfall scrolling rate) - - - N Avg - - - 1 - - - 20 - - - - - - - - 80 - 0 - - - - - 38 - 16777215 - - - - Scaling (dB) applied to spectra before plotting - - - Gain - - - -20 - - - 20 - - - - - - - - 80 - 0 - - - - - 38 - 16777215 - - - - Constant offset applied to waterfall data - - - - - - Zero - - - -100 - - - 100 - - - - - - - - 80 - 0 - - - - Slope - - - 1 - - - -2.000000000000000 - - - 2.000000000000000 - - - 0.100000000000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + @@ -304,7 +276,7 @@ - + Select data for display curve @@ -324,17 +296,38 @@ - - - - Palette + + + + Select waterfall palette - - - Linrad + + + + 80 + 0 + + + + + 38 + 16777215 + + + + Scaling (dB) applied to spectra before plotting + + + Gain + + + -20 + + + 20