From e5c031774ef615368f2be606cc7c51ad91a858a6 Mon Sep 17 00:00:00 2001 From: hawkeyexp Date: Sat, 3 Nov 2018 12:16:10 +0100 Subject: [PATCH] Rework triggers / usb /network --- .../f1x/openauto/autoapp/UI/MainWindow.hpp | 7 + .../openauto/autoapp/UI/SettingsWindow.hpp | 5 + src/autoapp/Projection/RtAudioOutput.cpp | 1 - src/autoapp/UI/MainWindow.cpp | 702 +++++++++--------- src/autoapp/UI/SettingsWindow.cpp | 93 ++- src/autoapp/UI/USBDialog.cpp | 47 +- src/autoapp/UI/mainwindow.ui | 516 ++++++++----- src/autoapp/UI/settingswindow.ui | 696 ++++++++--------- src/autoapp/autoapp.cpp | 3 +- 9 files changed, 1141 insertions(+), 929 deletions(-) diff --git a/include/f1x/openauto/autoapp/UI/MainWindow.hpp b/include/f1x/openauto/autoapp/UI/MainWindow.hpp index d45ee4f..4b0a887 100644 --- a/include/f1x/openauto/autoapp/UI/MainWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/MainWindow.hpp @@ -41,6 +41,7 @@ #include #include +#include namespace Ui { @@ -63,6 +64,8 @@ public: explicit MainWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent = nullptr); ~MainWindow() override; QMediaPlayer* player; + QFileSystemWatcher* watcher; + QFileSystemWatcher* watcher_tmp; signals: void exit(); @@ -137,6 +140,8 @@ private slots: void on_StateChanged(QMediaPlayer::State state); void scanFolders(); void scanFiles(); + void tmpChanged(); + void setTrigger(); private: Ui::MainWindow* ui_; @@ -223,6 +228,8 @@ private: int currentPlaylistIndex = 0; bool background_set = false; + + bool mediacontentchanged = true; }; } diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index 9bb502e..ef3b094 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -24,6 +24,7 @@ #include class QCheckBox; +class QTimer; namespace Ui { @@ -62,6 +63,7 @@ private slots: void syncNTPTime(); void on_pushButtonRescan_clicked(); void on_pushButtonAudioTest_clicked(); + void updateNetworkInfo(); private slots: void show_tab1(); @@ -83,6 +85,9 @@ private: Ui::SettingsWindow* ui_; configuration::IConfiguration::Pointer configuration_; + + QString hotspotssid; + QString wifissid; }; } diff --git a/src/autoapp/Projection/RtAudioOutput.cpp b/src/autoapp/Projection/RtAudioOutput.cpp index 45897ad..aa12a8a 100644 --- a/src/autoapp/Projection/RtAudioOutput.cpp +++ b/src/autoapp/Projection/RtAudioOutput.cpp @@ -54,7 +54,6 @@ bool RtAudioOutput::open() RtAudio::StreamOptions streamOptions; streamOptions.flags = RTAUDIO_MINIMIZE_LATENCY | RTAUDIO_SCHEDULE_REALTIME; uint32_t bufferFrames = sampleRate_ == 16000 ? 1024 : 2048; //according to the observation of audio packets - //dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast(this), &streamOptions); dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast(this), &streamOptions); OPENAUTO_LOG(info) << "[RtAudioOutput] Sample Rate: " << sampleRate_; return audioBuffer_.open(QIODevice::ReadWrite); diff --git a/src/autoapp/UI/MainWindow.cpp b/src/autoapp/UI/MainWindow.cpp index 76c574b..3fe06d1 100644 --- a/src/autoapp/UI/MainWindow.cpp +++ b/src/autoapp/UI/MainWindow.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace f1x { @@ -164,49 +165,21 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi connect(ui_->pushButtonMusic2, &QPushButton::clicked, this, &MainWindow::playerShow); connect(ui_->pushButtonBack, &QPushButton::clicked, this, &MainWindow::playerHide); connect(ui_->pushButtonPlayerBack, &QPushButton::clicked, this, &MainWindow::playerHide); - connect(ui_->pushButtonUSB, &QPushButton::clicked, this, &MainWindow::openUSBDialog); - connect(ui_->pushButtonRescan, &QPushButton::clicked, this, &MainWindow::scanFolders); + //connect(ui_->pushButtonUSB, &QPushButton::clicked, this, &MainWindow::openUSBDialog); // by default hide bluetooth button on init ui_->pushButtonBluetooth->hide(); // by default hide media player ui_->mediaWidget->hide(); + ui_->pushButtonUSB->hide(); + + ui_->SysinfoTopLeft->hide(); QTimer *timer=new QTimer(this); connect(timer, SIGNAL(timeout()),this,SLOT(showTime())); timer->start(1000); - // Build Version string for mainscreen - // Get git version string - //QFileInfo vFile("/etc/crankshaft.build"); - //if (vFile.exists()) { - // QFile versionFile(QString("/etc/crankshaft.build")); - // versionFile.open(QIODevice::ReadOnly); - // QTextStream data_version(&versionFile); - // QString lineversion = data_version.readAll(); - // versionFile.close(); - // this->bversion=lineversion.simplified(); - //} else { - // this->bversion="unknown"; - //} - - // Get date string - //QFileInfo dFile("/etc/crankshaft.build"); - //if (dFile.exists()) { - // QFile dateFile(QString("/etc/crankshaft.date")); - // dateFile.open(QIODevice::ReadOnly); - // QTextStream data_date(&dateFile); - // QString linedate = data_date.readAll(); - // dateFile.close(); - // this->bdate=linedate.simplified(); - //} else { - // this->bdate="- - -"; - //} - - //QString buildid = "Build: " + this->bversion + " (" + this->bdate + ")"; - //ui_->BuildID->setText(buildid); - // enable connects while cam is enabled if (this->cameraButtonForce) { connect(ui_->pushButtonCameraShow, &QPushButton::clicked, this, &MainWindow::cameraShow); @@ -571,13 +544,17 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->labelFolderpath->hide(); ui_->labelAlbumpath->hide(); - // link possible existing media - system(qPrintable("ln -s /media/CSSTORAGE/Music/* /media/MYMEDIA")); - system(qPrintable("/usr/local/bin/autoapp_helper cleansymlinks")); - MainWindow::scanFolders(); ui_->comboBoxAlbum->setCurrentText(QString::fromStdString(configuration->getMp3SubFolder())); MainWindow::scanFiles(); + + watcher = new QFileSystemWatcher(this); + watcher->addPath("/media/USBDRIVES"); + connect(watcher, &QFileSystemWatcher::directoryChanged, this, &MainWindow::setTrigger); + + watcher_tmp = new QFileSystemWatcher(this); + watcher_tmp->addPath("/tmp"); + connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &MainWindow::tmpChanged); } MainWindow::~MainWindow() @@ -977,6 +954,7 @@ void f1x::openauto::autoapp::ui::MainWindow::toggleGUI() } } } + f1x::openauto::autoapp::ui::MainWindow::tmpChanged(); } void f1x::openauto::autoapp::ui::MainWindow::createDebuglog() @@ -1006,266 +984,7 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime() if ((time.second() % 2) == 0) { time_text[3] = ' '; time_text[8] = ' '; - - // check if system is in display off mode (tap2wake) - QFileInfo blankFile("/tmp/blankscreen"); - if (blankFile.exists()) { - if (ui_->centralWidget->isVisible() == true) { - ui_->centralWidget->hide(); - } - } else { - if (ui_->centralWidget->isVisible() == false) { - ui_->centralWidget->show(); - } - } - - // 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);}"); - this->background_set = false; - } - } else { - if (this->background_set == false) { - 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; }"); - } - } - } - this->background_set = true; - } - } - - // check if phone is conencted to usb - QFileInfo phoneConnectedFile("/tmp/android_device"); - if (phoneConnectedFile.exists()) { - if (ui_->phoneConnected->isVisible() == false) { - ui_->phoneConnected->setText("USB connected"); - ui_->phoneConnected->show(); - } - } else { - if (ui_->phoneConnected->isVisible() == true) { - ui_->phoneConnected->hide(); - } - } - - // check if bluetooth available - QFileInfo bluetoothButtonFile("/tmp/button_bluetooth_visible"); - this->bluetoothEnabled = bluetoothButtonFile.exists(); - - if (this->bluetoothEnabled) { - if (ui_->pushButtonBluetooth->isVisible() == false) { - ui_->pushButtonBluetooth->show(); - } - } else { - if (ui_->pushButtonBluetooth->isVisible() == true) { - ui_->pushButtonBluetooth->hide(); - } - } - - // check if a device is connected via bluetooth - QFileInfo phoneBTConnectedFile("/tmp/btdevice"); - if (phoneBTConnectedFile.exists()) { - if (ui_->btDevice->isVisible() == false) { - QFile phoneBTData(QString("/tmp/btdevice")); - phoneBTData.open(QIODevice::ReadOnly); - QTextStream data_date(&phoneBTData); - QString linedate = data_date.readAll(); - phoneBTData.close(); - ui_->btDevice->setText(linedate.simplified()); - ui_->btDevice->show(); - } - } else { - if (ui_->btDevice->isVisible() == true) { - ui_->btDevice->hide(); - } - } - - // check the need for system messages - QFileInfo configInProgressFile("/tmp/config_in_progress"); - QFileInfo debugInProgressFile("/tmp/debug_in_progress"); - QFileInfo enablePairingFile("/tmp/enable_pairing"); - - if (configInProgressFile.exists() || debugInProgressFile.exists() || enablePairingFile.exists()) { - if (ui_->systemConfigInProgress->isVisible() == false) { - if (configInProgressFile.exists()) { - ui_->systemConfigInProgress->setText("System config in progress - please wait ..."); - ui_->pushButtonSettings->hide(); - ui_->pushButtonSettings2->hide(); - ui_->pushButtonLock->show(); - ui_->pushButtonLock2->show(); - ui_->systemConfigInProgress->show(); - } - if (debugInProgressFile.exists()) { - ui_->systemConfigInProgress->setText("Creating debug.zip on /boot - please wait ..."); - ui_->pushButtonSettings->hide(); - ui_->pushButtonSettings2->hide(); - ui_->pushButtonDebug->hide(); - ui_->pushButtonDebug2->hide(); - ui_->pushButtonLock->show(); - ui_->pushButtonLock2->show(); - ui_->systemConfigInProgress->show(); - } - if (enablePairingFile.exists()) { - ui_->systemConfigInProgress->setText("Auto Bluetooth Pairing enabled for 120 seconds!"); - ui_->pushButtonDebug->hide(); - ui_->pushButtonDebug2->hide(); - ui_->systemConfigInProgress->show(); - } - } - } else { - if (ui_->systemConfigInProgress->isVisible() == true) { - ui_->systemConfigInProgress->hide(); - ui_->pushButtonSettings->show(); - ui_->pushButtonSettings2->show(); - ui_->pushButtonLock->hide(); - ui_->pushButtonLock2->hide(); - if (this->systemDebugmode) { - ui_->pushButtonDebug->show(); - ui_->pushButtonDebug2->show(); - } - } - } - - // update day/night state - QFileInfo nightModeFile("/tmp/night_mode_enabled"); - this->nightModeEnabled = nightModeFile.exists(); - - if (this->nightModeEnabled) { - if (!this->DayNightModeState) { - this->DayNightModeState = true; - f1x::openauto::autoapp::ui::MainWindow::switchGuiToNight(); - } - } else { - if (this->DayNightModeState) { - this->DayNightModeState = false; - f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay(); - } - } - - // camera stuff - if (this->cameraButtonForce) { - - // check if dashcam is recording - QFileInfo dashCamRecordingFile("/tmp/dashcam_is_recording"); - this->dashCamRecording = dashCamRecordingFile.exists(); - - // show recording state if dashcam is visible - if (ui_->cameraWidget->isVisible() == true) { - if (this->dashCamRecording) { - if (ui_->pushButtonRecord->isVisible() == true) { - ui_->pushButtonRecordActive->show(); - ui_->pushButtonRecord->hide(); - } - } else { - if (ui_->pushButtonRecordActive->isVisible() == true) { - ui_->pushButtonRecord->show(); - ui_->pushButtonRecordActive->hide(); - } - } - } - - // check if rearcam is eanbled - QFileInfo rearCamFile("/tmp/rearcam_enabled"); - this->rearCamEnabled = rearCamFile.exists(); - - if (this->rearCamEnabled) { - if (!this->rearCamVisible) { - this->rearCamVisible = true; - f1x::openauto::autoapp::ui::MainWindow::MainWindow::showRearCam(); - } - } else { - if (this->rearCamVisible) { - this->rearCamVisible = false; - f1x::openauto::autoapp::ui::MainWindow::MainWindow::hideRearCam(); - } - } - } - - // check if sutdown is external triggered and init clean app exit - QFileInfo externalExitFile("/tmp/external_exit"); - if (externalExitFile.exists()) { - f1x::openauto::autoapp::ui::MainWindow::MainWindow::exit(); - } - - QFileInfo hotspotFile("/tmp/hotspot_active"); - this->hotspotActive = hotspotFile.exists(); - - // hide wifi if not forced - if (!this->hotspotActive) { - if ((ui_->pushButtonWifi->isVisible() == true) || (ui_->pushButtonWifi2->isVisible() == true)){ - ui_->pushButtonWifi->hide(); - ui_->pushButtonWifi2->hide(); - if (!this->cameraButtonForce) { - ui_->pushButtonDummyCamWifi->show(); - } - } - } else { - if ((ui_->pushButtonWifi->isVisible() == false) || (ui_->pushButtonWifi2->isVisible() == false)) { - ui_->pushButtonWifi->show(); - ui_->pushButtonWifi2->show(); - ui_->pushButtonDummyCamWifi->hide(); - } - } } - - // handle dummys in classic menu - int button_count = 0; - if (ui_->pushButtonCameraShow2->isVisible() == true) { - button_count = button_count + 1; - } - if (ui_->pushButtonToggleGUI2->isVisible() == true) { - button_count = button_count + 1; - } - if (ui_->pushButtonWifi2->isVisible() == true) { - button_count = button_count + 1; - } - if (ui_->pushButtonDebug2->isVisible() == true) { - button_count = button_count + 1; - } - if (button_count >= 3) { - ui_->pushButtonDummyClassic1->hide(); - ui_->pushButtonDummyClassic2->hide(); - } - if (button_count == 2) { - ui_->pushButtonDummyClassic1->hide(); - ui_->pushButtonDummyClassic2->hide(); - } - if (button_count == 1) { - ui_->pushButtonDummyClassic1->show(); - ui_->pushButtonDummyClassic2->hide(); - } - if (button_count == 0) { - ui_->pushButtonDummyClassic1->show(); - ui_->pushButtonDummyClassic2->show(); - } - ui_->Digital_clock->setText(time_text); ui_->bigClock->setText(time_text); } @@ -1289,7 +1008,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonList_clicked() ui_->pushButtonList->hide(); ui_->pushButtonPlayerPlayList->show(); ui_->pushButtonBackToPlayer->show(); - ui_->pushButtonUSB->show(); + //ui_->pushButtonUSB->show(); } void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerStop_clicked() @@ -1308,7 +1027,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerStop_clicked() ui_->playerPositionTime->setText("00:00 / 00:00"); ui_->labelCurrentPlaying->setText(""); ui_->labelTrack->setText(""); - ui_->pushButtonUSB->show(); + //ui_->pushButtonUSB->show(); } void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerPause_clicked() @@ -1434,71 +1153,100 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerPlayList_clicked ui_->pushButtonPlayerPause->show(); int currentalbum = ui_->comboBoxAlbum->currentIndex(); ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1)); - ui_->pushButtonUSB->hide(); + //ui_->pushButtonUSB->hide(); } void f1x::openauto::autoapp::ui::MainWindow::on_comboBoxAlbum_currentIndexChanged(const QString &arg1) { this->albumfolder = arg1; - f1x::openauto::autoapp::ui::MainWindow::scanFiles(); + MainWindow::scanFiles(); +} + +void f1x::openauto::autoapp::ui::MainWindow::setTrigger() +{ + this->mediacontentchanged = true; + + ui_->SysinfoTopLeft->setText("Media changed - Scanning ..."); + ui_->SysinfoTopLeft->show(); + + //QTimer *timerscan=new QTimer(this); + //connect(timerscan, SIGNAL(timeout()),this,SLOT(scanFolders())); + //timerscan->start(10000); + // Start delayed folderscan after usb event + QTimer::singleShot(10000, this, SLOT(scanFolders())); } void f1x::openauto::autoapp::ui::MainWindow::scanFolders() { - int cleaner = ui_->comboBoxAlbum->count(); - while (cleaner > -1) { - ui_->comboBoxAlbum->removeItem(cleaner); - cleaner--; - } - QDir directory(this->musicfolder); - QStringList folders = directory.entryList(QStringList() << "*", QDir::AllDirs, QDir::Name); - foreach (QString foldername, folders) { - if (foldername != "..") { - ui_->comboBoxAlbum->addItem(foldername); - ui_->labelAlbumCount->setText(QString::number(ui_->comboBoxAlbum->count())); + try { + if (this->mediacontentchanged == true) { + this->mediacontentchanged = false; + int cleaner = ui_->comboBoxAlbum->count(); + while (cleaner > -1) { + ui_->comboBoxAlbum->removeItem(cleaner); + cleaner--; + } + QDir directory(this->musicfolder); + QStringList folders = directory.entryList(QStringList() << "*", QDir::AllDirs, QDir::Name); + foreach (QString foldername, folders) { + if (foldername != "..") { + ui_->comboBoxAlbum->addItem(foldername); + ui_->labelAlbumCount->setText(QString::number(ui_->comboBoxAlbum->count())); + } + } + this->currentPlaylistIndex = 0; + ui_->SysinfoTopLeft->hide(); + //timerscan->stop(); } } - this->currentPlaylistIndex = 0; + catch(...) { + ui_->SysinfoTopLeft->hide(); + //timerscan->stop(); + qDebug() << "Fail in Folderscan"; + } + } void f1x::openauto::autoapp::ui::MainWindow::scanFiles() { - int cleaner = ui_->mp3List->count(); - while (cleaner > -1) { - ui_->mp3List->takeItem(cleaner); - cleaner--; - } - this->playlist->clear(); - - QList content; - QDir directory(this->musicfolder + "/" + this->albumfolder); - QStringList mp3s = directory.entryList(QStringList() << "*.mp3" << "*.flac" << "*.aac" << "*.ogg" << "*.mp4" << "*.mp4a" << "*.wma",QDir::Files, QDir::Name); - foreach (QString filename, mp3s) { - // add to mediacontent - content.push_back(QMediaContent(QUrl::fromLocalFile(this->musicfolder + "/" + this->albumfolder + "/" + filename))); - // add items to gui - // read metadata using taglib - try { - TagLib::FileRef file((this->musicfolder + "/" + this->albumfolder + "/" + filename).toUtf8(),true); - TagLib::String artist_string = file.tag()->artist(); - TagLib::String title_string = file.tag()->title(); - TagLib::uint track_string = file.tag()->track(); - QString artistid3 = QString::fromStdWString(artist_string.toCWString()); - QString titleid3 = QString::fromStdWString(title_string.toCWString()); - QString trackid3 = QString::number(track_string); - int tracklength = trackid3.length(); - if (tracklength < 2) { - trackid3 = "0" + trackid3; - } - QString ID3Entry = trackid3 + ": " + artistid3 + " - " + titleid3; - ui_->mp3List->addItem(ID3Entry); - } catch (...) { - // old way only adding filename to list - ui_->mp3List->addItem(filename); + if (this->mediacontentchanged == false) { + int cleaner = ui_->mp3List->count(); + while (cleaner > -1) { + ui_->mp3List->takeItem(cleaner); + cleaner--; } + this->playlist->clear(); + + QList content; + QDir directory(this->musicfolder + "/" + this->albumfolder); + QStringList mp3s = directory.entryList(QStringList() << "*.mp3" << "*.flac" << "*.aac" << "*.ogg" << "*.mp4" << "*.mp4a" << "*.wma",QDir::Files, QDir::Name); + foreach (QString filename, mp3s) { + // add to mediacontent + content.push_back(QMediaContent(QUrl::fromLocalFile(this->musicfolder + "/" + this->albumfolder + "/" + filename))); + // add items to gui + // read metadata using taglib + try { + TagLib::FileRef file((this->musicfolder + "/" + this->albumfolder + "/" + filename).toUtf8(),true); + TagLib::String artist_string = file.tag()->artist(); + TagLib::String title_string = file.tag()->title(); + TagLib::uint track_string = file.tag()->track(); + QString artistid3 = QString::fromStdWString(artist_string.toCWString()); + QString titleid3 = QString::fromStdWString(title_string.toCWString()); + QString trackid3 = QString::number(track_string); + int tracklength = trackid3.length(); + if (tracklength < 2) { + trackid3 = "0" + trackid3; + } + QString ID3Entry = trackid3 + ": " + artistid3 + " - " + titleid3; + ui_->mp3List->addItem(ID3Entry); + } catch (...) { + // old way only adding filename to list + ui_->mp3List->addItem(filename); + } + } + // set playlist + this->playlist->addMedia(content); } - // set playlist - this->playlist->addMedia(content); } void f1x::openauto::autoapp::ui::MainWindow::on_mp3List_currentRowChanged(int currentRow) @@ -1558,7 +1306,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBackToPlayer_clicked() ui_->pushButtonBackToPlayer->hide(); ui_->pushButtonPlayerPlayList->hide(); ui_->pushButtonList->show(); - ui_->pushButtonUSB->hide(); + //ui_->pushButtonUSB->hide(); } void f1x::openauto::autoapp::ui::MainWindow::on_StateChanged(QMediaPlayer::State state) @@ -1569,3 +1317,265 @@ void f1x::openauto::autoapp::ui::MainWindow::on_StateChanged(QMediaPlayer::State system("touch /tmp/media_playing"); } } + +void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() +{ + // check if system is in display off mode (tap2wake) + QFileInfo blankFile("/tmp/blankscreen"); + if (blankFile.exists()) { + if (ui_->centralWidget->isVisible() == true) { + ui_->centralWidget->hide(); + } + } else { + if (ui_->centralWidget->isVisible() == false) { + ui_->centralWidget->show(); + } + } + + // 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);}"); + this->background_set = false; + } + } else { + if (this->background_set == false) { + 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; }"); + } + } + } + this->background_set = true; + } + } + + // check if phone is conencted to usb + QFileInfo phoneConnectedFile("/tmp/android_device"); + if (phoneConnectedFile.exists()) { + if (ui_->phoneConnected->isVisible() == false) { + ui_->phoneConnected->setText("USB connected"); + ui_->phoneConnected->show(); + } + } else { + if (ui_->phoneConnected->isVisible() == true) { + ui_->phoneConnected->hide(); + } + } + + // check if bluetooth available + QFileInfo bluetoothButtonFile("/tmp/button_bluetooth_visible"); + this->bluetoothEnabled = bluetoothButtonFile.exists(); + + if (this->bluetoothEnabled) { + if (ui_->pushButtonBluetooth->isVisible() == false) { + ui_->pushButtonBluetooth->show(); + } + } else { + if (ui_->pushButtonBluetooth->isVisible() == true) { + ui_->pushButtonBluetooth->hide(); + } + } + + // check if a device is connected via bluetooth + QFileInfo phoneBTConnectedFile("/tmp/btdevice"); + if (phoneBTConnectedFile.exists()) { + if (ui_->btDevice->isVisible() == false) { + QFile phoneBTData(QString("/tmp/btdevice")); + phoneBTData.open(QIODevice::ReadOnly); + QTextStream data_date(&phoneBTData); + QString linedate = data_date.readAll(); + phoneBTData.close(); + ui_->btDevice->setText(linedate.simplified()); + ui_->btDevice->show(); + } + } else { + if (ui_->btDevice->isVisible() == true) { + ui_->btDevice->hide(); + } + } + + // check the need for system messages + QFileInfo configInProgressFile("/tmp/config_in_progress"); + QFileInfo debugInProgressFile("/tmp/debug_in_progress"); + QFileInfo enablePairingFile("/tmp/enable_pairing"); + + if (configInProgressFile.exists() || debugInProgressFile.exists() || enablePairingFile.exists()) { + if (ui_->systemConfigInProgress->isVisible() == false) { + if (configInProgressFile.exists()) { + ui_->systemConfigInProgress->setText("System config in progress - please wait ..."); + ui_->pushButtonSettings->hide(); + ui_->pushButtonSettings2->hide(); + ui_->pushButtonLock->show(); + ui_->pushButtonLock2->show(); + ui_->systemConfigInProgress->show(); + } + if (debugInProgressFile.exists()) { + ui_->systemConfigInProgress->setText("Creating debug.zip on /boot - please wait ..."); + ui_->pushButtonSettings->hide(); + ui_->pushButtonSettings2->hide(); + ui_->pushButtonDebug->hide(); + ui_->pushButtonDebug2->hide(); + ui_->pushButtonLock->show(); + ui_->pushButtonLock2->show(); + ui_->systemConfigInProgress->show(); + } + if (enablePairingFile.exists()) { + ui_->systemConfigInProgress->setText("Auto Bluetooth Pairing enabled for 120 seconds!"); + ui_->pushButtonDebug->hide(); + ui_->pushButtonDebug2->hide(); + ui_->systemConfigInProgress->show(); + } + } + } else { + if (ui_->systemConfigInProgress->isVisible() == true) { + ui_->systemConfigInProgress->hide(); + ui_->pushButtonSettings->show(); + ui_->pushButtonSettings2->show(); + ui_->pushButtonLock->hide(); + ui_->pushButtonLock2->hide(); + if (this->systemDebugmode) { + ui_->pushButtonDebug->show(); + ui_->pushButtonDebug2->show(); + } + } + } + + // update day/night state + QFileInfo nightModeFile("/tmp/night_mode_enabled"); + this->nightModeEnabled = nightModeFile.exists(); + + if (this->nightModeEnabled) { + if (!this->DayNightModeState) { + this->DayNightModeState = true; + f1x::openauto::autoapp::ui::MainWindow::switchGuiToNight(); + } + } else { + if (this->DayNightModeState) { + this->DayNightModeState = false; + f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay(); + } + } + + // camera stuff + if (this->cameraButtonForce) { + + // check if dashcam is recording + QFileInfo dashCamRecordingFile("/tmp/dashcam_is_recording"); + this->dashCamRecording = dashCamRecordingFile.exists(); + + // show recording state if dashcam is visible + if (ui_->cameraWidget->isVisible() == true) { + if (this->dashCamRecording) { + if (ui_->pushButtonRecord->isVisible() == true) { + ui_->pushButtonRecordActive->show(); + ui_->pushButtonRecord->hide(); + } + } else { + if (ui_->pushButtonRecordActive->isVisible() == true) { + ui_->pushButtonRecord->show(); + ui_->pushButtonRecordActive->hide(); + } + } + } + + // check if rearcam is eanbled + QFileInfo rearCamFile("/tmp/rearcam_enabled"); + this->rearCamEnabled = rearCamFile.exists(); + + if (this->rearCamEnabled) { + if (!this->rearCamVisible) { + this->rearCamVisible = true; + f1x::openauto::autoapp::ui::MainWindow::MainWindow::showRearCam(); + } + } else { + if (this->rearCamVisible) { + this->rearCamVisible = false; + f1x::openauto::autoapp::ui::MainWindow::MainWindow::hideRearCam(); + } + } + } + + // check if sutdown is external triggered and init clean app exit + QFileInfo externalExitFile("/tmp/external_exit"); + if (externalExitFile.exists()) { + f1x::openauto::autoapp::ui::MainWindow::MainWindow::exit(); + } + + QFileInfo hotspotFile("/tmp/hotspot_active"); + this->hotspotActive = hotspotFile.exists(); + + // hide wifi if not forced + if (!this->hotspotActive) { + if ((ui_->pushButtonWifi->isVisible() == true) || (ui_->pushButtonWifi2->isVisible() == true)){ + ui_->pushButtonWifi->hide(); + ui_->pushButtonWifi2->hide(); + if (!this->cameraButtonForce) { + ui_->pushButtonDummyCamWifi->show(); + } + } + } else { + if ((ui_->pushButtonWifi->isVisible() == false) || (ui_->pushButtonWifi2->isVisible() == false)) { + ui_->pushButtonWifi->show(); + ui_->pushButtonWifi2->show(); + ui_->pushButtonDummyCamWifi->hide(); + } + } + + // handle dummys in classic menu + int button_count = 0; + if (ui_->pushButtonCameraShow2->isVisible() == true) { + button_count = button_count + 1; + } + if (ui_->pushButtonToggleGUI2->isVisible() == true) { + button_count = button_count + 1; + } + if (ui_->pushButtonWifi2->isVisible() == true) { + button_count = button_count + 1; + } + if (ui_->pushButtonDebug2->isVisible() == true) { + button_count = button_count + 1; + } + if (button_count >= 3) { + ui_->pushButtonDummyClassic1->hide(); + ui_->pushButtonDummyClassic2->hide(); + } + if (button_count == 2) { + ui_->pushButtonDummyClassic1->hide(); + ui_->pushButtonDummyClassic2->hide(); + } + if (button_count == 1) { + ui_->pushButtonDummyClassic1->show(); + ui_->pushButtonDummyClassic2->hide(); + } + if (button_count == 0) { + ui_->pushButtonDummyClassic1->show(); + ui_->pushButtonDummyClassic2->show(); + } + //qDebug() << "/tmp changed"; +} diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index 537c317..8477422 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -23,8 +23,11 @@ #include #include #include +#include #include #include +#include +#include namespace f1x { @@ -57,12 +60,11 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat connect(ui_->horizontalSliderSystemVolume, &QSlider::valueChanged, this, &SettingsWindow::onUpdateSystemVolume); connect(ui_->horizontalSliderSystemCapture, &QSlider::valueChanged, this, &SettingsWindow::onUpdateSystemCapture); connect(ui_->pushButtonHotspotStart, &QPushButton::clicked, this, &SettingsWindow::onStartHotspot); - connect(ui_->pushButtonHotspotStart , &QPushButton::clicked, this, &SettingsWindow::close); connect(ui_->pushButtonHotspotStop, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); - connect(ui_->pushButtonHotspotStop , &QPushButton::clicked, this, &SettingsWindow::close); connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime); connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close); - connect(ui_->pushButtonNTP , &QPushButton::clicked, this, &SettingsWindow::close); + //connect(ui_->pushButtonSetTime, &QPushButton::clicked, [&]() { &SettingsWindow::setTime; &SettingsWindow::close; }); + connect(ui_->pushButtonNTP, &QPushButton::clicked, this, &SettingsWindow::close); // menu ui_->tab1->show(); @@ -73,14 +75,18 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat ui_->tab6->hide(); ui_->tab7->hide(); ui_->tab8->hide(); + ui_->horizontalGroupBox->hide(); - ui_->groupBoxNetworking->hide(); + ui_->labelBluetoothAdapterAddress->hide(); + ui_->lineEditExternalBluetoothAdapterAddress->hide(); + ui_->labelTestInProgress->hide(); connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); connect(ui_->pushButtonTab3, &QPushButton::clicked, this, &SettingsWindow::show_tab3); connect(ui_->pushButtonTab4, &QPushButton::clicked, this, &SettingsWindow::show_tab4); connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::show_tab5); + connect(ui_->pushButtonTab5, &QPushButton::clicked, this, &SettingsWindow::updateNetworkInfo); connect(ui_->pushButtonTab6, &QPushButton::clicked, this, &SettingsWindow::show_tab6); connect(ui_->pushButtonTab7, &QPushButton::clicked, this, &SettingsWindow::show_tab7); connect(ui_->pushButtonTab8, &QPushButton::clicked, this, &SettingsWindow::show_tab8); @@ -90,8 +96,22 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat QString time_text_minute=time.toString("mm"); ui_->spinBoxHour->setValue((time_text_hour).toInt()); ui_->spinBoxMinute->setValue((time_text_minute).toInt()); + SettingsWindow::on_pushButtonRescan_clicked(); - ui_->labelTestInProgress->hide(); + ui_->label_modeswitchprogress->hide(); + + QFileInfo hotspotFile("/tmp/hotspot_active"); + if (hotspotFile.exists()) { + ui_->pushButtonHotspotStop->show(); + ui_->pushButtonHotspotStart->hide(); + ui_->lineEdit_wifimode->setText("Hotspot"); + ui_->lineEditWifiSSID->setText(this->hotspotssid); + } else { + ui_->pushButtonHotspotStart->show(); + ui_->pushButtonHotspotStop->hide(); + ui_->lineEdit_wifimode->setText("Client"); + ui_->lineEditWifiSSID->setText(this->wifissid); + } } SettingsWindow::~SettingsWindow() @@ -648,7 +668,8 @@ void SettingsWindow::loadSystemValues() ui_->spinBoxGPIOShutdownDelay->setValue(getparams[29].toInt()); // Wifi Credentials - ui_->lineEditWifiClientSSID->setText(getparams[30]); + //ui_->lineEditWifiSSID->setText(getparams[30]); + this->wifissid = getparams[30]; // Wifi Hotspot Credentials if (getparams[31] == "1") { @@ -657,7 +678,7 @@ void SettingsWindow::loadSystemValues() ui_->checkBoxHotspot->setChecked(false); } - ui_->lineEditWifiHotspotSSID->setText(getparams[32]); + this->hotspotssid = getparams[32]; // set cam ui_->comboBoxCam->setCurrentText(getparams[33]); @@ -724,12 +745,26 @@ void SettingsWindow::onShowBindings() void SettingsWindow::onStartHotspot() { + ui_->label_modeswitchprogress->show(); + ui_->pushButtonHotspotStart->hide(); + ui_->pushButtonHotspotStop->hide(); + ui_->lineEdit_wifimode->setText(""); + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); system("sudo systemctl start hotspot &"); + QTimer::singleShot(15000, this, SLOT(updateNetworkInfo())); } void SettingsWindow::onStopHotspot() { + ui_->label_modeswitchprogress->show(); + ui_->pushButtonHotspotStart->hide(); + ui_->pushButtonHotspotStop->hide(); + ui_->lineEdit_wifimode->setText(""); + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); system("sudo systemctl stop hotspot &"); + QTimer::singleShot(15000, this, SLOT(updateNetworkInfo())); } void SettingsWindow::show_tab1() @@ -860,3 +895,47 @@ void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked( ui_->pushButtonAudioTest->show(); ui_->labelTestInProgress->hide(); } + +void f1x::openauto::autoapp::ui::SettingsWindow::updateNetworkInfo() +{ + QNetworkInterface eth0if = QNetworkInterface::interfaceFromName("eth0"); + if (eth0if.flags().testFlag(QNetworkInterface::IsUp)) { + QList entrieseth0 = eth0if.addressEntries(); + if (!entrieseth0.isEmpty()) { + QNetworkAddressEntry eth0 = entrieseth0.first(); + //qDebug() << "eth0: " << eth0.ip(); + ui_->lineEdit_eth0->setText(eth0.ip().toString()); + } + } else { + //qDebug() << "eth0: down"; + ui_->lineEdit_eth0->setText("interface down"); + } + + QNetworkInterface wlan0if = QNetworkInterface::interfaceFromName("wlan0"); + if (wlan0if.flags().testFlag(QNetworkInterface::IsUp)) { + QList entrieswlan0 = wlan0if.addressEntries(); + if (!entrieswlan0.isEmpty()) { + QNetworkAddressEntry wlan0 = entrieswlan0.first(); + //qDebug() << "wlan0: " << wlan0.ip(); + ui_->lineEdit_wlan0->setText(wlan0.ip().toString()); + } + } else { + //qDebug() << "wlan0: down"; + ui_->lineEdit_wlan0->setText("interface down"); + } + + QFileInfo hotspotFile("/tmp/hotspot_active"); + if (hotspotFile.exists()) { + ui_->pushButtonHotspotStop->show(); + ui_->pushButtonHotspotStart->hide(); + ui_->label_modeswitchprogress->hide(); + ui_->lineEdit_wifimode->setText("Hotspot"); + ui_->lineEditWifiSSID->setText(this->hotspotssid); + } else { + ui_->pushButtonHotspotStart->show(); + ui_->pushButtonHotspotStop->hide(); + ui_->label_modeswitchprogress->hide(); + ui_->lineEdit_wifimode->setText("Client"); + ui_->lineEditWifiSSID->setText(this->wifissid); + } +} diff --git a/src/autoapp/UI/USBDialog.cpp b/src/autoapp/UI/USBDialog.cpp index 8b7bfda..4f6797f 100644 --- a/src/autoapp/UI/USBDialog.cpp +++ b/src/autoapp/UI/USBDialog.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace f1x { @@ -23,6 +24,7 @@ USBDialog::USBDialog(QWidget *parent) connect(ui_->pushButtonClose, &QPushButton::clicked, this, &USBDialog::close); connect(ui_->pushButtonUpdate, &QPushButton::clicked, this, &USBDialog::scanDrives); scanDrives(); + ui_->listWidgetUSB->setCurrentRow(0); } USBDialog::~USBDialog() @@ -97,28 +99,45 @@ void f1x::openauto::autoapp::ui::USBDialog::scanDrives() currentdevice++; } system("/usr/local/bin/autoapp_helper cleansymlinks &"); + ui_->listWidgetUSB->setCurrentRow(0); } void f1x::openauto::autoapp::ui::USBDialog::on_pushButtonMount_clicked() { QString selected = ui_->listWidgetUSB->item(ui_->listWidgetUSB->currentRow())->text(); - QString mountfulldevicepath = selected.split(" ")[0]; - QString mountdevice = mountfulldevicepath.split("/")[2]; - system(qPrintable("sudo umount -f " + mountfulldevicepath)); - system(qPrintable("sudo fuser -km /media/USBDRIVES/" + mountdevice)); - system(qPrintable("sudo mkdir -p /media/USBDRIVES/" + mountdevice)); - system(qPrintable("sudo chmod 777 /media/USBDRIVES/" + mountdevice)); - system(qPrintable("sudo mount " + mountfulldevicepath + " /media/USBDRIVES/" + mountdevice)); - system(qPrintable("ln -s /media/USBDRIVES/" + mountdevice + "/Music/* /media/MYMEDIA")); - scanDrives(); + if (ui_->listWidgetUSB->count() > 0 && selected.contains("/dev/")) { + QString mountfulldevicepath = selected.split(" ")[0]; + QString mountdevice = mountfulldevicepath.split("/")[2]; + + system(qPrintable("sudo umount -f " + mountfulldevicepath + " >/dev/null")); + system(qPrintable("sudo fuser -km /media/USBDRIVES/" + mountdevice + " >/dev/null")); + system(qPrintable("sudo mkdir -p /media/USBDRIVES/" + mountdevice + " >/dev/null")); + system(qPrintable("sudo chmod 777 /media/USBDRIVES/" + mountdevice + " >/dev/null")); + system(qPrintable("sudo mount " + mountfulldevicepath + " /media/USBDRIVES/" + mountdevice + " >/dev/null")); + system(qPrintable("ln -s /media/USBDRIVES/" + mountdevice + "/Music/* /media/MYMEDIA >/dev/null")); + scanDrives(); + } else { + QMessageBox errorMessage(QMessageBox::Critical, "Select error", "Nothing selected!", QMessageBox::Ok); + errorMessage.setWindowFlags(Qt::WindowStaysOnTopHint); + errorMessage.exec(); + } + ui_->listWidgetUSB->setCurrentRow(0); } void f1x::openauto::autoapp::ui::USBDialog::on_pushButtonRemove_clicked() { QString selected = ui_->listWidgetUSB->item(ui_->listWidgetUSB->currentRow())->text(); - QString mountfulldevicepath = selected.split(" ")[0]; - QString mountdevice = mountfulldevicepath.split("/")[2]; - system(qPrintable("sudo umount -f " + mountfulldevicepath)); - system(qPrintable("sudo fuser -km /media/USBDRIVES/" + mountdevice)); - scanDrives(); + if (ui_->listWidgetUSB->count() > 0 && selected.contains("/dev/")) { + QString mountfulldevicepath = selected.split(" ")[0]; + QString mountdevice = mountfulldevicepath.split("/")[2]; + + system(qPrintable("sudo umount -f " + mountfulldevicepath + " >/dev/null" + " && sudo rmdir /media/USBDRIVES/" + mountdevice + " >/dev/null")); + system(qPrintable("sudo fuser -km /media/USBDRIVES/" + mountdevice + " >/dev/null" + " && sudo rmdir /media/USBDRIVES/" + mountdevice + " >/dev/null")); + scanDrives(); + } else { + QMessageBox errorMessage(QMessageBox::Critical, "Select error", "Nothing selected!", QMessageBox::Ok); + errorMessage.setWindowFlags(Qt::WindowStaysOnTopHint); + errorMessage.exec(); + } + ui_->listWidgetUSB->setCurrentRow(0); } diff --git a/src/autoapp/UI/mainwindow.ui b/src/autoapp/UI/mainwindow.ui index fd8ed7b..fb67d37 100644 --- a/src/autoapp/UI/mainwindow.ui +++ b/src/autoapp/UI/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1011 - 1295 + 862 + 1297 @@ -98,7 +98,7 @@ - 6 + 0 @@ -183,13 +183,13 @@ color: rgb(255, 255, 255); 0 - 22 + 24 16777215 - 22 + 24 @@ -212,9 +212,9 @@ color: rgb(255, 255, 255); 0 - + - + 0 0 @@ -222,128 +222,244 @@ color: rgb(255, 255, 255); 0 - 22 + 24 16777215 - 22 + 24 - - - 8 - 75 - true - - - - background-color: rgba(0, 0, 0, 0); -color: rgb(255, 255, 255); - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + 10 + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(78, 244, 37); + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + - - - 6 + + + + 0 + 0 + - - - - - 0 - 0 - - - - - 75 - true - - - - background-color: rgba(255, 255, 255, 0); + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 75 + true + + + + background-color: rgba(255, 255, 255, 0); color: rgb(255, 255, 255); - - - USB Connected - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 75 - true - - - - background-color: rgba(255, 255, 255, 0); + + + USB Connected + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 75 + true + + + + background-color: rgba(255, 255, 255, 0); color: rgb(0, 102, 255); - - - BT-Device - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 80 - 20 - - - - - 80 - 20 - - - - - 0 - 0 - - - - background-color: rgb(32, 74, 135); + + + BT-Device + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 80 + 22 + + + + + 80 + 22 + + + + + 0 + 0 + + + + background-color: rgb(32, 74, 135); color: rgb(239, 239, 239); outline: none; - - - BT-Pairing - - - - + + + BT-Pairing + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + @@ -2257,78 +2373,6 @@ QScrollBar { true - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - - - - - 100 - 45 - - - - - 100 - 45 - - - - background-color: rgba(117, 80, 123, 0.9); -color: rgb(0, 0, 0); -border-radius: 4px; -border: 2px solid rgba(255,255,255,0.5); -outline: none; - - - - - - - :/reboot-hot.png - - - - - 32 - 32 - - @@ -2641,6 +2685,19 @@ background-color: rgba(0, 0, 0, 0); + + + + Qt::Horizontal + + + + 5 + 20 + + + + @@ -2651,13 +2708,13 @@ background-color: rgba(0, 0, 0, 0); - 100 + 90 0 - 100 + 90 16777215 @@ -2680,6 +2737,19 @@ background-color: rgba(0, 0, 0, 0); + + + + Qt::Horizontal + + + + 5 + 20 + + + + @@ -2690,13 +2760,13 @@ background-color: rgba(0, 0, 0, 0); - 100 + 90 0 - 100 + 90 16777215 @@ -2719,6 +2789,19 @@ background-color: rgba(0, 0, 0, 0); + + + + Qt::Horizontal + + + + 5 + 20 + + + + @@ -2919,6 +3002,19 @@ outline: none; + + + + Qt::Horizontal + + + + 5 + 20 + + + + @@ -2929,13 +3025,13 @@ outline: none; - 100 + 90 0 - 100 + 90 16777215 @@ -2958,6 +3054,19 @@ outline: none; + + + + Qt::Horizontal + + + + 5 + 20 + + + + @@ -2968,13 +3077,13 @@ outline: none; - 100 + 90 0 - 100 + 90 16777215 @@ -2997,6 +3106,19 @@ outline: none; + + + + Qt::Horizontal + + + + 5 + 20 + + + + @@ -3556,6 +3678,12 @@ outline: none; 30 + + + 75 + true + + background-color: rgb(92, 231, 57); color: rgb(0, 0, 0); diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index a9e657f..3aa3394 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 3271 + 963 + 3125 @@ -2206,7 +2206,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 2 - 9 + 2 @@ -2333,84 +2333,10 @@ outline: none; 0 - - - - - - - - - - - - - 0 - 0 - - - - Wifi client settings - - - - 2 - - - 9 - - - - - - 0 - 0 - - - - - 9 - - - 2 - - - 9 - - - 2 - - - - - - 100 - 0 - - - - Used SSID: - - - - - - - - 0 - 0 - - - + 200 - 0 - - - - - 0 - 0 + 16777215 @@ -2426,301 +2352,339 @@ outline: none; Networking - - - - - No wifi network - - - - - - - wifi client - - - - - - - wifi hotspot - - - - - - - - - - - 0 - 0 - - - - Hotspot settings - - + 2 - 9 + 2 - - - - - 0 - 0 - + + + + 2 - - - 9 - - - 2 - - - 9 - - - 2 - - - - - Enabled - - - - - - - - 0 - 0 - - - - - 2 - - - - - <html><head/><body><p><img src=":/ico_info.png"/></p></body></html> - - - - - - - - 10 - true - - - - If enabled Hotspot will start on boot and Start/Stop buttons will work. - - - - - - - - - - - 0 - 0 - - - - - 100 - 35 - - - - - 16777215 - 35 - - - - Used SSID: - - - - - - - - 100 - 32 - - - - - 16777215 - 32 - - - - background-color: rgb(78, 154, 6); + + 2 + + + + + + 130 + 0 + + + + + 130 + 16777215 + + + + IP-Address (eth0) + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + + 75 + true + + + + background-color: rgb(78, 154, 6); outline: none; - - - Start - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - Start hotspot mode now. This will exit client mode. - - - - - - - - 100 - 32 - - - - - 16777215 - 32 - - - - background-color: rgb(164, 0, 0); + + + Switch to Hotspot Mode + + + + + + + + 0 + 0 + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); outline: none; - - - Stop - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - Stop hotspot mode now. This will exit hotspot and reenable wifi client mode. - - - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - - - - - 0 - 0 - - - - <html><head/><body><p><img src=":/ico_info.png"/></p></body></html> - - - - - - - - 0 - 0 - - - - - 0 - 35 - - - - - 16777215 - 35 - - - - - true - - - - The default password is 1234567890 - Change it in /boot/crankshaft/crankshaft_env.sh! - - - true - - - - - - - + + + Switch to Client Mode + + + + + + + + 0 + 0 + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + + 75 + true + + + + background-color: rgb(32, 74, 135); + + + Mode switch in progress ... + + + Qt::AlignCenter + + + + + + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + 140 + 0 + + + + + 140 + 16777215 + + + + IP-Address (wlan0) + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + 140 + 0 + + + + + 140 + 16777215 + + + + Used SSID: + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 0 + 0 + + + + + + + + + 140 + 0 + + + + + 140 + 16777215 + + + + Wifi Mode + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + 0 + 0 + + + + + 140 + 36 + + + + + 140 + 36 + + + + Enable Hotspot + + + true + + + + + + + Yes + + + + diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index 0135bf0..d8b21ec 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -97,8 +97,9 @@ int main(int argc, char* argv[]) mainWindow.setWindowFlags(Qt::WindowStaysOnTopHint); autoapp::ui::SettingsWindow settingsWindow(configuration); - settingsWindow.setFixedSize(width, height); settingsWindow.setWindowFlags(Qt::WindowStaysOnTopHint); + //settingsWindow.showFullScreen(); + settingsWindow.setFixedSize(width, height); settingsWindow.adjustSize(); autoapp::configuration::RecentAddressesList recentAddressesList(7);