Add Hex color value box
This commit is contained in:
parent
9c2d30bbbd
commit
95d9998398
3 changed files with 83 additions and 25 deletions
|
|
@ -1360,6 +1360,38 @@ void Ui::OpenRGBDevicePage::on_ValSpinBox_valueChanged(int val)
|
|||
colorChanged();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_HexLineEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Make an editable copy of the string |
|
||||
\*-----------------------------------------------------*/
|
||||
QString temp = arg1;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Remove # character so that #XXXXXX color codes are |
|
||||
| acceptable. 0xXXXXXX codes are already accepted by |
|
||||
| toInt(). Convert into an RGBColor. Mask off the |
|
||||
| unused bits. |
|
||||
\*-----------------------------------------------------*/
|
||||
RGBColor color = (RGBColor)(0x00FFFFFF & temp.replace("#", "").toInt(NULL, 16));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Store new color into the current color QColor |
|
||||
\*-----------------------------------------------------*/
|
||||
current_color.setRed(RGBGetRValue(color));
|
||||
current_color.setGreen(RGBGetGValue(color));
|
||||
current_color.setBlue(RGBGetBValue(color));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Update the color UI, but set the UpdateHex flag to |
|
||||
| false so the hex edit box isn't updated while the user|
|
||||
| is in the middle of typing a value. |
|
||||
\*-----------------------------------------------------*/
|
||||
UpdateHex = false;
|
||||
colorChanged();
|
||||
UpdateHex = true;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBDevicePage::on_DeviceViewBox_selectionChanged(QVector<int> indices)
|
||||
{
|
||||
if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED)
|
||||
|
|
@ -1694,4 +1726,14 @@ void Ui::OpenRGBDevicePage::updateColorUi()
|
|||
ui->ValSpinBox->blockSignals(true);
|
||||
ui->ValSpinBox->setValue(current_color.value());
|
||||
ui->ValSpinBox->blockSignals(false);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Update Hex edit box |
|
||||
\*-----------------------------------------------------*/
|
||||
if(UpdateHex)
|
||||
{
|
||||
ui->HexLineEdit->blockSignals(true);
|
||||
ui->HexLineEdit->setText(QString().asprintf("%06X", (0x00FFFFFF & current_color.rgb())));
|
||||
ui->HexLineEdit->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ private slots:
|
|||
void on_SatSpinBox_valueChanged(int sat);
|
||||
void on_BlueSpinBox_valueChanged(int blue);
|
||||
void on_ValSpinBox_valueChanged(int val);
|
||||
void on_HexLineEdit_textChanged(const QString &arg1);
|
||||
void on_DeviceViewBox_selectionChanged(QVector<int>);
|
||||
|
||||
void on_SetAllButton_clicked();
|
||||
|
|
@ -68,6 +69,7 @@ private:
|
|||
bool InvertedBrightness = false;
|
||||
bool MultipleSelected = false;
|
||||
bool DeviceViewShowing = false;
|
||||
bool UpdateHex = true;
|
||||
|
||||
QColor current_color;
|
||||
void updateColorUi();
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
<property name="windowTitle">
|
||||
<string>Device page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="3,1">
|
||||
<layout class="QGridLayout" name="OpenRGBDevicePageUiGridLayout" rowstretch="0,0" columnstretch="3,1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<widget class="QFrame" name="ColorFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
|
@ -26,21 +26,21 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
<enum>QFrame::Shadow::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3" rowstretch="10,0,0,0,0,0" columnstretch="0">
|
||||
<layout class="QGridLayout" name="ColorGridLayout" rowstretch="10,0,0,0" columnstretch="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<widget class="QFrame" name="ColorEntryFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<enum>QFrame::Shape::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,1,0,1">
|
||||
<layout class="QGridLayout" name="ColorEntryGridLayout" columnstretch="0,1,0,1">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
|
@ -137,16 +137,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="HexLabel">
|
||||
<property name="text">
|
||||
<string>Hex:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="HexLineEdit">
|
||||
<property name="maxLength">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QPushButton" name="DeviceSaveButton">
|
||||
<property name="text">
|
||||
<string>Save To Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="ColorWheel" name="ColorWheelBox" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -170,11 +177,18 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="DeviceSaveButton">
|
||||
<property name="text">
|
||||
<string>Save To Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<widget class="QFrame" name="ControlsFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
|
@ -185,12 +199,12 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
<enum>QFrame::Shadow::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,1,1">
|
||||
<layout class="QGridLayout" name="ControlsGridLayout" columnstretch="0,1,1,1">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="SpeedLabel">
|
||||
<property name="text">
|
||||
|
|
@ -228,7 +242,7 @@
|
|||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QTooltipedSlider" name="SpeedSlider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -304,7 +318,7 @@
|
|||
<item row="7" column="1" colspan="3">
|
||||
<widget class="QTooltipedSlider" name="BrightnessSlider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -339,12 +353,12 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
<enum>QFrame::Shadow::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QGridLayout" name="DeviceViewBoxGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="DeviceView" name="DeviceViewBox" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue