added checkbox for adaptive Brightness
This commit is contained in:
parent
1939b2521f
commit
2382ba7473
|
@ -6,6 +6,7 @@ LightMux::LightMux()
|
|||
brightness = 50;
|
||||
power_cold = 0;
|
||||
power_warm = 0;
|
||||
power_combined = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,10 +43,10 @@ void LightMux::mux(){
|
|||
power_cold = static_cast<int>(double(power_cold * (double(brightness/100.0))) + .5);
|
||||
power_warm = static_cast<int>(double(power_warm * (double(brightness/100.0))) + .5);
|
||||
|
||||
|
||||
|
||||
qDebug("cold color: %i\nwarm color: %i\n", power_cold, power_warm);
|
||||
|
||||
power_combined = static_cast<int>(double(power_cold+power_warm) / 2.0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,6 +127,16 @@ void LightMux::setTemperature(int requested_val){
|
|||
}
|
||||
}
|
||||
|
||||
void LightMux::toogleAdaptiveBrightness(){
|
||||
adaptive_brightness = !adaptive_brightness;
|
||||
|
||||
if(adaptive_brightness){
|
||||
qDebug("adaptive brightness enabled\n");
|
||||
} else{
|
||||
qDebug("adaptive brightness disabled\n");
|
||||
}
|
||||
}
|
||||
|
||||
int LightMux::getBrightness(){
|
||||
return brightness;
|
||||
}
|
||||
|
@ -149,3 +160,7 @@ int LightMux::getPowerCold(){
|
|||
int LightMux::getPowerWarm(){
|
||||
return power_warm;
|
||||
}
|
||||
|
||||
int LightMux::getPowerCombined(){
|
||||
return power_combined;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@ private:
|
|||
|
||||
int power_cold; // power of the cold LEDs of Panels in percent
|
||||
int power_warm; // power of the warm LEDs of Panels in percent
|
||||
int power_combined; //combined power of both LEDs in percent
|
||||
|
||||
bool adaptive_brightness; // true indecates adaptive brightness is enabled
|
||||
|
||||
public:
|
||||
LightMux();
|
||||
|
@ -41,6 +44,10 @@ public:
|
|||
int getPowerCold();
|
||||
int getPowerWarm();
|
||||
|
||||
int getPowerCombined();
|
||||
|
||||
void toogleAdaptiveBrightness();
|
||||
|
||||
};
|
||||
|
||||
#endif // LIGHTMUX_H
|
||||
|
|
|
@ -37,17 +37,23 @@ void MainWindow::updateUI()
|
|||
|
||||
setLablePowerCold(lmux->getPowerCold());
|
||||
setLablePowerWarm(lmux->getPowerWarm());
|
||||
setLablePowerCombined(lmux->getPowerCombined());
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setLablePowerCold(int val)
|
||||
{
|
||||
ui->labelPowerCold->setText("Output Power Cold: " + QString::number(val) + " %");
|
||||
ui->labelPowerCold->setText("Output Power Cold: " + QString::number(val) + "%");
|
||||
}
|
||||
|
||||
void MainWindow::setLablePowerWarm(int val)
|
||||
{
|
||||
ui->labelPowerWarm->setText("Output Power Warm: " + QString::number(val) + " %");
|
||||
ui->labelPowerWarm->setText("Output Power Warm: " + QString::number(val) + "%");
|
||||
}
|
||||
|
||||
void MainWindow::setLablePowerCombined(int val)
|
||||
{
|
||||
ui->labelPowerCombined->setText("Combined Power: " + QString::number(val) + "%");
|
||||
}
|
||||
|
||||
void MainWindow::on_BtnIncreaseBrightness_clicked()
|
||||
|
@ -104,3 +110,8 @@ void MainWindow::on_lineTemperature_returnPressed()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::on_checkBox_stateChanged()
|
||||
{
|
||||
lmux->toogleAdaptiveBrightness();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
~MainWindow();
|
||||
void setLablePowerCold(int val);
|
||||
void setLablePowerWarm(int val);
|
||||
void setLablePowerCombined(int val);
|
||||
|
||||
private slots:
|
||||
void on_BtnIncreaseBrightness_clicked();
|
||||
|
@ -36,6 +37,8 @@ private slots:
|
|||
|
||||
void on_lineTemperature_returnPressed();
|
||||
|
||||
void on_checkBox_stateChanged();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
LightMux *lmux;
|
||||
|
|
|
@ -230,7 +230,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>220</y>
|
||||
<y>240</y>
|
||||
<width>201</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
|
@ -243,7 +243,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>250</y>
|
||||
<y>270</y>
|
||||
<width>211</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
|
@ -272,6 +272,32 @@
|
|||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelPowerCombined">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>300</y>
|
||||
<width>211</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Combined Power:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>210</y>
|
||||
<width>151</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>adaptive brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 22 KiB |
Loading…
Reference in New Issue