Added line input to color functions

monitor
Elliott Liggett 2022-08-19 10:32:06 -07:00
rodzic 1423e7c300
commit 4b0ce8537e
4 zmienionych plików z 59 dodań i 14 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ QLedLabel::QLedLabel(QWidget* parent) :
{
//Set to ok by default
setState(StateOkBlue);
baseColor = QColor(0, 115, 255, 255);
setFixedSize(SIZE, SIZE);
}
@ -69,7 +70,7 @@ void QLedLabel::setColor(QColor customColor, bool applyGradient=true)
stop:0.41206 \
rgba(%6, %7, %8, %9), \
stop:1 \
rgba(%10, %11, %12, %13));").arg(SIZE / 3)
rgba(%10, %11, %12, %13));").arg(SIZE / 2)
.arg(top.red()).arg(top.green()).arg(top.blue()).arg(top.alpha())
.arg(middle.red()).arg(middle.green()).arg(middle.blue()).arg(middle.alpha())
.arg(bottom.red()).arg(bottom.green()).arg(bottom.blue()).arg(bottom.alpha());

Wyświetl plik

@ -6270,7 +6270,37 @@ void wfmain::getSetColor(QLedLabel *led, QLineEdit *line)
setColorElement(selColor, led, line);
}
QString wfmain::setColorFromString(QString colorstr, QLedLabel *led)
{
if(led==Q_NULLPTR)
return "ERROR";
if(!colorstr.startsWith("#"))
{
colorstr.prepend("#");
}
if(colorstr.length() != 9)
{
// TODO: Tell user about AA RR GG BB
return led->getColor().name(QColor::HexArgb);
}
led->setColor(colorstr, true);
return led->getColor().name(QColor::HexArgb);
}
void wfmain::on_colorSetBtnGrid_clicked()
{
getSetColor(ui->colorSwatchGrid, ui->colorLabelGrid);
}
void wfmain::on_colorSetBtnPlotBackground_clicked()
{
getSetColor(ui->colorSwatchPlotBackground, ui->colorLinePlotBackground);
}
void wfmain::on_colorLinePlotBackground_editingFinished()
{
QString c = ui->colorLinePlotBackground->text();
c = setColorFromString(c, ui->colorSwatchPlotBackground);
ui->colorLinePlotBackground->setText(c);
}

Wyświetl plik

@ -557,6 +557,10 @@ private slots:
void on_colorSetBtnGrid_clicked();
void on_colorSetBtnPlotBackground_clicked();
void on_colorLinePlotBackground_editingFinished();
private:
Ui::wfmain *ui;
void closeEvent(QCloseEvent *event);
@ -843,6 +847,7 @@ private:
QColor getColor(QColor initialColor);
void getSetColor(QLedLabel *led, QLabel *label);
void getSetColor(QLedLabel *led, QLineEdit *line);
QString setColorFromString(QString aarrggbb, QLedLabel *led);
quint64 roundFrequency(quint64 frequency, unsigned int tsHz);
quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\

Wyświetl plik

@ -3135,13 +3135,6 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_44">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_46">
<property name="text">
@ -3164,9 +3157,9 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_5">
<widget class="QPushButton" name="colorSetBtnPlotBackground">
<property name="text">
<string>PushButton</string>
<string>Plot Background...</string>
</property>
</widget>
</item>
@ -3195,18 +3188,34 @@
<widget class="QLedLabel" name="colorSwatchGrid" native="true">
<property name="minimumSize">
<size>
<width>15</width>
<height>15</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>15</width>
<height>15</height>
<width>65535</width>
<height>65535</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="colorLinePlotBackground">
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>#AARRGGBB</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLedLabel" name="colorSwatchPlotBackground" native="true"/>
</item>
</layout>
</widget>
</widget>