Add cluster spot color picker

knobtest
Phil Taylor 2022-10-09 14:23:07 +01:00
rodzic cc6e4d042a
commit 22abc65849
5 zmienionych plików z 82 dodań i 14 usunięć

Wyświetl plik

@ -122,7 +122,6 @@ void dxClusterClient::udpDataReceived()
QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,mode,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6','%7')\n")
.arg("UDP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->mode).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss"));
db.query(query);
emit sendOutput(query);
#else
bool found = false;
QMap<QString, spotData*>::iterator spot = allSpots.find(data->dxcall);
@ -134,6 +133,8 @@ void dxClusterClient::udpDataReceived()
allSpots.insert(data->dxcall, data);
}
#endif
emit sendOutput(QString("<spot><action>add</action><dxcall>%1</dxcall><spottercall>%2</spottercall><frequency>%3</frequency><comment>%4</comment></spot>\n")
.arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->comment));
}
else if (action == "delete")
@ -154,6 +155,8 @@ void dxClusterClient::udpDataReceived()
spot = allSpots.erase(spot);
}
#endif
emit sendOutput(QString("<spot><action>delete</action><dxcall>%1</dxcall<frequency>%3</frequency></spot>\n")
.arg(dxcall).arg(frequency));
}
updateSpots();
}
@ -164,7 +167,6 @@ void dxClusterClient::udpDataReceived()
void dxClusterClient::tcpDataReceived()
{
QString data = QString(tcpSocket->readAll());
emit(sendOutput(data));
if (data.contains("login:")) {
sendTcpData(QString("%1\n").arg(tcpUserName));
@ -192,7 +194,6 @@ void dxClusterClient::tcpDataReceived()
QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n")
.arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss"));
db.query(query);
emit sendOutput(query);
#else
bool found = false;
QMap<QString, spotData*>::iterator spot = allSpots.find(data->dxcall);
@ -203,7 +204,6 @@ void dxClusterClient::tcpDataReceived()
if (found == false) {
allSpots.insert(data->dxcall, data);
}
#endif
}
}

Wyświetl plik

@ -33,6 +33,10 @@ struct colorPrefsType{
QColor meterPeakScale;
QColor meterLowerLine;
QColor meterLowText;
// Assorted
QColor clusterSpots;
};

Wyświetl plik

@ -1520,6 +1520,7 @@ void wfmain::loadSettings()
p->meterPeakScale.setNamedColor(settings->value("meterPeakScale", p->meterPeakScale.name(QColor::HexArgb)).toString());
p->meterLowerLine.setNamedColor(settings->value("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)).toString());
p->meterLowText.setNamedColor(settings->value("meterLowText", p->meterLowText.name(QColor::HexArgb)).toString());
p->clusterSpots.setNamedColor(settings->value("clusterSpots", p->clusterSpots.name(QColor::HexArgb)).toString());
}
}
settings->endArray();
@ -2207,6 +2208,7 @@ void wfmain::saveSettings()
settings->setValue("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb));
settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb));
settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb));
settings->setValue("clusterSpots", p->clusterSpots.name(QColor::HexArgb));
}
settings->endArray();
settings->endGroup();
@ -2884,6 +2886,8 @@ void wfmain::setDefaultColors(int presetNumber)
p->wfGrid = QColor(Qt::white);
p->wfText = QColor(Qt::white);
p->clusterSpots = QColor(Qt::red);
//qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName);
switch (presetNumber)
@ -2915,6 +2919,7 @@ void wfmain::setDefaultColors(int presetNumber)
p->wfAxis = QColor(Qt::white);
p->wfGrid = QColor("transparent");
p->wfText = QColor(Qt::white);
p->clusterSpots = QColor(Qt::red);
break;
}
case 1:
@ -2942,6 +2947,7 @@ void wfmain::setDefaultColors(int presetNumber)
p->wfAxis = QColor(200,200,200,255);
p->wfGrid = QColor("transparent");
p->wfText = QColor(Qt::black);
p->clusterSpots = QColor(Qt::red);
break;
}
@ -6892,6 +6898,8 @@ void wfmain::useColorPreset(colorPrefsType *cp)
ui->meterSPoWidget->setColors(cp->meterLevel, cp->meterPeakScale, cp->meterPeakLevel, cp->meterAverage, cp->meterLowerLine, cp->meterLowText);
ui->meter2Widget->setColors(cp->meterLevel, cp->meterPeakScale, cp->meterPeakLevel, cp->meterAverage, cp->meterLowerLine, cp->meterLowText);
clusterColor = cp->clusterSpots;
}
void wfmain::setColorButtonOperations(QColor *colorStore,
@ -7011,6 +7019,8 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber)
setEditAndLedFromColor(p.wfAxis, ui->colorEditWfAxis, ui->colorSwatchWfAxis);
setEditAndLedFromColor(p.wfText, ui->colorEditWfText, ui->colorSwatchWfText);
setEditAndLedFromColor(p.clusterSpots, ui->colorEditClusterSpots, ui->colorSwatchClusterSpots);
useColorPreset(&p);
}
@ -7217,13 +7227,14 @@ void wfmain::on_colorEditWfAxis_editingFinished()
void wfmain::on_colorSetBtnWfText_clicked()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].wfText);
QColor* c = &(colorPreset[pos].wfText);
setColorButtonOperations(c, ui->colorEditWfText, ui->colorSwatchWfText);
}
void wfmain::on_colorEditWfText_editingFinished()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor *c = &(colorPreset[pos].wfText);
QColor* c = &(colorPreset[pos].wfText);
setColorLineEditOperations(c, ui->colorEditWfText, ui->colorSwatchWfText);
}
@ -7339,6 +7350,20 @@ void wfmain::on_colorEditMeterText_editingFinished()
setColorLineEditOperations(c, ui->colorEditMeterText, ui->colorSwatchMeterText);
}
// Cluster Spots:
void wfmain::on_colorSetBtnClusterSpots_clicked()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor* c = &(colorPreset[pos].clusterSpots);
setColorButtonOperations(c, ui->colorEditClusterSpots, ui->colorSwatchClusterSpots);
}
void wfmain::on_colorEditClusterSpots_editingFinished()
{
int pos = ui->colorPresetCombo->currentIndex();
QColor* c = &(colorPreset[pos].clusterSpots);
setColorLineEditOperations(c, ui->colorEditClusterSpots, ui->colorSwatchClusterSpots);
}
// ---------- End color UI slots ----------//
void wfmain::on_colorSavePresetBtn_clicked()
@ -7375,6 +7400,7 @@ void wfmain::on_colorSavePresetBtn_clicked()
settings->setValue("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb));
settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb));
settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb));
settings->setValue("clusterSpots", p->clusterSpots.name(QColor::HexArgb));
settings->endArray();
settings->endGroup();
@ -7703,7 +7729,7 @@ void wfmain::receiveSpots(QList<spotData> spots)
double top = rigCaps.spectAmpMax - 10;
sp->text = new QCPItemText(plot);
sp->text->setAntialiased(true);
sp->text->setColor(QColor(Qt::red));
sp->text->setColor(clusterColor);
sp->text->setText(sp->dxcall);
sp->text->setFont(QFont(font().family(), 10));
sp->text->setPositionAlignment(Qt::AlignVCenter | Qt::AlignHCenter);

Wyświetl plik

@ -642,6 +642,10 @@ private slots:
void on_colorEditMeterText_editingFinished();
void on_colorSetBtnClusterSpots_clicked();
void on_colorEditClusterSpots_editingFinished();
void on_colorRenamePresetBtn_clicked();
void on_colorRevertPresetBtn_clicked();
@ -1076,6 +1080,7 @@ private:
QCPItemText* text=Q_NULLPTR;
QList<clusterSettings> clusters;
QMutex clusterMutex;
QColor clusterColor;
};
Q_DECLARE_METATYPE(struct rigCapabilities)

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1125</width>
<width>1023</width>
<height>660</height>
</rect>
</property>
@ -2223,7 +2223,7 @@
<item>
<widget class="QStackedWidget" name="settingsStack">
<property name="currentIndex">
<number>5</number>
<number>1</number>
</property>
<widget class="QWidget" name="radioAccess">
<layout class="QVBoxLayout" name="verticalLayout_21">
@ -3343,8 +3343,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>217</height>
<width>801</width>
<height>311</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -3998,6 +3998,39 @@
</property>
</widget>
</item>
<item row="6" column="9">
<widget class="QPushButton" name="colorSetBtnClusterSpots">
<property name="text">
<string>Cluster Spots</string>
</property>
</widget>
</item>
<item row="6" column="10">
<widget class="QLineEdit" name="colorEditClusterSpots">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="6" column="11">
<widget class="QLedLabel" name="colorSwatchClusterSpots" native="true">
<property name="minimumSize">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -5205,7 +5238,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1125</width>
<width>1023</width>
<height>21</height>
</rect>
</property>
@ -5226,14 +5259,14 @@
<customwidget>
<class>QLedLabel</class>
<extends>QWidget</extends>
<header>qledlabel.h</header>
<header location="global">qledlabel.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="underlayButtonGroup"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="underlayButtonGroup"/>
</buttongroups>
</ui>