Gradient fills for spectrum and overlay!

creator-widgets
Elliott Liggett 2024-04-14 21:56:34 -07:00
rodzic fe821d1f0a
commit d1c11ed0b4
8 zmienionych plików z 779 dodań i 491 usunięć

Wyświetl plik

@ -16,8 +16,14 @@ struct colorPrefsType{
QColor textColor;
QColor spectrumLine;
QColor spectrumFill;
QColor spectrumFillTop;
QColor spectrumFillBot;
bool useSpectrumFillGradient = false;
QColor underlayLine;
QColor underlayFill;
bool useUnderlayFillGradient = false;
QColor underlayFillTop;
QColor underlayFillBot;
QColor plotBackground;
QColor tuningLine;
QColor passband;

40
prefs.h
Wyświetl plik

@ -41,23 +41,29 @@ enum prefColItem {
col_plotBackground = 1 << 3,
col_spectrumLine = 1 << 4,
col_spectrumFill = 1 << 5,
col_underlayLine = 1 << 6,
col_underlayFill = 1 << 7,
col_tuningLine = 1 << 8,
col_passband = 1 << 9,
col_pbtIndicator = 1 << 10,
col_meterLevel = 1 << 11,
col_meterAverage = 1 << 12,
col_meterPeakLevel = 1 << 13,
col_meterHighScale = 1 << 14,
col_meterScale = 1 << 15,
col_meterText = 1 << 16,
col_waterfallBack = 1 << 17,
col_waterfallGrid = 1 << 18,
col_waterfallAxis = 1 << 19,
col_waterfallText = 1 << 20,
col_clusterSpots = 1 << 21,
col_all = 1 << 22
col_useSpectrumFillGradient = 1 << 6,
col_spectrumFillTop = 1 << 7,
col_spectrumFillBot = 1 << 8,
col_underlayLine = 1 << 9,
col_underlayFill = 1 << 10,
col_useUnderlayFillGradient = 1 << 11,
col_underlayFillTop = 1 << 12,
col_underlayFillBot = 1 << 13,
col_tuningLine = 1 << 14,
col_passband = 1 << 15,
col_pbtIndicator = 1 << 16,
col_meterLevel = 1 << 17,
col_meterAverage = 1 << 18,
col_meterPeakLevel = 1 << 19,
col_meterHighScale = 1 << 20,
col_meterScale = 1 << 21,
col_meterText = 1 << 22,
col_waterfallBack = 1 << 23,
col_waterfallGrid = 1 << 24,
col_waterfallAxis = 1 << 25,
col_waterfallText = 1 << 26,
col_clusterSpots = 1 << 27,
col_all = 1 << 28
};
enum prefRsItem {

Wyświetl plik

@ -524,6 +524,23 @@ void settingswidget::updateColPref(prefColItem col)
setColorElement(c, ui->colorSwatchSpecFill, ui->colorEditSpecFill);
break;
}
case col_useSpectrumFillGradient:
{
quietlyUpdateCheckbox(ui->useSpectrumFillGradientChk, colorPreset[pos].useSpectrumFillGradient);
break;
}
case col_spectrumFillTop:
{
QColor c = (colorPreset[pos].spectrumFillTop);
setColorElement(c, ui->colorSwatchSpecFillTop, ui->colorEditSpecFillTop);
break;
}
case col_spectrumFillBot:
{
QColor c = (colorPreset[pos].spectrumFillBot);
setColorElement(c, ui->colorSwatchSpecFillBot, ui->colorEditSpecFillBot);
break;
}
case col_underlayLine:
{
QColor c = (colorPreset[pos].underlayLine);
@ -536,6 +553,23 @@ void settingswidget::updateColPref(prefColItem col)
setColorElement(c, ui->colorSwatchUnderlayFill, ui->colorEditUnderlayFill);
break;
}
case col_useUnderlayFillGradient:
{
quietlyUpdateCheckbox(ui->useUnderlayFillGradientChk, colorPreset[pos].useUnderlayFillGradient);
break;
}
case col_underlayFillTop:
{
QColor c = (colorPreset[pos].underlayFillTop);
setColorElement(c, ui->colorSwatchUnderlayFillTop, ui->colorEditUnderlayFillTop);
break;
}
case col_underlayFillBot:
{
QColor c = (colorPreset[pos].underlayFillBot);
setColorElement(c, ui->colorSwatchUnderlayFillBot, ui->colorEditUnderlayFillBot);
break;
}
case col_tuningLine:
{
QColor c = (colorPreset[pos].tuningLine);
@ -2147,9 +2181,16 @@ void settingswidget::loadColorPresetToUIandPlots(int presetNumber)
setEditAndLedFromColor(p.textColor, ui->colorEditText, ui->colorSwatchText);
setEditAndLedFromColor(p.spectrumLine, ui->colorEditSpecLine, ui->colorSwatchSpecLine);
setEditAndLedFromColor(p.spectrumFill, ui->colorEditSpecFill, ui->colorSwatchSpecFill);
quietlyUpdateCheckbox(ui->useSpectrumFillGradientChk, p.useSpectrumFillGradient);
setEditAndLedFromColor(p.spectrumFillTop, ui->colorEditSpecFillTop, ui->colorSwatchSpecFillTop);
setEditAndLedFromColor(p.spectrumFillBot, ui->colorEditSpecFillBot, ui->colorSwatchSpecFillBot);
setEditAndLedFromColor(p.underlayLine, ui->colorEditUnderlayLine, ui->colorSwatchUnderlayLine);
setEditAndLedFromColor(p.underlayFill, ui->colorEditUnderlayFill, ui->colorSwatchUnderlayFill);
setEditAndLedFromColor(p.underlayFillTop, ui->colorEditUnderlayFillTop, ui->colorSwatchUnderlayFillTop);
setEditAndLedFromColor(p.underlayFillBot, ui->colorEditUnderlayFillBot, ui->colorSwatchUnderlayFillBot);
quietlyUpdateCheckbox(ui->useUnderlayFillGradientChk, p.useUnderlayFillGradient);
setEditAndLedFromColor(p.plotBackground, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground);
setEditAndLedFromColor(p.tuningLine, ui->colorEditTuningLine, ui->colorSwatchTuningLine);
setEditAndLedFromColor(p.passband, ui->colorEditPassband, ui->colorSwatchPassband);
setEditAndLedFromColor(p.pbt, ui->colorEditPBT, ui->colorSwatchPBT);
@ -2299,6 +2340,44 @@ void settingswidget::on_colorEditSpecFill_editingFinished()
setColorLineEditOperations(c, ui->colorEditSpecFill, ui->colorSwatchSpecFill);
emit changedColPref(col_spectrumFill);
}
void settingswidget::on_useSpectrumFillGradientChk_clicked(bool checked)
{
int pos = ui->colorPresetCombo->currentIndex();
colorPreset[pos].useSpectrumFillGradient = checked;
emit changedColPref(col_useSpectrumFillGradient);
}
// SpecFill Top:
void settingswidget::on_colorSetBtnSpectFillTop_clicked()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].spectrumFillTop);
setColorButtonOperations(c, ui->colorEditSpecFillTop, ui->colorSwatchSpecFillTop);
emit changedColPref(col_spectrumFillTop);
}
void settingswidget::on_colorEditSpecFillTop_editingFinished()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].spectrumFillTop);
setColorLineEditOperations(c, ui->colorEditSpecFillTop, ui->colorSwatchSpecFillTop);
emit changedColPref(col_spectrumFillTop);
}
// SpecFill Bot:
void settingswidget::on_colorSetBtnSpectFillBot_clicked()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].spectrumFillBot);
setColorButtonOperations(c, ui->colorEditSpecFillBot, ui->colorSwatchSpecFillBot);
emit changedColPref(col_spectrumFillBot);
}
void settingswidget::on_colorEditSpecFillBot_editingFinished()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].spectrumFillBot);
setColorLineEditOperations(c, ui->colorEditSpecFillBot, ui->colorSwatchSpecFillBot);
emit changedColPref(col_spectrumFillBot);
}
// PlotBackground:
void settingswidget::on_colorEditPlotBackground_editingFinished()
@ -2348,6 +2427,44 @@ void settingswidget::on_colorEditUnderlayFill_editingFinished()
setColorLineEditOperations(c, ui->colorEditUnderlayFill, ui->colorSwatchUnderlayFill);
emit changedColPref(col_underlayFill);
}
void settingswidget::on_useUnderlayFillGradientChk_clicked(bool checked)
{
int pos = ui->colorPresetCombo->currentIndex();
colorPreset[pos].useUnderlayFillGradient = checked;
emit changedColPref(col_useUnderlayFillGradient);
}
// Underlay Fill Top:
void settingswidget::on_colorSetBtnUnderlayFillTop_clicked()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].underlayFillTop);
setColorButtonOperations(c, ui->colorEditUnderlayFillTop, ui->colorSwatchUnderlayFillTop);
emit changedColPref(col_underlayFillTop);
}
void settingswidget::on_colorEditUnderlayFillTop_editingFinished()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].underlayFillTop);
setColorLineEditOperations(c, ui->colorEditUnderlayFillTop, ui->colorSwatchUnderlayFillTop);
emit changedColPref(col_underlayFillTop);
}
// Underlay Fill Bot:
void settingswidget::on_colorSetBtnUnderlayFillBot_clicked()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].underlayFillBot);
setColorButtonOperations(c, ui->colorEditUnderlayFillBot, ui->colorSwatchUnderlayFillBot);
emit changedColPref(col_underlayFillBot);
}
void settingswidget::on_colorEditUnderlayFillBot_editingFinished()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].underlayFillBot);
setColorLineEditOperations(c, ui->colorEditUnderlayFillBot, ui->colorSwatchUnderlayFillBot);
emit changedColPref(col_underlayFillBot);
}
// WF Background:
void settingswidget::on_colorSetBtnwfBackground_clicked()
@ -2736,8 +2853,6 @@ void settingswidget::connectionStatus(bool conn)
}
}
void settingswidget::on_connectBtn_clicked()
{
emit connectButtonPressed();
@ -2749,9 +2864,7 @@ void settingswidget::on_saveSettingsBtn_clicked()
emit saveSettingsButtonPressed();
}
void settingswidget::on_revertSettingsBtn_clicked()
{
emit revertSettingsButtonPressed();
}

Wyświetl plik

@ -249,6 +249,26 @@ private slots:
void on_revertSettingsBtn_clicked();
void on_colorSetBtnSpectFillTop_clicked();
void on_colorEditSpecFillTop_editingFinished();
void on_colorSetBtnSpectFillBot_clicked();
void on_colorEditSpecFillBot_editingFinished();
void on_useSpectrumFillGradientChk_clicked(bool checked);
void on_colorSetBtnUnderlayFillTop_clicked();
void on_colorEditUnderlayFillTop_editingFinished();
void on_colorSetBtnUnderlayFillBot_clicked();
void on_colorEditUnderlayFillBot_editingFinished();
void on_useUnderlayFillGradientChk_clicked(bool checked);
private:
Ui::settingswidget *ui;
void createSettingsListItems();

Plik diff jest za duży Load Diff

Wyświetl plik

@ -284,18 +284,18 @@ spectrumScope::spectrumScope(uchar receiver, uchar vfo, QWidget *parent)
configTheme->setAccessibleName("Waterfall display color theme");
configTheme->setAccessibleDescription("Selects the color theme for the waterfall display");
configTheme->setToolTip("Waterfall color theme");
configTheme->addItem("Theme Jet", QCPColorGradient::gpJet);
configTheme->addItem("Theme Cold", QCPColorGradient::gpCold);
configTheme->addItem("Theme Hot", QCPColorGradient::gpHot);
configTheme->addItem("Theme Therm", QCPColorGradient::gpThermal);
configTheme->addItem("Theme Night", QCPColorGradient::gpNight);
configTheme->addItem("Theme Ion", QCPColorGradient::gpIon);
configTheme->addItem("Theme Gray", QCPColorGradient::gpGrayscale);
configTheme->addItem("Theme Geo", QCPColorGradient::gpGeography);
configTheme->addItem("Theme Hues", QCPColorGradient::gpHues);
configTheme->addItem("Theme Polar", QCPColorGradient::gpPolar);
configTheme->addItem("Theme Spect", QCPColorGradient::gpSpectrum);
configTheme->addItem("Theme Candy", QCPColorGradient::gpCandy);
configTheme->addItem("Jet", QCPColorGradient::gpJet);
configTheme->addItem("Cold", QCPColorGradient::gpCold);
configTheme->addItem("Hot", QCPColorGradient::gpHot);
configTheme->addItem("Therm", QCPColorGradient::gpThermal);
configTheme->addItem("Night", QCPColorGradient::gpNight);
configTheme->addItem("Ion", QCPColorGradient::gpIon);
configTheme->addItem("Gray", QCPColorGradient::gpGrayscale);
configTheme->addItem("Geo", QCPColorGradient::gpGeography);
configTheme->addItem("Hues", QCPColorGradient::gpHues);
configTheme->addItem("Polar", QCPColorGradient::gpPolar);
configTheme->addItem("Spect", QCPColorGradient::gpSpectrum);
configTheme->addItem("Candy", QCPColorGradient::gpCandy);
configTheme->setSizeAdjustPolicy(QComboBox::AdjustToContents);
configLayout->addRow("Theme",configTheme);
@ -313,7 +313,7 @@ spectrumScope::spectrumScope(uchar receiver, uchar vfo, QWidget *parent)
configFilterWidth = new QSlider(Qt::Orientation::Horizontal);
configFilterWidth->setRange(0,10000);
configLayout->addRow("Fil Width",configFilterWidth);
configLayout->addRow("Fill Width",configFilterWidth);
connect(configLength, &QSlider::valueChanged, this, [=](const int &val) {
prepareWf(val);
@ -518,10 +518,28 @@ void spectrumScope::colorPreset(colorPrefsType *cp)
pbtIndicator->setBrush(QBrush(cp->pbt));
spectrum->graph(0)->setPen(QPen(cp->spectrumLine));
spectrum->graph(0)->setBrush(QBrush(cp->spectrumFill));
if(cp->useSpectrumFillGradient) {
spectrumGradient.setStart(QPointF(0,1));
spectrumGradient.setFinalStop(QPointF(0,0));
spectrumGradient.setCoordinateMode(QLinearGradient::ObjectMode);
spectrumGradient.setColorAt(0, cp->spectrumFillBot);
spectrumGradient.setColorAt(1, cp->spectrumFillTop);
spectrum->graph(0)->setBrush(QBrush(spectrumGradient));
} else {
spectrum->graph(0)->setBrush(QBrush(cp->spectrumFill));
}
spectrum->graph(1)->setPen(QPen(cp->underlayLine));
spectrum->graph(1)->setBrush(QBrush(cp->underlayFill));
if(cp->useUnderlayFillGradient) {
underlayGradient.setStart(QPointF(0,1));
underlayGradient.setFinalStop(QPointF(0,0));
underlayGradient.setCoordinateMode(QLinearGradient::ObjectMode);
underlayGradient.setColorAt(0, cp->underlayFillBot);
underlayGradient.setColorAt(1, cp->underlayFillTop);
spectrum->graph(1)->setBrush(QBrush(underlayGradient));
} else {
spectrum->graph(1)->setBrush(QBrush(cp->underlayFill));
}
waterfall->yAxis->setBasePen(cp->wfAxis);
waterfall->yAxis->setTickPen(cp->wfAxis);

Wyświetl plik

@ -149,6 +149,8 @@ private:
QLabel* windowLabel = Q_NULLPTR;
QCustomPlot* spectrum = Q_NULLPTR;
QCustomPlot* waterfall = Q_NULLPTR;
QLinearGradient spectrumGradient;
QLinearGradient underlayGradient;
freqCtrl* freqDisplay[2];
QSpacerItem* displaySpacer;
QGroupBox* group;

Wyświetl plik

@ -1680,8 +1680,14 @@ void wfmain::loadSettings()
p->textColor.setNamedColor(settings->value("textColor", p->textColor.name(QColor::HexArgb)).toString());
p->spectrumLine.setNamedColor(settings->value("spectrumLine", p->spectrumLine.name(QColor::HexArgb)).toString());
p->spectrumFill.setNamedColor(settings->value("spectrumFill", p->spectrumFill.name(QColor::HexArgb)).toString());
p->useSpectrumFillGradient = settings->value("useSpectrumFillGradient", p->useSpectrumFillGradient).toBool();
p->spectrumFillTop.setNamedColor(settings->value("spectrumFillTop", p->spectrumFillTop.name(QColor::HexArgb)).toString());
p->spectrumFillBot.setNamedColor(settings->value("spectrumFillBot", p->spectrumFillBot.name(QColor::HexArgb)).toString());
p->underlayLine.setNamedColor(settings->value("underlayLine", p->underlayLine.name(QColor::HexArgb)).toString());
p->underlayFill.setNamedColor(settings->value("underlayFill", p->underlayFill.name(QColor::HexArgb)).toString());
p->useUnderlayFillGradient = settings->value("useUnderlayFillGradient", p->useUnderlayFillGradient).toBool();
p->underlayFillTop.setNamedColor(settings->value("underlayFillTop", p->underlayFillTop.name(QColor::HexArgb)).toString());
p->underlayFillBot.setNamedColor(settings->value("underlayFillBot", p->underlayFillBot.name(QColor::HexArgb)).toString());
p->plotBackground.setNamedColor(settings->value("plotBackground", p->plotBackground.name(QColor::HexArgb)).toString());
p->tuningLine.setNamedColor(settings->value("tuningLine", p->tuningLine.name(QColor::HexArgb)).toString());
p->passband.setNamedColor(settings->value("passband", p->passband.name(QColor::HexArgb)).toString());
@ -2391,8 +2397,14 @@ void wfmain::extChangedColPref(prefColItem i)
case col_plotBackground:
case col_spectrumLine:
case col_spectrumFill:
case col_useSpectrumFillGradient:
case col_spectrumFillTop:
case col_spectrumFillBot:
case col_underlayLine:
case col_underlayFill:
case col_underlayFillTop:
case col_underlayFillBot:
case col_useUnderlayFillGradient:
case col_tuningLine:
case col_passband:
case col_pbtIndicator:
@ -2898,8 +2910,14 @@ void wfmain::saveSettings()
settings->setValue("textColor", p->textColor.name(QColor::HexArgb));
settings->setValue("spectrumLine", p->spectrumLine.name(QColor::HexArgb));
settings->setValue("spectrumFill", p->spectrumFill.name(QColor::HexArgb));
settings->setValue("useSpectrumFillGradient", p->useSpectrumFillGradient);
settings->setValue("spectrumFillTop", p->spectrumFillTop.name(QColor::HexArgb));
settings->setValue("spectrumFillBot", p->spectrumFillBot.name(QColor::HexArgb));
settings->setValue("underlayLine", p->underlayLine.name(QColor::HexArgb));
settings->setValue("underlayFill", p->underlayFill.name(QColor::HexArgb));
settings->setValue("useUnderlayFillGradient", p->useUnderlayFillGradient);
settings->setValue("underlayFillTop", p->underlayFillTop.name(QColor::HexArgb));
settings->setValue("underlayFillBot", p->underlayFillBot.name(QColor::HexArgb));
settings->setValue("plotBackground", p->plotBackground.name(QColor::HexArgb));
settings->setValue("tuningLine", p->tuningLine.name(QColor::HexArgb));
settings->setValue("passband", p->passband.name(QColor::HexArgb));
@ -4960,8 +4978,6 @@ void wfmain::setDefaultColorPresets()
}
}
void wfmain::on_showLogBtn_clicked()
{
if(logWindow->isMinimized())
@ -5084,8 +5100,6 @@ void wfmain::receiveClusterOutput(QString text) {
setupui->insertClusterOutputText(text);
}
void wfmain::changePollTiming(int timing_ms, bool setUI)
{
queue->interval(timing_ms);