Add blackscreen option for custom commands

This commit is contained in:
hawkeyexp 2018-09-30 00:52:24 +02:00
parent 4d90184c22
commit 902d450e21
2 changed files with 56 additions and 1 deletions

View File

@ -476,10 +476,14 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
if (this->oldGUIStyle) {
if (this->wallpaperClassicDayFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper-classic.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
} else {
if (this->wallpaperDayFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
}
ui_->pushButtonDay->hide();
@ -490,10 +494,14 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
if (this->oldGUIStyle) {
if (this->wallpaperClassicNightFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper-classic-night.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
} else {
if (this->wallpaperNightFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper-night.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
}
ui_->pushButtonNight->hide();
@ -944,20 +952,28 @@ void f1x::openauto::autoapp::ui::MainWindow::toggleGUI()
if (this->oldGUIStyle) {
if (this->wallpaperClassicDayFileExists) {
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-classic.png); background-repeat: no-repeat; background-position: center; }") );
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
} else {
if (this->wallpaperDayFileExists) {
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper.png); background-repeat: no-repeat; background-position: center; }") );
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
}
} else {
if (this->oldGUIStyle) {
if (this->wallpaperClassicNightFileExists) {
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-classic-night.png); background-repeat: no-repeat; background-position: center; }") );
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
} else {
if (this->wallpaperNightFileExists) {
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-night.png); background-repeat: no-repeat; background-position: center; }") );
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
}
}
@ -1003,6 +1019,45 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
}
}
// check if custom command needs black background
QFileInfo blackFile("/tmp/blackscreen");
if (blackFile.exists()) {
if (ui_->centralWidget->isVisible() == true) {
ui_->centralWidget->hide();
this->setStyleSheet("QMainWindow {background-color: rgb(0,0,0);}");
}
} else {
if (!this->nightModeEnabled) {
if (this->oldGUIStyle) {
if (this->wallpaperClassicDayFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper-classic.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
} else {
if (this->wallpaperDayFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
}
} else {
if (this->oldGUIStyle) {
if (this->wallpaperClassicNightFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper-classic-night.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
} else {
if (this->wallpaperNightFileExists) {
this->setStyleSheet("QMainWindow { background: url(wallpaper-night.png); background-repeat: no-repeat; background-position: center; }");
} else {
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
}
}
}
}
// check if phone is conencted to usb
QFileInfo phoneConnectedFile("/tmp/android_device");
if (phoneConnectedFile.exists()) {

View File

@ -31,7 +31,7 @@
<string>MainWindow</string>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
<string notr="true">color: rgb(0, 0, 0);</string>
</property>
<widget class="QWidget" name="centralWidget">
<property name="enabled">