Optimize custom brightness command
This commit is contained in:
parent
26b371385a
commit
a1472a2546
@ -84,6 +84,7 @@ private:
|
|||||||
QFile *brightnessFile;
|
QFile *brightnessFile;
|
||||||
QFile *brightnessFileAlt;
|
QFile *brightnessFileAlt;
|
||||||
char brightness_str[5];
|
char brightness_str[5];
|
||||||
|
bool customBrightnessControl = false;
|
||||||
|
|
||||||
bool wifiButtonForce = false;
|
bool wifiButtonForce = false;
|
||||||
bool cameraButtonForce = false;
|
bool cameraButtonForce = false;
|
||||||
|
@ -212,6 +212,13 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
ui_->pushButtonBrightness->hide();
|
ui_->pushButtonBrightness->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFileInfo brightnessFileAlt(brightnessFilenameAlt);
|
||||||
|
|
||||||
|
if (brightnessFileAlt.exists()) {
|
||||||
|
ui_->pushButtonBrightness->show();
|
||||||
|
this->customBrightnessControl = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this->kodiButtonForce) {
|
if (!this->kodiButtonForce) {
|
||||||
ui_->pushButtonKodi->hide();
|
ui_->pushButtonKodi->hide();
|
||||||
}
|
}
|
||||||
@ -302,18 +309,21 @@ void f1x::openauto::autoapp::ui::MainWindow::on_horizontalSliderBrightness_value
|
|||||||
this->brightnessFile = new QFile(this->brightnessFilename);
|
this->brightnessFile = new QFile(this->brightnessFilename);
|
||||||
this->brightnessFileAlt = new QFile(this->brightnessFilenameAlt);
|
this->brightnessFileAlt = new QFile(this->brightnessFilenameAlt);
|
||||||
|
|
||||||
if (this->brightnessFile->open(QIODevice::WriteOnly)) {
|
if (!this->customBrightnessControl) {
|
||||||
this->brightness_str[n] = '\n';
|
if (this->brightnessFile->open(QIODevice::WriteOnly)) {
|
||||||
this->brightness_str[n+1] = '\0';
|
this->brightness_str[n] = '\n';
|
||||||
this->brightnessFile->write(this->brightness_str);
|
this->brightness_str[n+1] = '\0';
|
||||||
this->brightnessFile->close();
|
this->brightnessFile->write(this->brightness_str);
|
||||||
}
|
this->brightnessFile->close();
|
||||||
if (this->brightnessFileAlt->open(QIODevice::WriteOnly)) {
|
}
|
||||||
this->brightness_str[n] = '\n';
|
} else {
|
||||||
this->brightness_str[n+1] = '\0';
|
if (this->brightnessFileAlt->open(QIODevice::WriteOnly)) {
|
||||||
this->brightnessFileAlt->write(this->brightness_str);
|
this->brightness_str[n] = '\n';
|
||||||
this->brightnessFileAlt->close();
|
this->brightness_str[n+1] = '\0';
|
||||||
system("/usr/local/bin/autoapp_helper custombrightness &");
|
this->brightnessFileAlt->write(this->brightness_str);
|
||||||
|
this->brightnessFileAlt->close();
|
||||||
|
system("/usr/local/bin/autoapp_helper custombrightness &");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user