Cleanup code / Add auto close safety
This commit is contained in:
parent
e4ab3e0a29
commit
f16c3fe54c
BIN
assets/christmas.png
Normal file
BIN
assets/christmas.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 350 KiB |
BIN
assets/firework.png
Normal file
BIN
assets/firework.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 527 KiB |
@ -37,6 +37,8 @@
|
|||||||
<file>player-hot.png</file>
|
<file>player-hot.png</file>
|
||||||
<file>coverlogo.png</file>
|
<file>coverlogo.png</file>
|
||||||
<file>black.png</file>
|
<file>black.png</file>
|
||||||
|
<file>christmas.png</file>
|
||||||
|
<file>firework.png</file>
|
||||||
<file>Roboto-Regular.ttf</file>
|
<file>Roboto-Regular.ttf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -117,7 +117,6 @@ private slots:
|
|||||||
void customButtonPressed4();
|
void customButtonPressed4();
|
||||||
void customButtonPressed5();
|
void customButtonPressed5();
|
||||||
void customButtonPressed6();
|
void customButtonPressed6();
|
||||||
void customButtonPressed7();
|
|
||||||
void playerShow();
|
void playerShow();
|
||||||
void playerHide();
|
void playerHide();
|
||||||
void updateBG();
|
void updateBG();
|
||||||
@ -146,6 +145,7 @@ private slots:
|
|||||||
void setTrigger();
|
void setTrigger();
|
||||||
void setRetryUSBConnect();
|
void setRetryUSBConnect();
|
||||||
void resetRetryUSBMessage();
|
void resetRetryUSBMessage();
|
||||||
|
bool check_file_exist(const char *filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui_;
|
Ui::MainWindow* ui_;
|
||||||
@ -157,18 +157,24 @@ private:
|
|||||||
QFile *brightnessFileAlt;
|
QFile *brightnessFileAlt;
|
||||||
char brightness_str[6];
|
char brightness_str[6];
|
||||||
char volume_str[6];
|
char volume_str[6];
|
||||||
//char alpha_str[6];
|
|
||||||
int alpha_current_str;
|
int alpha_current_str;
|
||||||
QString bversion;
|
QString bversion;
|
||||||
QString bdate;
|
QString bdate;
|
||||||
|
|
||||||
QString custom_button_file_c1 = "/boot/crankshaft/button_1";
|
char nightModeFile[32] = "/tmp/night_mode_enabled";
|
||||||
QString custom_button_file_c2 = "/boot/crankshaft/button_2";
|
char devModeFile[32] = "/tmp/dev_mode_enabled";
|
||||||
QString custom_button_file_c3 = "/boot/crankshaft/button_3";
|
char wifiButtonFile[32] = "/etc/button_wifi_visible";
|
||||||
QString custom_button_file_c4 = "/boot/crankshaft/button_4";
|
char cameraButtonFile[32] = "/etc/button_camera_visible";
|
||||||
QString custom_button_file_c5 = "/boot/crankshaft/button_5";
|
char brightnessButtonFile[32] = "/etc/button_brightness_visible";
|
||||||
QString custom_button_file_c6 = "/boot/crankshaft/button_6";
|
char debugModeFile[32] = "/tmp/usb_debug_mode";
|
||||||
QString custom_button_file_c7 = "/boot/crankshaft/button_7";
|
char lsFile[32] = "/etc/cs_lightsensor";
|
||||||
|
|
||||||
|
char custom_button_file_c1[26] = "/boot/crankshaft/button_1";
|
||||||
|
char custom_button_file_c2[26] = "/boot/crankshaft/button_2";
|
||||||
|
char custom_button_file_c3[26] = "/boot/crankshaft/button_3";
|
||||||
|
char custom_button_file_c4[26] = "/boot/crankshaft/button_4";
|
||||||
|
char custom_button_file_c5[26] = "/boot/crankshaft/button_5";
|
||||||
|
char custom_button_file_c6[26] = "/boot/crankshaft/button_6";
|
||||||
|
|
||||||
QString custom_button_command_c1;
|
QString custom_button_command_c1;
|
||||||
QString custom_button_command_c2;
|
QString custom_button_command_c2;
|
||||||
@ -176,7 +182,6 @@ private:
|
|||||||
QString custom_button_command_c4;
|
QString custom_button_command_c4;
|
||||||
QString custom_button_command_c5;
|
QString custom_button_command_c5;
|
||||||
QString custom_button_command_c6;
|
QString custom_button_command_c6;
|
||||||
QString custom_button_command_c7;
|
|
||||||
|
|
||||||
QString custom_button_color_c1 = "186,189,192";
|
QString custom_button_color_c1 = "186,189,192";
|
||||||
QString custom_button_color_c2 = "186,189,192";
|
QString custom_button_color_c2 = "186,189,192";
|
||||||
@ -184,11 +189,11 @@ private:
|
|||||||
QString custom_button_color_c4 = "186,189,192";
|
QString custom_button_color_c4 = "186,189,192";
|
||||||
QString custom_button_color_c5 = "186,189,192";
|
QString custom_button_color_c5 = "186,189,192";
|
||||||
QString custom_button_color_c6 = "186,189,192";
|
QString custom_button_color_c6 = "186,189,192";
|
||||||
QString custom_button_color_c7 = "186,189,192";
|
|
||||||
|
|
||||||
QString selectedMp3file;
|
QString selectedMp3file;
|
||||||
QString musicfolder = "/media/CSSTORAGE/Music";
|
QString musicfolder = "/media/CSSTORAGE/Music";
|
||||||
QString albumfolder = "/";
|
QString albumfolder = "/";
|
||||||
|
QString date_text;
|
||||||
|
|
||||||
QMediaPlaylist *playlist;
|
QMediaPlaylist *playlist;
|
||||||
|
|
||||||
@ -230,7 +235,6 @@ private:
|
|||||||
bool c4ButtonForce = false;
|
bool c4ButtonForce = false;
|
||||||
bool c5ButtonForce = false;
|
bool c5ButtonForce = false;
|
||||||
bool c6ButtonForce = false;
|
bool c6ButtonForce = false;
|
||||||
bool c7ButtonForce = false;
|
|
||||||
|
|
||||||
bool hotspotActive = false;
|
bool hotspotActive = false;
|
||||||
int currentPlaylistIndex = 0;
|
int currentPlaylistIndex = 0;
|
||||||
@ -238,6 +242,7 @@ private:
|
|||||||
bool mediacontentchanged = true;
|
bool mediacontentchanged = true;
|
||||||
|
|
||||||
bool lightsensor = false;
|
bool lightsensor = false;
|
||||||
|
bool holidaybg = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,9 @@ public:
|
|||||||
~Warning() override;
|
~Warning() override;
|
||||||
|
|
||||||
Ui::Warning* ui_;
|
Ui::Warning* ui_;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void Autoclose();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,88 +61,26 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
this->configuration_ = configuration;
|
this->configuration_ = configuration;
|
||||||
|
|
||||||
// trigger files
|
// trigger files
|
||||||
QFileInfo nightModeFile("/tmp/night_mode_enabled");
|
this->nightModeEnabled = check_file_exist(this->nightModeFile);
|
||||||
this->nightModeEnabled = nightModeFile.exists();
|
this->devModeEnabled = check_file_exist(this->devModeFile);
|
||||||
|
this->wifiButtonForce = check_file_exist(this->wifiButtonFile);
|
||||||
QFileInfo devModeFile("/tmp/dev_mode_enabled");
|
this->cameraButtonForce = check_file_exist(this->cameraButtonFile);
|
||||||
this->devModeEnabled = devModeFile.exists();
|
this->brightnessButtonForce = check_file_exist(this->brightnessButtonFile);
|
||||||
|
this->systemDebugmode = check_file_exist(this->debugModeFile);
|
||||||
QFileInfo wifiButtonFile("/etc/button_wifi_visible");
|
this->lightsensor = check_file_exist(this->lsFile);
|
||||||
this->wifiButtonForce = wifiButtonFile.exists();
|
this->c1ButtonForce = check_file_exist(this->custom_button_file_c1);
|
||||||
|
this->c2ButtonForce = check_file_exist(this->custom_button_file_c2);
|
||||||
QFileInfo cameraButtonFile("/etc/button_camera_visible");
|
this->c3ButtonForce = check_file_exist(this->custom_button_file_c3);
|
||||||
this->cameraButtonForce = cameraButtonFile.exists();
|
this->c4ButtonForce = check_file_exist(this->custom_button_file_c4);
|
||||||
|
this->c5ButtonForce = check_file_exist(this->custom_button_file_c5);
|
||||||
QFileInfo brightnessButtonFile("/etc/button_brightness_visible");
|
this->c6ButtonForce = check_file_exist(this->custom_button_file_c6);
|
||||||
this->brightnessButtonForce = brightnessButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo DebugmodeFile("/tmp/usb_debug_mode");
|
|
||||||
this->systemDebugmode = DebugmodeFile.exists();
|
|
||||||
|
|
||||||
QFileInfo lightsensorFile("/etc/cs_lightsensor");
|
|
||||||
this->lightsensor = lightsensorFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c1ButtonFile(this->custom_button_file_c1);
|
|
||||||
this->c1ButtonForce = c1ButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c2ButtonFile(this->custom_button_file_c2);
|
|
||||||
this->c2ButtonForce = c2ButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c3ButtonFile(this->custom_button_file_c3);
|
|
||||||
this->c3ButtonForce = c3ButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c4ButtonFile(this->custom_button_file_c4);
|
|
||||||
this->c4ButtonForce = c4ButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c5ButtonFile(this->custom_button_file_c5);
|
|
||||||
this->c5ButtonForce = c5ButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c6ButtonFile(this->custom_button_file_c6);
|
|
||||||
this->c6ButtonForce = c6ButtonFile.exists();
|
|
||||||
|
|
||||||
QFileInfo c7ButtonFile(this->custom_button_file_c7);
|
|
||||||
this->c7ButtonForce = c7ButtonFile.exists();
|
|
||||||
|
|
||||||
// wallpaper stuff
|
// wallpaper stuff
|
||||||
QFileInfo wallpaperDayFile("wallpaper.png");
|
this->wallpaperDayFileExists = check_file_exist("wallpaper.png");
|
||||||
this->wallpaperDayFileExists = wallpaperDayFile.exists();
|
this->wallpaperNightFileExists = check_file_exist("wallpaper-night.png");
|
||||||
|
this->wallpaperClassicDayFileExists = check_file_exist("wallpaper-classic.png");
|
||||||
QFileInfo wallpaperNightFile("wallpaper-night.png");
|
this->wallpaperClassicNightFileExists = check_file_exist("wallpaper-classic-night.png");
|
||||||
this->wallpaperNightFileExists = wallpaperNightFile.exists();
|
this->wallpaperEQFileExists = check_file_exist("wallpaper-eq.png");
|
||||||
|
|
||||||
QFileInfo wallpaperClassicDayFile("wallpaper-classic.png");
|
|
||||||
this->wallpaperDayFileExists = wallpaperDayFile.exists();
|
|
||||||
|
|
||||||
QFileInfo wallpaperClassicNightFile("wallpaper-classic-night.png");
|
|
||||||
this->wallpaperNightFileExists = wallpaperNightFile.exists();
|
|
||||||
|
|
||||||
QFileInfo wallpaperEQFile("wallpaper-eq.png");
|
|
||||||
this->wallpaperEQFileExists = wallpaperEQFile.exists();
|
|
||||||
|
|
||||||
if (wallpaperDayFile.isSymLink()) {
|
|
||||||
QFileInfo linkTarget(wallpaperDayFile.symLinkTarget());
|
|
||||||
this->wallpaperDayFileExists = linkTarget.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wallpaperNightFile.isSymLink()) {
|
|
||||||
QFileInfo linkTarget(wallpaperNightFile.symLinkTarget());
|
|
||||||
this->wallpaperNightFileExists = linkTarget.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wallpaperClassicDayFile.isSymLink()) {
|
|
||||||
QFileInfo linkTarget(wallpaperClassicDayFile.symLinkTarget());
|
|
||||||
this->wallpaperClassicDayFileExists = linkTarget.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wallpaperClassicNightFile.isSymLink()) {
|
|
||||||
QFileInfo linkTarget(wallpaperClassicNightFile.symLinkTarget());
|
|
||||||
this->wallpaperClassicNightFileExists = linkTarget.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wallpaperEQFile.isSymLink()) {
|
|
||||||
QFileInfo linkTarget(wallpaperEQFile.symLinkTarget());
|
|
||||||
this->wallpaperEQFileExists = linkTarget.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
|
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
|
||||||
@ -445,38 +383,13 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set bg's on startup
|
// set bg's on startup
|
||||||
|
MainWindow::updateBG();
|
||||||
if (!this->nightModeEnabled) {
|
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; }");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ui_->pushButtonDay->hide();
|
ui_->pushButtonDay->hide();
|
||||||
ui_->pushButtonDay2->hide();
|
ui_->pushButtonDay2->hide();
|
||||||
ui_->pushButtonNight->show();
|
ui_->pushButtonNight->show();
|
||||||
ui_->pushButtonNight2->show();
|
ui_->pushButtonNight2->show();
|
||||||
} else {
|
} 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; }");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ui_->pushButtonNight->hide();
|
ui_->pushButtonNight->hide();
|
||||||
ui_->pushButtonNight2->hide();
|
ui_->pushButtonNight2->hide();
|
||||||
ui_->pushButtonDay->show();
|
ui_->pushButtonDay->show();
|
||||||
@ -517,7 +430,6 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// init alpha values
|
// init alpha values
|
||||||
//MainWindow::updateAlpha(int(configuration->getAlphaTrans()));
|
|
||||||
MainWindow::updateAlpha();
|
MainWindow::updateAlpha();
|
||||||
|
|
||||||
// Hide auto day/night if needed
|
// Hide auto day/night if needed
|
||||||
@ -615,10 +527,6 @@ void f1x::openauto::autoapp::ui::MainWindow::customButtonPressed6()
|
|||||||
system(qPrintable(this->custom_button_command_c6 + " &"));
|
system(qPrintable(this->custom_button_command_c6 + " &"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::customButtonPressed7()
|
|
||||||
{
|
|
||||||
system(qPrintable(this->custom_button_command_c7 + " &"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBrightness_clicked()
|
void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBrightness_clicked()
|
||||||
{
|
{
|
||||||
@ -783,19 +691,7 @@ void f1x::openauto::autoapp::ui::MainWindow::updateAlpha()
|
|||||||
void f1x::openauto::autoapp::ui::MainWindow::switchGuiToNight()
|
void f1x::openauto::autoapp::ui::MainWindow::switchGuiToNight()
|
||||||
{
|
{
|
||||||
MainWindow::on_pushButtonVolume_clicked();
|
MainWindow::on_pushButtonVolume_clicked();
|
||||||
if (this->oldGUIStyle) {
|
f1x::openauto::autoapp::ui::MainWindow::updateBG();
|
||||||
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_->pushButtonDay->show();
|
ui_->pushButtonDay->show();
|
||||||
ui_->pushButtonDay2->show();
|
ui_->pushButtonDay2->show();
|
||||||
ui_->pushButtonNight->hide();
|
ui_->pushButtonNight->hide();
|
||||||
@ -805,19 +701,7 @@ void f1x::openauto::autoapp::ui::MainWindow::switchGuiToNight()
|
|||||||
void f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay()
|
void f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay()
|
||||||
{
|
{
|
||||||
MainWindow::on_pushButtonVolume_clicked();
|
MainWindow::on_pushButtonVolume_clicked();
|
||||||
if (this->oldGUIStyle) {
|
f1x::openauto::autoapp::ui::MainWindow::updateBG();
|
||||||
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_->pushButtonNight->show();
|
ui_->pushButtonNight->show();
|
||||||
ui_->pushButtonNight2->show();
|
ui_->pushButtonNight2->show();
|
||||||
ui_->pushButtonDay->hide();
|
ui_->pushButtonDay->hide();
|
||||||
@ -942,32 +826,46 @@ void f1x::openauto::autoapp::ui::MainWindow::toggleGUI()
|
|||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::updateBG()
|
void f1x::openauto::autoapp::ui::MainWindow::updateBG()
|
||||||
{
|
{
|
||||||
if (!this->nightModeEnabled) {
|
if (this->date_text == "12/24") {
|
||||||
if (this->oldGUIStyle) {
|
this->setStyleSheet("QMainWindow { background: url(:/christmas.png); background-repeat: no-repeat; background-position: center; }");
|
||||||
if (this->wallpaperClassicDayFileExists) {
|
this->holidaybg = true;
|
||||||
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-classic.png); background-repeat: no-repeat; background-position: center; }") );
|
}
|
||||||
|
else if (this->date_text == "12/31") {
|
||||||
|
this->setStyleSheet("QMainWindow { background: url(:/firework.png); background-repeat: no-repeat; background-position: center; }");
|
||||||
|
this->holidaybg = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!this->nightModeEnabled) {
|
||||||
|
if (this->oldGUIStyle) {
|
||||||
|
if (this->wallpaperClassicDayFileExists) {
|
||||||
|
//this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-classic.png); background-repeat: no-repeat; background-position: center; }") );
|
||||||
|
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 {
|
} else {
|
||||||
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
|
if (this->wallpaperDayFileExists) {
|
||||||
|
//this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper.png); background-repeat: no-repeat; background-position: center; }") );
|
||||||
|
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 {
|
} else {
|
||||||
if (this->wallpaperDayFileExists) {
|
if (this->oldGUIStyle) {
|
||||||
this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper.png); background-repeat: no-repeat; background-position: center; }") );
|
if (this->wallpaperClassicNightFileExists) {
|
||||||
|
//this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-classic-night.png); background-repeat: no-repeat; background-position: center; }") );
|
||||||
|
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 {
|
} else {
|
||||||
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
|
if (this->wallpaperNightFileExists) {
|
||||||
}
|
//this->setStyleSheet( this->styleSheet().append("QMainWindow { background: url(wallpaper-night.png); background-repeat: no-repeat; background-position: center; }") );
|
||||||
}
|
this->setStyleSheet("QMainWindow { background: url(wallpaper-night.png); background-repeat: no-repeat; background-position: center; }");
|
||||||
} else {
|
} else {
|
||||||
if (this->oldGUIStyle) {
|
this->setStyleSheet("QMainWindow { background: url(:/black.png); background-repeat: no-repeat; background-position: center; }");
|
||||||
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; }");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -996,13 +894,26 @@ void f1x::openauto::autoapp::ui::MainWindow::setUnMute()
|
|||||||
void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
||||||
{
|
{
|
||||||
QTime time=QTime::currentTime();
|
QTime time=QTime::currentTime();
|
||||||
|
QDate date=QDate::currentDate();
|
||||||
QString time_text=time.toString("hh : mm : ss");
|
QString time_text=time.toString("hh : mm : ss");
|
||||||
|
this->date_text=date.toString("MM/dd");
|
||||||
|
|
||||||
if ((time.second() % 2) == 0) {
|
if ((time.second() % 2) == 0) {
|
||||||
time_text[3] = ' ';
|
time_text[3] = ' ';
|
||||||
time_text[8] = ' ';
|
time_text[8] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_->Digital_clock->setText(time_text);
|
ui_->Digital_clock->setText(time_text);
|
||||||
ui_->bigClock->setText(time_text);
|
ui_->bigClock->setText(time_text);
|
||||||
|
|
||||||
|
if (!this->holidaybg) {
|
||||||
|
if (this->date_text == "12/24") {
|
||||||
|
MainWindow::updateBG();
|
||||||
|
}
|
||||||
|
else if (this->date_text == "12/31") {
|
||||||
|
MainWindow::updateBG();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1341,6 +1252,24 @@ void f1x::openauto::autoapp::ui::MainWindow::on_StateChanged(QMediaPlayer::State
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool f1x::openauto::autoapp::ui::MainWindow::check_file_exist(const char *fileName)
|
||||||
|
{
|
||||||
|
std::ifstream ifile(fileName, std::ios::in);
|
||||||
|
// file not ok - checking if symlink
|
||||||
|
if (!ifile.good()) {
|
||||||
|
QFileInfo linkFile = QString(fileName);
|
||||||
|
if (linkFile.isSymLink()) {
|
||||||
|
QFileInfo linkTarget(linkFile.symLinkTarget());
|
||||||
|
return linkTarget.exists();
|
||||||
|
} else {
|
||||||
|
return ifile.good();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ifile.good();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -1400,8 +1329,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if bluetooth available
|
// check if bluetooth available
|
||||||
QFileInfo bluetoothButtonFile("/tmp/button_bluetooth_visible");
|
this->bluetoothEnabled = check_file_exist("/tmp/button_bluetooth_visible");
|
||||||
this->bluetoothEnabled = bluetoothButtonFile.exists();
|
|
||||||
|
|
||||||
if (this->bluetoothEnabled) {
|
if (this->bluetoothEnabled) {
|
||||||
if (ui_->pushButtonBluetooth->isVisible() == false) {
|
if (ui_->pushButtonBluetooth->isVisible() == false) {
|
||||||
@ -1473,8 +1401,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update day/night state
|
// update day/night state
|
||||||
QFileInfo nightModeFile("/tmp/night_mode_enabled");
|
this->nightModeEnabled = check_file_exist("/tmp/night_mode_enabled");
|
||||||
this->nightModeEnabled = nightModeFile.exists();
|
|
||||||
|
|
||||||
if (this->nightModeEnabled) {
|
if (this->nightModeEnabled) {
|
||||||
if (!this->DayNightModeState) {
|
if (!this->DayNightModeState) {
|
||||||
@ -1492,9 +1419,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
|||||||
if (this->cameraButtonForce) {
|
if (this->cameraButtonForce) {
|
||||||
|
|
||||||
// check if dashcam is recording
|
// check if dashcam is recording
|
||||||
QFileInfo dashCamRecordingFile("/tmp/dashcam_is_recording");
|
this->dashCamRecording = check_file_exist("/tmp/dashcam_is_recording");
|
||||||
this->dashCamRecording = dashCamRecordingFile.exists();
|
|
||||||
|
|
||||||
// show recording state if dashcam is visible
|
// show recording state if dashcam is visible
|
||||||
if (ui_->cameraWidget->isVisible() == true) {
|
if (ui_->cameraWidget->isVisible() == true) {
|
||||||
if (this->dashCamRecording) {
|
if (this->dashCamRecording) {
|
||||||
@ -1511,9 +1436,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if rearcam is eanbled
|
// check if rearcam is eanbled
|
||||||
QFileInfo rearCamFile("/tmp/rearcam_enabled");
|
this->rearCamEnabled = check_file_exist("/tmp/rearcam_enabled");
|
||||||
this->rearCamEnabled = rearCamFile.exists();
|
|
||||||
|
|
||||||
if (this->rearCamEnabled) {
|
if (this->rearCamEnabled) {
|
||||||
if (!this->rearCamVisible) {
|
if (!this->rearCamVisible) {
|
||||||
this->rearCamVisible = true;
|
this->rearCamVisible = true;
|
||||||
@ -1532,8 +1455,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
|
|||||||
f1x::openauto::autoapp::ui::MainWindow::MainWindow::exit();
|
f1x::openauto::autoapp::ui::MainWindow::MainWindow::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo hotspotFile("/tmp/hotspot_active");
|
this->hotspotActive = check_file_exist("/tmp/hotspot_active");
|
||||||
this->hotspotActive = hotspotFile.exists();
|
|
||||||
|
|
||||||
// hide wifi if hotspot disabled
|
// hide wifi if hotspot disabled
|
||||||
if (!this->hotspotActive) {
|
if (!this->hotspotActive) {
|
||||||
|
@ -328,6 +328,19 @@ void SettingsWindow::onSave()
|
|||||||
params.append("1");
|
params.append("1");
|
||||||
}
|
}
|
||||||
params.append("#");
|
params.append("#");
|
||||||
|
if(ui_->radioButtonAnimatedCSNG->isChecked())
|
||||||
|
{
|
||||||
|
params.append("0");
|
||||||
|
}
|
||||||
|
else if(ui_->radioButtonCSNG->isChecked())
|
||||||
|
{
|
||||||
|
params.append("1");
|
||||||
|
}
|
||||||
|
else if(ui_->radioButtonCustom->isChecked())
|
||||||
|
{
|
||||||
|
params.append("2");
|
||||||
|
}
|
||||||
|
params.append("#");
|
||||||
|
|
||||||
system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str());
|
system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str());
|
||||||
|
|
||||||
@ -910,6 +923,15 @@ void SettingsWindow::loadSystemValues()
|
|||||||
} else {
|
} else {
|
||||||
ui_->checkBoxDisableDayNightRTC->setChecked(true);
|
ui_->checkBoxDisableDayNightRTC->setChecked(true);
|
||||||
}
|
}
|
||||||
|
if (getparams[43] == "csnganimation") {
|
||||||
|
ui_->radioButtonAnimatedCSNG->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (getparams[43] == "crankshaft") {
|
||||||
|
ui_->radioButtonCSNG->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (getparams[43] == "custom") {
|
||||||
|
ui_->radioButtonCustom->setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <f1x/openauto/autoapp/UI/Warning.hpp>
|
#include <f1x/openauto/autoapp/UI/Warning.hpp>
|
||||||
#include <ui_warning.h>
|
#include <ui_warning.h>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace f1x
|
namespace f1x
|
||||||
{
|
{
|
||||||
@ -17,6 +18,7 @@ Warning::Warning(QWidget *parent)
|
|||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
connect(ui_->pushButtonClose, &QPushButton::clicked, this, &Warning::close);
|
connect(ui_->pushButtonClose, &QPushButton::clicked, this, &Warning::close);
|
||||||
|
QTimer::singleShot(5000, this, SLOT(Autoclose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Warning::~Warning()
|
Warning::~Warning()
|
||||||
@ -24,6 +26,11 @@ Warning::~Warning()
|
|||||||
delete ui_;
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Warning::Autoclose()
|
||||||
|
{
|
||||||
|
Warning::close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -239,7 +239,7 @@ int main(int argc, char* argv[])
|
|||||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() {
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() {
|
||||||
OPENAUTO_LOG(info) << "[CS] Manual start android auto entity by reset usb.";
|
OPENAUTO_LOG(info) << "[CS] Manual start android auto entity by reset usb.";
|
||||||
if (std::ifstream("/tmp/android_device")) {
|
if (std::ifstream("/tmp/android_device")) {
|
||||||
system("/usr/local/bin/autoapp_helper usbreset &");
|
system("/usr/local/bin/autoapp_helper usbreset");
|
||||||
app->waitForUSBDevice();
|
app->waitForUSBDevice();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -251,7 +251,6 @@ int main(int argc, char* argv[])
|
|||||||
usleep(500000);
|
usleep(500000);
|
||||||
app->stop();
|
app->stop();
|
||||||
} else {
|
} else {
|
||||||
//app->onAndroidAutoQuit();
|
|
||||||
app->stop();
|
app->stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -261,6 +260,7 @@ int main(int argc, char* argv[])
|
|||||||
app->waitForUSBDevice();
|
app->waitForUSBDevice();
|
||||||
|
|
||||||
auto result = qApplication.exec();
|
auto result = qApplication.exec();
|
||||||
|
|
||||||
std::for_each(threadPool.begin(), threadPool.end(), std::bind(&std::thread::join, std::placeholders::_1));
|
std::for_each(threadPool.begin(), threadPool.end(), std::bind(&std::thread::join, std::placeholders::_1));
|
||||||
|
|
||||||
libusb_exit(usbContext);
|
libusb_exit(usbContext);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user