diff --git a/include/f1x/openauto/autoapp/App.hpp b/include/f1x/openauto/autoapp/App.hpp index 3dbcab2..f7741cc 100644 --- a/include/f1x/openauto/autoapp/App.hpp +++ b/include/f1x/openauto/autoapp/App.hpp @@ -45,6 +45,7 @@ public: void start(aasdk::tcp::ITCPEndpoint::SocketPointer socket); void stop(); void onAndroidAutoQuit() override; + bool disableAutostartEntity = false; private: using std::enable_shared_from_this::shared_from_this; diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index b4ca266..8d4b8f4 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -62,6 +62,8 @@ public: bool showCursor() const override; void hideBrightnessControl(bool value) override; bool hideBrightnessControl() const override; + void showNetworkinfo(bool value) override; + bool showNetworkinfo() const override; std::string getMp3MasterPath() const override; void setMp3MasterPath(const std::string& value) override; @@ -118,6 +120,7 @@ private: bool showLux_; bool showCursor_; bool hideBrightnessControl_; + bool showNetworkinfo_; std::string mp3MasterPath_; std::string mp3SubFolder_; int32_t mp3Track_; @@ -149,6 +152,7 @@ private: static const std::string cGeneralShowLuxKey; static const std::string cGeneralShowCursorKey; static const std::string cGeneralHideBrightnessControlKey; + static const std::string cGeneralShowNetworkinfoKey; static const std::string cGeneralHandednessOfTrafficTypeKey; diff --git a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp index 51d5140..a1e6521 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -70,6 +70,8 @@ public: virtual bool showCursor() const = 0; virtual void hideBrightnessControl(bool value) = 0; virtual bool hideBrightnessControl() const = 0; + virtual void showNetworkinfo(bool value) = 0; + virtual bool showNetworkinfo() const = 0; virtual std::string getMp3MasterPath() const = 0; virtual void setMp3MasterPath(const std::string& value) = 0; diff --git a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp index 1c483bc..ef0f91c 100644 --- a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp @@ -45,6 +45,7 @@ public: virtual bool init() = 0; virtual void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; virtual void stop() = 0; + virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0; virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0; virtual size_t getScreenDPI() const = 0; diff --git a/include/f1x/openauto/autoapp/UI/MainWindow.hpp b/include/f1x/openauto/autoapp/UI/MainWindow.hpp index 03bdcca..a521377 100644 --- a/include/f1x/openauto/autoapp/UI/MainWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/MainWindow.hpp @@ -81,6 +81,7 @@ signals: void cameraRecord(); void openConnectDialog(); void openWifiDialog(); + void openUpdateDialog(); void showBrightnessSlider(); void showVolumeSlider(); void showAlphaSlider(); @@ -145,6 +146,7 @@ private slots: void setTrigger(); void setRetryUSBConnect(); void resetRetryUSBMessage(); + void updateNetworkInfo(); bool check_file_exist(const char *filename); private: @@ -247,6 +249,7 @@ private: bool csmtupdate = false; bool udevupdate = false; bool openautoupdate = false; + bool systemupdate = false; }; } diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index 03ee52f..bf36071 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -75,6 +75,8 @@ private slots: void onUpdateBrightness3(int value); void onUpdateBrightness4(int value); void onUpdateBrightness5(int value); + void on_pushButtonNetwork0_clicked(); + void on_pushButtonNetwork1_clicked(); private slots: void show_tab1(); diff --git a/include/f1x/openauto/autoapp/UI/UpdateDialog.hpp b/include/f1x/openauto/autoapp/UI/UpdateDialog.hpp new file mode 100644 index 0000000..69dd6bf --- /dev/null +++ b/include/f1x/openauto/autoapp/UI/UpdateDialog.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Ui { +class UpdateDialog; +} + +namespace f1x +{ +namespace openauto +{ +namespace autoapp +{ +namespace ui +{ + +class UpdateDialog : public QDialog +{ + Q_OBJECT + +public: + explicit UpdateDialog(QWidget *parent = nullptr); + ~UpdateDialog() override; + + void updateCheck(); + void downloadCheck(); + void updateProgress(); + +private slots: + void on_pushButtonUpdateCsmt_clicked(); + void on_pushButtonUpdateUdev_clicked(); + void on_pushButtonUpdateOpenauto_clicked(); + void on_pushButtonUpdateSystem_clicked(); + void on_pushButtonUpdateCheck_clicked(); + +private: + Ui::UpdateDialog *ui_; + QFileSystemWatcher* watcher_tmp; + QFileSystemWatcher* watcher_download; +}; + +} +} +} +} diff --git a/include/f1x/openauto/autoapp/UI/Warning.hpp b/include/f1x/openauto/autoapp/UI/WarningDialog.hpp similarity index 51% rename from include/f1x/openauto/autoapp/UI/Warning.hpp rename to include/f1x/openauto/autoapp/UI/WarningDialog.hpp index 42f74c9..5190f96 100644 --- a/include/f1x/openauto/autoapp/UI/Warning.hpp +++ b/include/f1x/openauto/autoapp/UI/WarningDialog.hpp @@ -1,7 +1,7 @@ #include namespace Ui { -class Warning; +class WarningDialog; } namespace f1x @@ -13,15 +13,15 @@ namespace autoapp namespace ui { -class Warning : public QDialog +class WarningDialog : public QDialog { Q_OBJECT public: - explicit Warning(QWidget *parent = nullptr); - ~Warning() override; + explicit WarningDialog(QWidget *parent = nullptr); + ~WarningDialog() override; - Ui::Warning* ui_; + Ui::WarningDialog* ui_; private slots: void Autoclose(); diff --git a/include/f1x/openauto/autoapp/UI/WifiDialog.hpp b/include/f1x/openauto/autoapp/UI/WifiDialog.hpp deleted file mode 100644 index a6c0153..0000000 --- a/include/f1x/openauto/autoapp/UI/WifiDialog.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Ui { -class WifiDialog; -} - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace ui -{ - -class WifiDialog : public QDialog -{ - Q_OBJECT - -public: - explicit WifiDialog(QWidget *parent = nullptr); - ~WifiDialog() override; - - bool connected; - int foundCount; - QNetworkConfiguration netcfg; - QStringList WiFisList; - QList netcfgList; - - Ui::WifiDialog* ui_; - -public slots: - void findActiveWirelesses(); - void connectionStatusOpened(); - void connectionStatusClosed(); - void statusBarMessage(QString msg, QString color); - void configurationStateChanged(); - -private slots: - void on_btnConnect_clicked(); - -private: - QTimer *findTimer; - QStandardItemModel* listModel; - QNetworkSession *session; -}; - -} -} -} -} diff --git a/src/autoapp/App.cpp b/src/autoapp/App.cpp index fa84b97..78a7e20 100644 --- a/src/autoapp/App.cpp +++ b/src/autoapp/App.cpp @@ -108,11 +108,17 @@ void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle) try { - connectedAccessoriesEnumerator_->cancel(); + // ignore autostart if exit to csng was used + if (!disableAutostartEntity) { + OPENAUTO_LOG(info) << "[App] Autostart Entity allowed - let's go."; + connectedAccessoriesEnumerator_->cancel(); - auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle)); - androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(aoapDevice)); - androidAutoEntity_->start(*this); + auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle)); + androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(aoapDevice)); + androidAutoEntity_->start(*this); + } else { + OPENAUTO_LOG(info) << "[App] Autostart Entity not allowed - skip."; + } } catch(const aasdk::error::Error& error) { @@ -149,17 +155,21 @@ void App::waitForDevice() void App::onAndroidAutoQuit() { strand_.dispatch([this, self = this->shared_from_this()]() { - OPENAUTO_LOG(info) << "[App] quit."; + OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit."; - androidAutoEntity_->stop(); - androidAutoEntity_.reset(); + try { + androidAutoEntity_->stop(); + androidAutoEntity_.reset(); + } catch (...) { + OPENAUTO_LOG(info) << "[App] Exception in onAndroidAutoQuit."; + } if(!isStopped_) { try { this->waitForDevice(); } catch (...) { - OPENAUTO_LOG(info) << "[App] Exception in onAndroidAutoQuit."; + OPENAUTO_LOG(info) << "[App] Exception in onAndroidAutoQuit - waitfordevice."; } } diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index c193e4b..8496c44 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -41,6 +41,7 @@ const std::string Configuration::cGeneralHideAlphaKey = "General.HideAlpha"; const std::string Configuration::cGeneralShowLuxKey = "General.ShowLux"; const std::string Configuration::cGeneralShowCursorKey = "General.ShowCursor"; const std::string Configuration::cGeneralHideBrightnessControlKey = "General.HideBrightnessControl"; +const std::string Configuration::cGeneralShowNetworkinfoKey = "General.ShowNetworkinfo"; const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType"; @@ -106,6 +107,7 @@ void Configuration::load() showLux_ = iniConfig.get(cGeneralShowLuxKey, false); showCursor_ = iniConfig.get(cGeneralShowCursorKey, false); hideBrightnessControl_ = iniConfig.get(cGeneralHideBrightnessControlKey, false); + showNetworkinfo_ = iniConfig.get(cGeneralShowNetworkinfoKey, false); mp3MasterPath_ = iniConfig.get(cGeneralMp3MasterPathKey, "/media/MYMEDIA"); mp3SubFolder_ = iniConfig.get(cGeneralMp3SubFolderKey, "/"); mp3Track_ = iniConfig.get(cGeneralMp3TrackKey, 0); @@ -154,6 +156,7 @@ void Configuration::reset() showLux_ = false; showCursor_ = false; hideBrightnessControl_ = false; + showNetworkinfo_ = false; mp3MasterPath_ = "/media/MYMEDIA"; mp3SubFolder_ = "/"; mp3Track_ = 0; @@ -187,6 +190,7 @@ void Configuration::save() iniConfig.put(cGeneralShowLuxKey, showLux_); iniConfig.put(cGeneralShowCursorKey, showCursor_); iniConfig.put(cGeneralHideBrightnessControlKey, hideBrightnessControl_); + iniConfig.put(cGeneralShowNetworkinfoKey, showNetworkinfo_); iniConfig.put(cGeneralMp3MasterPathKey, mp3MasterPath_); iniConfig.put(cGeneralMp3SubFolderKey, mp3SubFolder_); iniConfig.put(cGeneralMp3TrackKey, mp3Track_); @@ -331,6 +335,16 @@ bool Configuration::hideBrightnessControl() const return hideBrightnessControl_; } +void Configuration::showNetworkinfo(bool value) +{ + showNetworkinfo_ = value; +} + +bool Configuration::showNetworkinfo() const +{ + return showNetworkinfo_; +} + std::string Configuration::getMp3MasterPath() const { return mp3MasterPath_; diff --git a/src/autoapp/Projection/QtVideoOutput.cpp b/src/autoapp/Projection/QtVideoOutput.cpp index ad4636c..88cfb51 100644 --- a/src/autoapp/Projection/QtVideoOutput.cpp +++ b/src/autoapp/Projection/QtVideoOutput.cpp @@ -35,7 +35,6 @@ QtVideoOutput::QtVideoOutput(configuration::IConfiguration::Pointer configuratio this->moveToThread(QApplication::instance()->thread()); connect(this, &QtVideoOutput::startPlayback, this, &QtVideoOutput::onStartPlayback, Qt::QueuedConnection); connect(this, &QtVideoOutput::stopPlayback, this, &QtVideoOutput::onStopPlayback, Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "createVideoOutput", Qt::BlockingQueuedConnection); } diff --git a/src/autoapp/Service/VideoService.cpp b/src/autoapp/Service/VideoService.cpp index 35a363e..2f5ed2e 100644 --- a/src/autoapp/Service/VideoService.cpp +++ b/src/autoapp/Service/VideoService.cpp @@ -158,12 +158,9 @@ void VideoService::onVideoFocusRequest(const aasdk::proto::messages::VideoFocusR << ", focus mode: " << request.focus_mode() << ", focus reason: " << request.focus_reason(); - this->sendVideoFocusIndication(); - channel_->receive(this->shared_from_this()); - // stop video service on go back to openauto if (request.focus_mode() == 2) { - OPENAUTO_LOG(info) << "[VideoService] Exit entity..."; + OPENAUTO_LOG(info) << "[VideoService] Back to CSNG..."; try { if (!std::ifstream("/tmp/entityexit")) { std::ofstream("/tmp/entityexit"); @@ -172,6 +169,9 @@ void VideoService::onVideoFocusRequest(const aasdk::proto::messages::VideoFocusR OPENAUTO_LOG(error) << "[VideoService] Error in creating entityexit"; } } + + this->sendVideoFocusIndication(); + channel_->receive(this->shared_from_this()); } void VideoService::sendVideoFocusIndication() diff --git a/src/autoapp/UI/ConnectDialog.cpp b/src/autoapp/UI/ConnectDialog.cpp index 615c368..6b0862e 100644 --- a/src/autoapp/UI/ConnectDialog.cpp +++ b/src/autoapp/UI/ConnectDialog.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace f1x { @@ -128,39 +129,56 @@ void ConnectDialog::loadClientList() cleaner--; } - if (std::ifstream("/tmp/temp_recent_list")) { - QFile versionFile(QString("/tmp/temp_recent_list")); - versionFile.open(QIODevice::ReadOnly); - QTextStream data(&versionFile); - while (!data.atEnd()) - { - QString ip = data.readLine().trimmed(); - if (ip != "") { - ui_->listWidgetClients->addItem(ip); - ui_->lineEditIPAddress->setText(ip); - //ConnectDialog::insertIpAddress(ip.toStdString()); + if (std::ifstream("/tmp/hotspot_active")) { + ui_->listWidgetClients->show(); + ui_->pushButtonUpdate->show(); + if (std::ifstream("/tmp/temp_recent_list")) { + QFile versionFile(QString("/tmp/temp_recent_list")); + versionFile.open(QIODevice::ReadOnly); + QTextStream data(&versionFile); + while (!data.atEnd()) + { + QString ip = data.readLine().trimmed(); + if (ip != "") { + ui_->listWidgetClients->addItem(ip); + ui_->lineEditIPAddress->setText(ip); + //ConnectDialog::insertIpAddress(ip.toStdString()); + } } + versionFile.close(); + } else { + ui_->lineEditIPAddress->setText(""); } - versionFile.close(); - - //if (ui_->listWidgetClients->count() == 1) { - // this->setControlsEnabledStatus(false); - // - // const auto& ipAddress = ui_->lineEditIPAddress->text().toStdString(); - // auto socket = std::make_shared(ioService_); - // ui_->progressBarConnect->show(); - // try - // { - // tcpWrapper_.asyncConnect(*socket, ipAddress, 5277, std::bind(&ConnectDialog::connectHandler, this, std::placeholders::_1, ipAddress, socket)); - // } - // catch(const boost::system::system_error& se) - // { - // emit connectionFailed(QString(se.what())); - // } - //} - } else { - ui_->lineEditIPAddress->setText(""); + ui_->listWidgetClients->hide(); + if (std::ifstream("/tmp/gateway_wlan0")) { + ui_->pushButtonUpdate->hide(); + QFile gatewayData(QString("/tmp/gateway_wlan0")); + gatewayData.open(QIODevice::ReadOnly); + QTextStream gateway_date(&gatewayData); + QString linedate = gateway_date.readAll(); + gatewayData.close(); + if (linedate != "") { + ui_->lineEditIPAddress->setText(linedate.simplified()); + ui_->listWidgetClients->addItem(linedate.simplified()); + if (ui_->listWidgetClients->count() == 1) { + this->setControlsEnabledStatus(false); + const auto& ipAddress = ui_->lineEditIPAddress->text().toStdString(); + auto socket = std::make_shared(ioService_); + ui_->progressBarConnect->show(); + try + { + tcpWrapper_.asyncConnect(*socket, ipAddress, 5277, std::bind(&ConnectDialog::connectHandler, this, std::placeholders::_1, ipAddress, socket)); + } + catch(const boost::system::system_error& se) + { + emit connectionFailed(QString(se.what())); + } + } + } + } else { + ui_->lineEditIPAddress->setText(""); + } } } diff --git a/src/autoapp/UI/MainWindow.cpp b/src/autoapp/UI/MainWindow.cpp index 189349b..6bf5987 100644 --- a/src/autoapp/UI/MainWindow.cpp +++ b/src/autoapp/UI/MainWindow.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -86,7 +87,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->setupUi(this); connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings); connect(ui_->pushButtonSettings2, &QPushButton::clicked, this, &MainWindow::openSettings); - connect(ui_->pushButtonWifiSetup, &QPushButton::clicked, this, &MainWindow::openWifiDialog); + connect(ui_->pushButtonUpdate, &QPushButton::clicked, this, &MainWindow::openUpdateDialog); connect(ui_->pushButtonExit, &QPushButton::clicked, this, &MainWindow::toggleExit); connect(ui_->pushButtonExit2, &QPushButton::clicked, this, &MainWindow::toggleExit); connect(ui_->pushButtonShutdown, &QPushButton::clicked, this, &MainWindow::exit); @@ -127,6 +128,8 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi connect(ui_->pushButtonAndroidAuto2, &QPushButton::clicked, this, &MainWindow::TriggerAppStart); connect(ui_->pushButtonAndroidAuto2, &QPushButton::clicked, this, &MainWindow::setRetryUSBConnect); + ui_->clockOnlyWidget->hide(); + // by default hide bluetooth button on init ui_->pushButtonBluetooth->hide(); @@ -135,13 +138,36 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->pushButtonUSB->hide(); ui_->SysinfoTopLeft->hide(); - ui_->pushButtonWifiSetup->hide(); ui_->pushButtonAndroidAuto->hide(); ui_->pushButtonAndroidAuto2->hide(); ui_->SysinfoTopLeft2->hide(); + ui_->pushButtonUpdate->hide(); + ui_->label_dummy_right->hide(); + + ui_->dcRecording->hide(); + + if (!configuration->showNetworkinfo()) { + ui_->networkInfo->hide(); + } + + if (check_file_exist("/etc/crankshaft.branch")) { + QFile branchFile(QString("/etc/crankshaft.branch")); + branchFile.open(QIODevice::ReadOnly); + QTextStream data_branch(&branchFile); + QString branch = data_branch.readAll().split("\n")[0]; + branchFile.close(); + if (branch != "crankshaft-ng") { + if (branch == "csng-dev") { + ui_->Header_Label->setText("

crankshaft NG - Dev-Build

"); + } else { + ui_->Header_Label->setText("

crankshaft NG - Custom-Build

"); + } + } + } + QTimer *timer=new QTimer(this); connect(timer, SIGNAL(timeout()),this,SLOT(showTime())); timer->start(1000); @@ -193,7 +219,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->pushButtonUnMute->hide(); // hide wifi if not forced - if (!this->wifiButtonForce) { + if (!this->wifiButtonForce && !std::ifstream("/tmp/mobile_hotspot_detected")) { ui_->AAWIFIWidget->hide(); ui_->AAWIFIWidget2->hide(); } else { @@ -201,6 +227,18 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->AAUSBWidget2->hide(); } + if (std::ifstream("/tmp/temp_recent_list") || std::ifstream("/tmp/mobile_hotspot_detected")) { + ui_->pushButtonWifi->show(); + ui_->pushButtonNoWiFiDevice->hide(); + ui_->pushButtonWifi2->show(); + ui_->pushButtonNoWiFiDevice2->hide(); + } else { + ui_->pushButtonWifi->hide(); + ui_->pushButtonNoWiFiDevice->show(); + ui_->pushButtonWifi2->hide(); + ui_->pushButtonNoWiFiDevice2->show(); + } + // set custom buttons if file enabled by trigger file if (!this->c1ButtonForce) { ui_->pushButton_c1->hide(); @@ -352,7 +390,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->horizontalSliderBrightness->setTickInterval(brigthnessvalues[2].toInt()); // run monitor for custom brightness command if enabled in crankshaft_env.sh - if (brigthnessvalues[3] == "1") { + if (std::ifstream("/tmp/custombrightness")) { if (!configuration->hideBrightnessControl()) { ui_->pushButtonBrightness->show(); ui_->pushButtonBrightness2->show(); @@ -432,6 +470,13 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->pushButtonToggleGUI2->hide(); } + // hide brightness button if eanbled in settings + if (configuration->hideBrightnessControl()) { + ui_->pushButtonBrightness->hide(); + ui_->pushButtonBrightness2->hide(); + ui_->BrightnessSliderControl->hide(); + } + // init alpha values MainWindow::updateAlpha(); @@ -486,16 +531,6 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi } } - // update notify - this->csmtupdate = check_file_exist("/tmp/csmt_update_available"); - this->udevupdate = check_file_exist("/tmp/udev_update_available"); - this->openautoupdate = check_file_exist("/tmp/openauto_update_available"); - - if (this->csmtupdate || this->udevupdate || this->openautoupdate) { - ui_->SysinfoTopLeft->setText("Update available!"); - ui_->SysinfoTopLeft->show(); - } - watcher = new QFileSystemWatcher(this); watcher->addPath("/media/USBDRIVES"); connect(watcher, &QFileSystemWatcher::directoryChanged, this, &MainWindow::setTrigger); @@ -504,20 +539,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi watcher_tmp->addPath("/tmp"); connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &MainWindow::tmpChanged); - // Experimental test code - //QBluetoothLocalDevice localDevice; - //QString localDeviceName; - //QString localDeviceAddress; - //if (localDevice.isValid()) { - // localDeviceName = localDevice.name(); - // localDeviceAddress = localDevice.address().toString(); - // QList btdevices; - // btdevices = localDevice.connectedDevices(); - // QString btdevice = btdevices.first().toString(); - // QMessageBox btMessage(QMessageBox::Critical, "BT Device", btdevice, QMessageBox::Ok); - // btMessage.setWindowFlags(Qt::WindowStaysOnTopHint); - // btMessage.exec(); - //} + updateNetworkInfo(); } MainWindow::~MainWindow() @@ -530,6 +552,46 @@ MainWindow::~MainWindow() } } +void f1x::openauto::autoapp::ui::MainWindow::updateNetworkInfo() +{ + 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_->value_ip->setText(wlan0.ip().toString().simplified()); + ui_->value_mask->setText(wlan0.netmask().toString().simplified()); + if (std::ifstream("/tmp/wifi_ssid")) { + QFile wifiData(QString("/tmp/wifi_ssid")); + wifiData.open(QIODevice::ReadOnly); + QTextStream gateway_date(&wifiData); + QString linedate = gateway_date.readAll(); + wifiData.close(); + ui_->value_ssid->setText(linedate.simplified()); + } else { + ui_->value_ssid->setText(""); + } + if (std::ifstream("/tmp/gateway_wlan0")) { + QFile gatewayData(QString("/tmp/gateway_wlan0")); + gatewayData.open(QIODevice::ReadOnly); + QTextStream gateway_date(&gatewayData); + QString linedate = gateway_date.readAll(); + gatewayData.close(); + ui_->value_gw->setText(linedate.simplified()); + } else { + ui_->value_gw->setText(""); + } + } + } else { + //qDebug() << "wlan0: down"; + ui_->value_ip->setText(""); + ui_->value_mask->setText(""); + ui_->value_gw->setText(""); + ui_->value_ssid->setText("wlan0: down"); + } +} + void f1x::openauto::autoapp::ui::MainWindow::customButtonPressed1() { system(qPrintable(this->custom_button_command_c1 + " &")); @@ -723,22 +785,28 @@ void f1x::openauto::autoapp::ui::MainWindow::updateAlpha() void f1x::openauto::autoapp::ui::MainWindow::switchGuiToNight() { - MainWindow::on_pushButtonVolume_clicked(); + //MainWindow::on_pushButtonVolume_clicked(); f1x::openauto::autoapp::ui::MainWindow::updateBG(); ui_->pushButtonDay->show(); ui_->pushButtonDay2->show(); ui_->pushButtonNight->hide(); ui_->pushButtonNight2->hide(); + if (ui_->mediaWidget->isVisible() == true) { + ui_->VolumeSliderControl->hide(); + } } void f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay() { - MainWindow::on_pushButtonVolume_clicked(); + //MainWindow::on_pushButtonVolume_clicked(); f1x::openauto::autoapp::ui::MainWindow::updateBG(); ui_->pushButtonNight->show(); ui_->pushButtonNight2->show(); ui_->pushButtonDay->hide(); ui_->pushButtonDay2->hide(); + if (ui_->mediaWidget->isVisible() == true) { + ui_->VolumeSliderControl->hide(); + } } void f1x::openauto::autoapp::ui::MainWindow::cameraControlHide() @@ -867,7 +935,7 @@ void f1x::openauto::autoapp::ui::MainWindow::updateBG() this->setStyleSheet("QMainWindow { background: url(:/firework.png); background-repeat: no-repeat; background-position: center; }"); this->holidaybg = true; } - else { + else if (ui_->mediaWidget->isVisible() == false) { if (!this->nightModeEnabled) { if (this->oldGUIStyle) { if (this->wallpaperClassicDayFileExists) { @@ -938,6 +1006,7 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime() ui_->Digital_clock->setText(time_text); ui_->bigClock->setText(time_text); + ui_->bigClock2->setText(time_text); if (!this->holidaybg) { if (this->date_text == "12/24") { @@ -1326,6 +1395,52 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() } } + // check if system is in display off mode (tap2wake/screensaver) + if (std::ifstream("/tmp/screensaver")) { + if (ui_->menuWidget->isVisible() == true) { + ui_->menuWidget->hide(); + } + if (ui_->oldmenuWidget->isVisible() == true) { + ui_->oldmenuWidget->hide(); + } + if (ui_->headerWidget->isVisible() == true) { + ui_->headerWidget->hide(); + } + if (ui_->mediaWidget->isVisible() == true) { + ui_->mediaWidget->hide(); + } + if (ui_->cameraWidget->isVisible() == true) { + ui_->cameraWidget->hide(); + } + if (ui_->VolumeSliderControlPlayer->isVisible() == true) { + ui_->VolumeSliderControlPlayer->hide(); + } + if (ui_->VolumeSliderControl->isVisible() == true) { + ui_->VolumeSliderControl->hide(); + } + if (ui_->BrightnessSliderControl->isVisible() == true) { + ui_->BrightnessSliderControl->hide(); + } + cameraHide(); + if (ui_->clockOnlyWidget->isVisible() == false) { + ui_->clockOnlyWidget->show(); + } + } else { + if (ui_->headerWidget->isVisible() == false) { + ui_->headerWidget->show(); + } + if (ui_->VolumeSliderControl->isVisible() == false) { + if (ui_->mediaWidget->isVisible() == false) { + ui_->VolumeSliderControl->show(); + } + } + if (ui_->clockOnlyWidget->isVisible() == true) { + ui_->clockOnlyWidget->hide(); + toggleGUI(); + toggleGUI(); + } + } + // check if custom command needs black background if (std::ifstream("/tmp/blackscreen")) { if (ui_->centralWidget->isVisible() == true) { @@ -1453,6 +1568,17 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() // check if dashcam is recording this->dashCamRecording = check_file_exist("/tmp/dashcam_is_recording"); + + if (this->dashCamRecording) { + if (ui_->dcRecording->isVisible() == false) { + ui_->dcRecording->show(); + } + } else { + if (ui_->dcRecording->isVisible() == true) { + ui_->dcRecording->hide(); + } + } + // show recording state if dashcam is visible if (ui_->cameraWidget->isVisible() == true) { if (this->dashCamRecording) { @@ -1490,8 +1616,8 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() this->hotspotActive = check_file_exist("/tmp/hotspot_active"); - // hide wifi if hotspot disabled - if (!this->hotspotActive) { + // hide wifi if hotspot disabled and force wifi unselected + if (!this->hotspotActive && !std::ifstream("/tmp/mobile_hotspot_detected")) { if ((ui_->AAWIFIWidget->isVisible() == true) || (ui_->AAWIFIWidget2->isVisible() == true)){ ui_->AAWIFIWidget->hide(); ui_->AAWIFIWidget2->hide(); @@ -1507,7 +1633,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() } } - if (std::ifstream("/tmp/temp_recent_list")) { + if (std::ifstream("/tmp/temp_recent_list") || std::ifstream("/tmp/mobile_hotspot_detected")) { if (ui_->pushButtonWifi->isVisible() == false) { ui_->pushButtonWifi->show(); } @@ -1588,6 +1714,16 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() } } + if (!this->configuration_->showNetworkinfo()) { + if (ui_->networkInfo->isVisible() == true) { + ui_->networkInfo->hide(); + } + } else { + if (ui_->networkInfo->isVisible() == false) { + ui_->networkInfo->show(); + } + } + // hide gui toggle if enabled in settings if (this->configuration_->hideMenuToggle()) { ui_->pushButtonToggleGUI->hide(); @@ -1603,7 +1739,9 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() ui_->pushButtonBrightness->hide(); ui_->pushButtonBrightness2->hide(); ui_->BrightnessSliderControl->hide(); - ui_->VolumeSliderControl->show(); + if (ui_->mediaWidget->isVisible() == false) { + ui_->VolumeSliderControl->show(); + } } } else { if (!this->lightsensor) { @@ -1635,4 +1773,34 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() } } MainWindow::updateAlpha(); + + // update notify + this->csmtupdate = check_file_exist("/tmp/csmt_update_available"); + this->udevupdate = check_file_exist("/tmp/udev_update_available"); + this->openautoupdate = check_file_exist("/tmp/openauto_update_available"); + this->systemupdate = check_file_exist("/tmp/system_update_available"); + + if (this->csmtupdate || this->udevupdate || this->openautoupdate || this->systemupdate) { + if (ui_->pushButtonUpdate->isVisible() == false) { + ui_->pushButtonUpdate->show(); + ui_->label_left->show(); + ui_->label_right->show(); + if (this->devModeEnabled) { + ui_->devlabel_right->hide(); + } else { + ui_->label_dummy_right->show(); + } + } + } else { + if (ui_->pushButtonUpdate->isVisible() == true) { + ui_->pushButtonUpdate->hide(); + ui_->label_left->hide(); + ui_->label_right->hide(); + ui_->label_dummy_right->hide(); + if (this->devModeEnabled) { + ui_->devlabel_right->show(); + } + } + } + updateNetworkInfo(); } diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index 9b139f5..3eed7cd 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -72,11 +71,17 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat connect(ui_->pushButtonShowBindings, &QPushButton::clicked, this, &SettingsWindow::onShowBindings); 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_->pushButtonHotspotStop, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); + connect(ui_->radioButtonHotspot, &QPushButton::clicked, this, &SettingsWindow::onStartHotspot); + connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); 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_->pushButtonCheckNow, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft update check &"); }); + connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close); + connect(ui_->pushButtonDebuglog, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft debuglog &");}); + connect(ui_->pushButtonNetworkAuto, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft network auto &");}); + connect(ui_->pushButtonNetwork0, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork0_clicked); + connect(ui_->pushButtonNetwork1, &QPushButton::clicked, this, &SettingsWindow::on_pushButtonNetwork1_clicked); // menu ui_->tab1->show(); @@ -110,20 +115,18 @@ 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()); - ui_->label_modeswitchprogress->hide(); + ui_->label_modeswitchprogress->setText("Ok"); if (std::ifstream("/tmp/hotspot_active")) { - ui_->pushButtonHotspotStop->show(); - ui_->pushButtonHotspotStart->hide(); - ui_->lineEdit_wifimode->setText("Hotspot"); + ui_->radioButtonClient->setChecked(0); + ui_->radioButtonHotspot->setChecked(1); ui_->lineEditWifiSSID->setText(this->hotspotssid); ui_->lineEditPassword->show(); ui_->label_password->show(); ui_->lineEditPassword->setText("1234567890"); } else { - ui_->pushButtonHotspotStart->show(); - ui_->pushButtonHotspotStop->hide(); - ui_->lineEdit_wifimode->setText("Client"); + ui_->radioButtonClient->setChecked(1); + ui_->radioButtonHotspot->setChecked(0); ui_->lineEditWifiSSID->setText(this->wifissid); ui_->lineEditPassword->hide(); ui_->label_password->hide(); @@ -148,6 +151,7 @@ void SettingsWindow::onSave() configuration_->showLux(ui_->checkBoxShowLux->isChecked()); configuration_->showCursor(ui_->checkBoxShowCursor->isChecked()); configuration_->hideBrightnessControl(ui_->checkBoxHideBrightnessControl->isChecked()); + configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked()); configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked()); configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked()); @@ -347,7 +351,12 @@ void SettingsWindow::onSave() params.append("#"); params.append( std::string(ui_->comboBoxCountryCode->currentText().split("|")[0].replace(" ","").toStdString()) ); params.append("#"); - + if (ui_->checkBoxBlankOnly ->isChecked()) { + params.append("1"); + } else { + params.append("0"); + } + params.append("#"); system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str()); this->close(); @@ -383,6 +392,7 @@ void SettingsWindow::load() ui_->checkBoxShowLux->setChecked(configuration_->showLux()); ui_->checkBoxShowCursor->setChecked(configuration_->showCursor()); ui_->checkBoxHideBrightnessControl->setChecked(configuration_->hideBrightnessControl()); + ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo()); ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay()); ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay()); @@ -953,7 +963,15 @@ void SettingsWindow::loadSystemValues() ui_->radioButtonCustom->setChecked(true); } ui_->comboBoxCountryCode->setCurrentIndex(ui_->comboBoxCountryCode->findText(getparams[44], Qt::MatchFlag::MatchStartsWith)); + // set screen blank instead off + if (getparams[45] == "1") { + ui_->checkBoxBlankOnly->setChecked(true); + } else { + ui_->checkBoxBlankOnly->setChecked(false); + } } + // update network info + updateNetworkInfo(); } void SettingsWindow::onShowBindings() @@ -983,26 +1001,28 @@ void SettingsWindow::onShowBindings() void SettingsWindow::onStartHotspot() { - ui_->label_modeswitchprogress->show(); - ui_->pushButtonHotspotStart->hide(); - ui_->pushButtonHotspotStop->hide(); - ui_->lineEdit_wifimode->setText(""); + ui_->label_modeswitchprogress->setText("Wait ..."); + ui_->radioButtonClient->setEnabled(0); + ui_->radioButtonHotspot->setEnabled(0); ui_->lineEdit_wlan0->setText(""); ui_->lineEditWifiSSID->setText(""); - system("touch /tmp/manual_hotspot_control && sudo systemctl start hotspot &"); + qApp->processEvents(); + std::remove("/tmp/manual_hotspot_control"); + std::ofstream("/tmp/manual_hotspot_control"); + system("/opt/crankshaft/service_hotspot.sh start &"); QTimer::singleShot(15000, this, SLOT(updateNetworkInfo())); } void SettingsWindow::onStopHotspot() { - ui_->label_modeswitchprogress->show(); - ui_->pushButtonHotspotStart->hide(); - ui_->pushButtonHotspotStop->hide(); - ui_->lineEdit_wifimode->setText(""); + ui_->label_modeswitchprogress->setText("Wait ..."); + ui_->radioButtonClient->setEnabled(0); + ui_->radioButtonHotspot->setEnabled(0); ui_->lineEdit_wlan0->setText(""); ui_->lineEditWifiSSID->setText(""); ui_->lineEditPassword->setText(""); - system("sudo systemctl stop hotspot &"); + qApp->processEvents(); + system("/opt/crankshaft/service_hotspot.sh stop &"); QTimer::singleShot(15000, this, SLOT(updateNetworkInfo())); } @@ -1161,28 +1181,60 @@ void f1x::openauto::autoapp::ui::SettingsWindow::updateNetworkInfo() //qDebug() << "wlan0: " << wlan0.ip(); ui_->lineEdit_wlan0->setText(wlan0.ip().toString()); } + if (std::ifstream("/tmp/wifi_ssid")) { + QFile wifiData(QString("/tmp/wifi_ssid")); + wifiData.open(QIODevice::ReadOnly); + QTextStream gateway_date(&wifiData); + QString linedate = gateway_date.readAll(); + wifiData.close(); + ui_->lineEditWifiSSID->setText(linedate.simplified()); + } else { + ui_->lineEditWifiSSID->setText(""); + } } else { //qDebug() << "wlan0: down"; ui_->lineEdit_wlan0->setText("interface down"); } if (std::ifstream("/tmp/hotspot_active")) { - ui_->pushButtonHotspotStop->show(); - ui_->pushButtonHotspotStart->hide(); - ui_->label_modeswitchprogress->hide(); - ui_->lineEdit_wifimode->setText("Hotspot"); + ui_->radioButtonClient->setEnabled(1); + ui_->radioButtonHotspot->setEnabled(1); + ui_->radioButtonHotspot->setChecked(1); + ui_->radioButtonClient->setChecked(0); + ui_->label_modeswitchprogress->setText("Ok"); ui_->lineEditWifiSSID->setText(this->hotspotssid); ui_->lineEditPassword->show(); ui_->label_password->show(); ui_->lineEditPassword->setText("1234567890"); } else { - ui_->pushButtonHotspotStart->show(); - ui_->pushButtonHotspotStop->hide(); - ui_->label_modeswitchprogress->hide(); - ui_->lineEdit_wifimode->setText("Client"); + ui_->radioButtonClient->setEnabled(1); + ui_->radioButtonHotspot->setEnabled(1); + ui_->radioButtonHotspot->setChecked(0); + ui_->radioButtonClient->setChecked(1); + ui_->label_modeswitchprogress->setText("Ok"); ui_->lineEditWifiSSID->setText(this->wifissid); ui_->lineEditPassword->hide(); ui_->label_password->hide(); ui_->lineEditPassword->setText(""); } } + +void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork0_clicked() +{ + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->lineEditPassword->setText(""); + qApp->processEvents(); + system("/usr/local/bin/crankshaft network 0 &"); + +} + +void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork1_clicked() +{ + ui_->lineEdit_wlan0->setText(""); + ui_->lineEditWifiSSID->setText(""); + ui_->lineEditPassword->setText(""); + qApp->processEvents(); + system("/usr/local/bin/crankshaft network 1 &"); + QTimer::singleShot(15000, this, SLOT(updateNetworkInfo())); +} diff --git a/src/autoapp/UI/UpdateDialog.cpp b/src/autoapp/UI/UpdateDialog.cpp new file mode 100644 index 0000000..c1ed7a6 --- /dev/null +++ b/src/autoapp/UI/UpdateDialog.cpp @@ -0,0 +1,176 @@ +#include +#include "ui_updatedialog.h" +#include +#include +#include +#include + +namespace f1x +{ +namespace openauto +{ +namespace autoapp +{ +namespace ui +{ + +UpdateDialog::UpdateDialog(QWidget *parent) + : QDialog(parent) + , ui_(new Ui::UpdateDialog) +{ + ui_->setupUi(this); + connect(ui_->pushButtonUpdateCsmt, &QPushButton::clicked, this, &UpdateDialog::on_pushButtonUpdateCsmt_clicked); + connect(ui_->pushButtonUpdateUdev, &QPushButton::clicked, this, &UpdateDialog::on_pushButtonUpdateUdev_clicked); + connect(ui_->pushButtonUpdateOpenauto, &QPushButton::clicked, this, &UpdateDialog::on_pushButtonUpdateOpenauto_clicked); + connect(ui_->pushButtonUpdateSystem, &QPushButton::clicked, this, &UpdateDialog::on_pushButtonUpdateSystem_clicked); + connect(ui_->pushButtonUpdateCheck, &QPushButton::clicked, this, &UpdateDialog::on_pushButtonUpdateCheck_clicked); + connect(ui_->pushButtonClose, &QPushButton::clicked, this, &UpdateDialog::close); + + ui_->progressBarCsmt->hide(); + ui_->progressBarUdev->hide(); + ui_->progressBarOpenauto->hide(); + ui_->progressBarSystem->hide(); + ui_->labelSystemReadyInstall->hide(); + ui_->labelUpdateChecking->hide(); + updateCheck(); + + watcher_tmp = new QFileSystemWatcher(this); + watcher_tmp->addPath("/tmp"); + connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &UpdateDialog::updateCheck); + + watcher_download = new QFileSystemWatcher(this); + watcher_download->addPath("/media/CSSTORAGE"); + connect(watcher_download, &QFileSystemWatcher::directoryChanged, this, &UpdateDialog::downloadCheck); +} + +UpdateDialog::~UpdateDialog() +{ + delete ui_; +} + +void f1x::openauto::autoapp::ui::UpdateDialog::on_pushButtonUpdateCsmt_clicked() +{ + ui_->pushButtonUpdateCsmt->hide(); + ui_->progressBarCsmt->show(); + qApp->processEvents(); + system("crankshaft update csmt &"); +} + +void f1x::openauto::autoapp::ui::UpdateDialog::on_pushButtonUpdateUdev_clicked() +{ + ui_->pushButtonUpdateUdev->hide(); + ui_->progressBarUdev->show(); + qApp->processEvents(); + system("crankshaft update udev &"); +} + +void f1x::openauto::autoapp::ui::UpdateDialog::on_pushButtonUpdateOpenauto_clicked() +{ + ui_->pushButtonUpdateOpenauto->hide(); + ui_->progressBarOpenauto->show(); + qApp->processEvents(); + system("crankshaft update openauto &"); +} + +void f1x::openauto::autoapp::ui::UpdateDialog::on_pushButtonUpdateSystem_clicked() +{ + ui_->pushButtonUpdateSystem->hide(); + ui_->progressBarSystem->show(); + ui_->progressBarSystem->setValue(0); + qApp->processEvents(); + system("crankshaft update system &"); +} + +void f1x::openauto::autoapp::ui::UpdateDialog::on_pushButtonUpdateCheck_clicked() +{ + ui_->pushButtonUpdateCheck->hide(); + ui_->labelUpdateChecking->show(); + qApp->processEvents(); + system("/usr/local/bin/crankshaft update check"); + updateCheck(); + ui_->labelUpdateChecking->hide(); + ui_->pushButtonUpdateCheck->show(); +} + +void f1x::openauto::autoapp::ui::UpdateDialog::downloadCheck() +{ + QDir directory("/media/CSSTORAGE"); + QStringList files = directory.entryList(QStringList() << "*.zip", QDir::AllEntries, QDir::Name); + foreach(QString filename, files) { + if (filename != "") { + ui_->labelDownload->setText(filename); + } + } +} + +void f1x::openauto::autoapp::ui::UpdateDialog::updateCheck() +{ + if (!std::ifstream("/tmp/csmt_updating")) { + if (std::ifstream("/tmp/csmt_update_available")) { + ui_->labelCsmtOK->hide(); + ui_->pushButtonUpdateCsmt->show(); + } else { + ui_->pushButtonUpdateCsmt->hide(); + ui_->progressBarCsmt->hide(); + ui_->labelCsmtOK->show(); + } + } + + if (!std::ifstream("/tmp/udev_updating")) { + if (std::ifstream("/tmp/udev_update_available")) { + ui_->labelUdevOK->hide(); + ui_->pushButtonUpdateUdev->show(); + } else { + ui_->pushButtonUpdateUdev->hide(); + ui_->progressBarUdev->hide(); + ui_->labelUdevOK->show(); + } + } + + if (!std::ifstream("/tmp/openauto_updating")) { + if (std::ifstream("/tmp/openauto_update_available")) { + ui_->labelOpenautoOK->hide(); + ui_->pushButtonUpdateOpenauto->show(); + } else { + ui_->pushButtonUpdateOpenauto->hide(); + ui_->progressBarOpenauto->hide(); + ui_->labelOpenautoOK->show(); + } + } + + if (std::ifstream("/tmp/system_update_ready")) { + ui_->labelSystemOK->hide(); + ui_->pushButtonUpdateSystem->hide(); + ui_->progressBarSystem->hide(); + ui_->labelSystemReadyInstall->show(); + } else { + ui_->labelSystemReadyInstall->hide(); + if (std::ifstream("/tmp/system_update_available")) { + ui_->labelSystemOK->hide(); + ui_->progressBarSystem->hide(); + ui_->pushButtonUpdateSystem->show(); + } + if (std::ifstream("/tmp/system_update_downloading")) { + ui_->labelSystemOK->hide(); + ui_->pushButtonUpdateSystem->hide(); + ui_->progressBarSystem->show(); + + QFileInfo downloadfile = "/media/CSSTORAGE/" + ui_->labelDownload->text(); + if (downloadfile.exists()) { + qint64 size = downloadfile.size(); + size = size/1024/1024; + ui_->progressBarSystem->setValue(size); + } + } + if (!std::ifstream("/tmp/system_update_available") && !std::ifstream("/tmp/system_update_downloading")) { + ui_->progressBarSystem->hide(); + ui_->labelSystemOK->show(); + ui_->pushButtonUpdateSystem->hide(); + } + } +} + +} +} +} +} diff --git a/src/autoapp/UI/Warning.cpp b/src/autoapp/UI/WarningDialog.cpp similarity index 51% rename from src/autoapp/UI/Warning.cpp rename to src/autoapp/UI/WarningDialog.cpp index a4e85d4..e2703f3 100644 --- a/src/autoapp/UI/Warning.cpp +++ b/src/autoapp/UI/WarningDialog.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include namespace f1x @@ -11,24 +11,24 @@ namespace autoapp namespace ui { -Warning::Warning(QWidget *parent) +WarningDialog::WarningDialog(QWidget *parent) : QDialog(parent) - , ui_(new Ui::Warning) + , ui_(new Ui::WarningDialog) { ui_->setupUi(this); - connect(ui_->pushButtonClose, &QPushButton::clicked, this, &Warning::close); + connect(ui_->pushButtonClose, &QPushButton::clicked, this, &WarningDialog::close); QTimer::singleShot(5000, this, SLOT(Autoclose())); } -Warning::~Warning() +WarningDialog::~WarningDialog() { delete ui_; } -void Warning::Autoclose() +void WarningDialog::Autoclose() { - Warning::close(); + WarningDialog::close(); } } diff --git a/src/autoapp/UI/WifiDialog.cpp b/src/autoapp/UI/WifiDialog.cpp deleted file mode 100644 index 6d99b52..0000000 --- a/src/autoapp/UI/WifiDialog.cpp +++ /dev/null @@ -1,149 +0,0 @@ -#include -#include - -namespace f1x -{ -namespace openauto -{ -namespace autoapp -{ -namespace ui -{ - -WifiDialog::WifiDialog(QWidget *parent) - : QDialog(parent) - , ui_(new Ui::WifiDialog) -{ - ui_->setupUi(this); - - findTimer = new QTimer(); - findTimer->setInterval(1000); - connect(findTimer,&QTimer::timeout,this,&WifiDialog::findActiveWirelesses); - connect(ui_->pushButtonClose, &QPushButton::clicked, this, &WifiDialog::close); - findTimer->start(); - connected = false; - foundCount = 0; - ui_->treeWidgetWiFis->setColumnWidth(0,50); - ui_->treeWidgetWiFis->setColumnWidth(1,200); - findActiveWirelesses(); -} - -WifiDialog::~WifiDialog() -{ - delete ui_; -} - -} -} -} -} - -void f1x::openauto::autoapp::ui::WifiDialog::findActiveWirelesses() -{ - QNetworkConfigurationManager *ncm = new QNetworkConfigurationManager(); - connect(ncm, &QNetworkConfigurationManager::onlineStateChanged, this, &WifiDialog::configurationStateChanged); - - netcfgList = ncm->allConfigurations(); - WiFisList.clear(); - for (auto &x : netcfgList) - { - if (x.bearerType() == QNetworkConfiguration::BearerWLAN) - { - if(x.name() == "") - WiFisList << "Unknown(Other Network)"; - else - WiFisList << x.name(); - - qDebug() << x.type(); - } - } - for(int i=0; itreeWidgetWiFis->topLevelItemCount(); j++) - { - QTreeWidgetItem *index = ui_->treeWidgetWiFis->topLevelItem(j); - QString str = index->text(1); - if(str == WiFisList[i]) - { - exist = true; - break; - } - } - if(!exist) - { - item->setTextAlignment(0,Qt::AlignVCenter); - item->setTextAlignment(1,Qt::AlignHCenter); - item->setText(0,QString::number(++foundCount)); - item->setText(1,WiFisList[i]); - ui_->treeWidgetWiFis->addTopLevelItem(item); - } - } -} - -void f1x::openauto::autoapp::ui::WifiDialog::connectionStatusOpened() -{ - connected = true; - ui_->btnConnect->setText("Disconnect"); - statusBarMessage("Successfully Connected.","green"); -} - -void f1x::openauto::autoapp::ui::WifiDialog::connectionStatusClosed() -{ - connected = false; - ui_->btnConnect->setText("Connect"); - statusBarMessage("Successfully Disonnected.","red"); -} - -void f1x::openauto::autoapp::ui::WifiDialog::on_btnConnect_clicked() -{ - if(!connected) - { - QString pass = QInputDialog::getText(this, "Password", "Enter Password:",QLineEdit::Password); - if(pass.isEmpty()) return; - - QModelIndex index = ui_->treeWidgetWiFis->currentIndex(); - QString str = index.data(Qt::DisplayRole).toString(); - for (auto &x : netcfgList) - { - if (x.bearerType() == QNetworkConfiguration::BearerWLAN) - { - if (x.name() == str) - { - netcfg = x; - session = new QNetworkSession(netcfg, this); - connect(session,&QNetworkSession::opened,this,&WifiDialog::connectionStatusOpened); - connect(session,&QNetworkSession::closed,this,&WifiDialog::connectionStatusClosed); - session->open(); - if(session->isOpen()) - { - connected = true; - ui_->btnConnect->setText("Disconnect"); - } - } - } - } - } - else - { - session->close(); - if(!session->isOpen()) - { - connected = false; - ui_->btnConnect->setText("Connect"); - } - } -} - -void f1x::openauto::autoapp::ui::WifiDialog::statusBarMessage(QString msg, QString color) -{ - ui_->statusBar->clearMessage(); - ui_->statusBar->setStyleSheet("color:"+color+";"); - ui_->statusBar->showMessage(msg, 5000); -} - -void f1x::openauto::autoapp::ui::WifiDialog::configurationStateChanged() -{ - qDebug()<< "emited"; -} diff --git a/src/autoapp/UI/connectdialog.ui b/src/autoapp/UI/connectdialog.ui index ae12aa9..720f6f5 100644 --- a/src/autoapp/UI/connectdialog.ui +++ b/src/autoapp/UI/connectdialog.ui @@ -7,7 +7,7 @@ 0 0 500 - 360 + 300 @@ -19,7 +19,13 @@ 500 - 360 + 300 + + + + + 16777215 + 300 @@ -30,6 +36,12 @@ color: rgb(255, 255, 255); + + 4 + + + 9 + @@ -42,6 +54,12 @@ color: rgb(255, 255, 255); IP Address + + 2 + + + 2 + @@ -100,7 +118,10 @@ color: rgb(255, 255, 255); - 9 + 2 + + + 2 @@ -327,6 +348,12 @@ color: rgb(255, 255, 255); + + 2 + + + 6 + diff --git a/src/autoapp/UI/mainwindow.ui b/src/autoapp/UI/mainwindow.ui index 375869e..1ede504 100644 --- a/src/autoapp/UI/mainwindow.ui +++ b/src/autoapp/UI/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 862 - 1357 + 929 + 1529 @@ -62,6 +62,42 @@ 0 + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + + 80 + + + + color: rgb(255, 255, 255); + + + 12:00:00 + + + Qt::AlignCenter + + + + + + @@ -100,8 +136,23 @@ 0 + + 0 + + + + 150 + 24 + + + + + 150 + 24 + + 75 @@ -111,7 +162,8 @@ background-color: rgb(164, 0, 0); -color: rgb(255, 255, 255); +color: rgb(255, 255, 255); +border-radius: 4px; Dev Mode Enabled @@ -122,27 +174,54 @@ color: rgb(255, 255, 255); - + - + 0 0 - 100 - 0 + 150 + 24 - 100 - 16777215 + 150 + 24 + 50 + false + + + + background-color: rgb(115, 210, 22); +color: rgb(0, 0, 0); +outline: none; +border-radius: 4px; + + + + Update available! + + + + + + + + 0 + 0 + + + + + 8 75 true @@ -154,6 +233,9 @@ color: rgb(211, 215, 207); + + 4 + @@ -188,25 +270,14 @@ color: rgb(211, 215, 207); - + 0 0 - - - 100 - 0 - - - - - 100 - 16777215 - - + 8 75 true @@ -221,10 +292,60 @@ color: rgb(211, 215, 207); Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + 4 + + + + + + + + 0 + 0 + + + + + 150 + 24 + + + + + 150 + 24 + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(211, 215, 207); + + + + + + + 0 + 0 + + + + + 150 + 24 + + + + + 150 + 24 + + 75 @@ -233,7 +354,8 @@ color: rgb(211, 215, 207); background-color: rgb(164, 0, 0); -color: rgb(255, 255, 255); +color: rgb(255, 255, 255); +border-radius: 4px; Dev Mode Enabled @@ -331,13 +453,13 @@ color: rgb(255, 255, 255); 0 - 22 + 24 16777215 - 22 + 24 @@ -370,13 +492,13 @@ color: rgb(78, 244, 37); 0 - 22 + 24 16777215 - 22 + 24 @@ -454,6 +576,18 @@ color: rgb(78, 244, 37); 0 + + + 0 + 24 + + + + + 16777215 + 24 + + 75 @@ -488,6 +622,63 @@ color: rgb(0, 102, 255); + + + + + 0 + 0 + + + + + 80 + 24 + + + + + 80 + 24 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); +color: rgb(239, 239, 239); +outline: none; +border-radius: 4px; + + + + Recording + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + @@ -499,13 +690,13 @@ color: rgb(0, 102, 255); 80 - 22 + 24 80 - 22 + 24 @@ -517,7 +708,9 @@ color: rgb(0, 102, 255); background-color: rgb(32, 74, 135); color: rgb(239, 239, 239); -outline: none; +outline: none; +border-radius: 4px; + BT-Pairing @@ -535,13 +728,13 @@ outline: none; 100 - 22 + 24 100 - 22 + 24 @@ -568,6 +761,510 @@ color: rgb(255, 255, 255); + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + background-color: rgba(0, 0, 0, 0); + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + SSID: + + + + + + + + 0 + 0 + + + + + 130 + 24 + + + + + 130 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + IP: + + + + + + + + 0 + 0 + + + + + 130 + 24 + + + + + 130 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + Mask: + + + + + + + + 0 + 0 + + + + + 130 + 24 + + + + + 130 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + GW: + + + + + + + + 0 + 0 + + + + + 130 + 24 + + + + + 130 + 24 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); +color: rgb(196, 160, 0); + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + @@ -793,25 +1490,6 @@ WiFi Clients - - - - - 0 - 0 - - - - background-color: rgba(100, 62, 4, 0.5); -border-radius: 4px; -border: 2px solid rgba(255,255,255,0.5); -outline: none; - - - Setup - - - @@ -2013,6 +2691,8 @@ outline: none; 80 + 50 + false diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index 968ae69..948f583 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -6,8 +6,8 @@ 0 0 - 945 - 3526 + 800 + 3473 @@ -2493,81 +2493,101 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - Set pairable for 120 seconds after startup - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 200 - 32 - - - - - 16777215 - 32 - - - - - 75 - true - - - - background-color: rgb(164, 0, 0); + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + Set pairable for 120 seconds after startup + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 200 + 32 + + + + + 16777215 + 32 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); outline: none; - - - Remove all paired devices now! - - - - + + + Remove all paired devices now! + + + + + @@ -2578,11 +2598,14 @@ outline: none; + + 0 + - 2 + 0 - 2 + 0 @@ -2632,336 +2655,30 @@ outline: none; - - - Networking + + + + 0 + 0 + - + + + 0 + 0 + + 0 + 0 - - - - 2 - - - 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; - - - Switch to Hotspot Mode - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - - 75 - true - - - - background-color: rgb(164, 0, 0); -outline: none; - - - 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 - - - - SSID: - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - - 0 - 0 - - - - - - - - - 140 - 0 - - - - - 140 - 16777215 - - - - Wifi Mode - - - - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - - - - - Password (default) - - - - - - + - + 0 0 @@ -2969,7 +2686,10 @@ outline: none; Wifi Setup - + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + 0 @@ -2980,7 +2700,7 @@ outline: none; 0 - 0 + 2 @@ -3511,12 +3231,496 @@ outline: none; + + + + Enable + + + + + + + Show network info on mainscreen + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Wifi Mode + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + + + + 0 + + + 0 + + + 0 + + + 0 + + + 2 + + + + + 9 + + + 9 + + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + Client Mode + + + + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + Run Hotspot + + + + + + + + 0 + 0 + + + + + 60 + 32 + + + + + 60 + 32 + + + + + 75 + true + + + + background-color: rgba(0, 0, 0, 0); + + + Wait... + + + Qt::AlignCenter + + + + + + + + + + + + + 0 + 0 + + + + Force Client Network To Use + + + + 9 + + + 0 + + + 9 + + + 2 + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + + 75 + true + + + + background-color: rgb(117, 80, 123); +outline: none; + + + Config 1 + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + + 75 + true + + + + background-color: rgb(117, 80, 123); +outline: none; + + + Config 2 + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + background-color: rgb(78, 154, 6); +outline: none; + + + Auto + + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 114 + + + + + 16777215 + 114 + + + + Network Information + + + + 0 + + + 0 + + + + + 2 + + + 2 + + + + + + 130 + 0 + + + + + 130 + 16777215 + + + + IP-Address (eth0) + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + 140 + 0 + + + + + 140 + 16777215 + + + + IP-Address (wlan0) + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + 140 + 0 + + + + + 140 + 16777215 + + + + SSID: + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 0 + 0 + + + + + + + + Password (default) + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + @@ -3646,10 +3850,10 @@ outline: none; - 2 + 0 - 2 + 0 @@ -3929,10 +4133,10 @@ outline: none; - 2 + 0 - 2 + 0 @@ -3967,10 +4171,10 @@ outline: none; - 2 + 0 - 2 + 0 @@ -3996,111 +4200,194 @@ outline: none; - + 0 0 - - Boot Screen - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - + + + 0 + - 2 + 0 + + + 0 - 2 + 0 - + - + 0 0 - - - 150 - 0 - + + Boot Screen - - - 150 - 16777215 - - - - Animation - - - true + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 1 + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + Animation + + + true + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + Classic + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + Custom + + + + - + - + 0 0 - - - 150 - 0 - - - - - 150 - 16777215 - - - - Classic + + System Updates + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + background-color: rgb(78, 154, 6); +outline: none; + + + Check Now + + + + + + + + 0 + 0 + + + + Notify on main screen if available + + + + - - - - - 0 - 0 - - - - - 150 - 0 - - - - Custom - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -4117,150 +4404,14 @@ outline: none; - 10 + 8 - 2 + 0 0 - - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 0 - - - 0 - - - - - - 140 - 32 - - - - Shutdown Timeout: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 200 - 32 - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - - 0 - 0 - - - - - 100 - 32 - - - - QSpinBox::up-button { width: 32px; height: 32px; -subcontrol-origin: margin; -subcontrol-position: center right; -} -QSpinBox::down-button { width: 32px; height: 32px; -subcontrol-origin: margin; -subcontrol-position: center left; -} - - - 1 - - - 60 - - - 60 - - - - - - - - 0 - 0 - - - - - 64 - 32 - - - - Minutes - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 32 - - - - Disable - - - - - @@ -4280,12 +4431,24 @@ subcontrol-position: center left; + + + 0 + 0 + + 140 32 + + + 140 + 32 + + Screen Off Timeout: @@ -4304,7 +4467,13 @@ subcontrol-position: center left; - 200 + 0 + 32 + + + + + 16777215 32 @@ -4392,6 +4561,210 @@ subcontrol-position: center left; + + + + + 0 + 0 + + + + + 140 + 32 + + + + + 140 + 32 + + + + use screensaver + + + + + + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 140 + 32 + + + + + 140 + 32 + + + + Shutdown Timeout: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + - - - + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 100 + 32 + + + + QSpinBox::up-button { width: 32px; height: 32px; +subcontrol-origin: margin; +subcontrol-position: center right; +} +QSpinBox::down-button { width: 32px; height: 32px; +subcontrol-origin: margin; +subcontrol-position: center left; +} + + + 1 + + + 60 + + + 60 + + + + + + + + 0 + 0 + + + + + 64 + 32 + + + + Minutes + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 32 + + + + Disable + + + + + + + + 0 + 0 + + + + + 140 + 32 + + + + + 140 + 32 + + + + + + + @@ -6110,15 +6483,15 @@ subcontrol-position: center left; - + 0 0 - Debugmode + Debugmode (extended logging) - + 9 @@ -6126,7 +6499,7 @@ subcontrol-position: center left; 2 - 9 + 0 2 @@ -6145,13 +6518,42 @@ subcontrol-position: center left; + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + background-color: rgb(78, 154, 6); +outline: none; + + + Create Log + + + - + 0 0 diff --git a/src/autoapp/UI/updatedialog.ui b/src/autoapp/UI/updatedialog.ui new file mode 100644 index 0000000..dc4af9a --- /dev/null +++ b/src/autoapp/UI/updatedialog.ui @@ -0,0 +1,877 @@ + + + UpdateDialog + + + + 0 + 0 + 731 + 260 + + + + + 0 + 0 + + + + + 500 + 260 + + + + + 731 + 260 + + + + Connect to device + + + background-color: rgb(46, 52, 54); +color: rgb(255, 255, 255); + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + Crankshaft NG Update Menu + + + Qt::AlignCenter + + + + 30 + + + 2 + + + 2 + + + + + Qt::Vertical + + + + 20 + 4 + + + + + + + + Update Crankshaft Management Tool + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(78, 154, 6); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); + + + OK + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Update CSMT + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + 0 + + + 0 + + + + + + + + + + Update System UDEV Rules + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(78, 154, 6); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); + + + OK + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Update UDEV + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + 0 + + + 0 + + + + + + + + + + Update OpenAuto Binaries + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(78, 154, 6); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); + + + OK + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Update OpenAuto + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + 0 + + + 0 + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(78, 154, 6); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); + + + OK + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(206, 92, 0); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); + + + Reboot To Install + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgb(164, 0, 0); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Update System + + + + + + + true + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + 420 + + + 0 + + + Qt::AlignCenter + + + + + + + + + + Update System (Download Flash zip) +This can take some minutes! + + + false + + + + + + + + 0 + 0 + + + + + 75 + true + + + + + + + Qt::AlignCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Rescan Updates + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Scanning... + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 140 + 30 + + + + + 140 + 30 + + + + + 75 + true + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Close + + + + + + + + + + + diff --git a/src/autoapp/UI/warning.ui b/src/autoapp/UI/warningdialog.ui similarity index 98% rename from src/autoapp/UI/warning.ui rename to src/autoapp/UI/warningdialog.ui index 43d9cf6..05504e7 100644 --- a/src/autoapp/UI/warning.ui +++ b/src/autoapp/UI/warningdialog.ui @@ -1,7 +1,7 @@ - Warning - + WarningDialog + 0 diff --git a/src/autoapp/UI/wifidialog.ui b/src/autoapp/UI/wifidialog.ui deleted file mode 100644 index ecee81f..0000000 --- a/src/autoapp/UI/wifidialog.ui +++ /dev/null @@ -1,164 +0,0 @@ - - - WifiDialog - - - - 0 - 0 - 540 - 376 - - - - - 0 - 0 - - - - MainWindow - - - background-color: rgb(85, 87, 83); - - - - - - - - 9 - 9 - 411 - 16 - - - - - 75 - true - - - - color: rgb(255, 255, 255); - - - WiFi Networks Avaliable: - - - - - - 440 - 141 - 80 - 23 - - - - background-color: rgb(211, 215, 207); -background-color: rgb(186, 189, 182); - - - Connect - - - - - - 10 - 30 - 411 - 241 - - - - background-color: rgb(186, 189, 182); - - - - Num - - - - 50 - false - PreferDefault - - - - AlignCenter - - - - - SSID - - - AlignCenter - - - - - Secturity - - - AlignCenter - - - - - - - 440 - 170 - 80 - 23 - - - - background-color: rgb(186, 189, 182); - - - Close - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - 540 - 20 - - - - - - - 0 - 0 - 540 - 20 - - - - - - - - diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index ba96302..6260257 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include #include namespace aasdk = f1x::aasdk; @@ -88,8 +88,8 @@ int main(int argc, char* argv[]) QApplication qApplication(argc, argv); const int width = QApplication::desktop()->width(); - OPENAUTO_LOG(info) << "[OpenAuto] Display width: " << width; const int height = QApplication::desktop()->height(); + OPENAUTO_LOG(info) << "[OpenAuto] Display width: " << width; OPENAUTO_LOG(info) << "[OpenAuto] Display height: " << height; auto configuration = std::make_shared(); @@ -106,29 +106,28 @@ int main(int argc, char* argv[]) autoapp::configuration::RecentAddressesList recentAddressesList(7); recentAddressesList.read(); - autoapp::ui::WifiDialog wifiDialog; - wifiDialog.setWindowFlags(Qt::WindowStaysOnTopHint); - // center dialog - wifiDialog.move((width - 540)/2,(height-340)/2); - aasdk::tcp::TCPWrapper tcpWrapper; - autoapp::ui::ConnectDialog connectDialog(ioService, tcpWrapper, recentAddressesList); - connectDialog.setWindowFlags(Qt::WindowStaysOnTopHint); - // center dialog - connectDialog.move((width - 500)/2,(height-360)/2); + autoapp::ui::ConnectDialog connectdialog(ioService, tcpWrapper, recentAddressesList); + connectdialog.setWindowFlags(Qt::WindowStaysOnTopHint); + connectdialog.move((width - 500)/2,(height-300)/2); - autoapp::ui::Warning warning; - warning.setWindowFlags(Qt::WindowStaysOnTopHint); - // center dialog - warning.move((width - 500)/2,(height-300)/2); + autoapp::ui::WarningDialog warningdialog; + warningdialog.setWindowFlags(Qt::WindowStaysOnTopHint); + warningdialog.move((width - 500)/2,(height-300)/2); + + autoapp::ui::UpdateDialog updatedialog; + updatedialog.setWindowFlags(Qt::WindowStaysOnTopHint); + updatedialog.setFixedSize(500, 260); + updatedialog.move((width - 500)/2,(height-260)/2); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::exit, []() { system("touch /tmp/shutdown"); std::exit(0); }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::reboot, []() { system("touch /tmp/reboot"); std::exit(0); }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::showFullScreen); - QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::loadClientList); - QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec); - QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openWifiDialog, &wifiDialog, &autoapp::ui::WifiDialog::exec); + QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectdialog, &autoapp::ui::ConnectDialog::loadClientList); + QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectdialog, &autoapp::ui::ConnectDialog::exec); + QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openUpdateDialog, &updatedialog, &autoapp::ui::UpdateDialog::updateCheck); + QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openUpdateDialog, &updatedialog, &autoapp::ui::UpdateDialog::exec); if (configuration->showCursor() == false) { qApplication.setOverrideCursor(Qt::BlankCursor); @@ -232,38 +231,41 @@ int main(int argc, char* argv[]) auto connectedAccessoriesEnumerator(std::make_shared(usbWrapper, ioService, queryChainFactory)); auto app = std::make_shared(ioService, usbWrapper, tcpWrapper, androidAutoEntityFactory, std::move(usbHub), std::move(connectedAccessoriesEnumerator)); - QObject::connect(&connectDialog, &autoapp::ui::ConnectDialog::connectionSucceed, [&app](auto socket) { + QObject::connect(&connectdialog, &autoapp::ui::ConnectDialog::connectionSucceed, [&app](auto socket) { app->start(std::move(socket)); }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() { - OPENAUTO_LOG(info) << "[CS] Manual start android auto entity by reset usb."; + OPENAUTO_LOG(info) << "[Autoapp] Manual start android auto entity by reset usb."; try { if (std::ifstream("/tmp/android_device")) { - system("/usr/local/bin/autoapp_helper usbreset"); + //system("/usr/local/bin/autoapp_helper usbreset"); + app->disableAutostartEntity = false; app->waitForUSBDevice(); } } catch (...) { - OPENAUTO_LOG(info) << "[CS] Exception in Manual start android auto entity by reset usb."; + OPENAUTO_LOG(info) << "[Autoapp] Exception in Manual start android auto entity by reset usb."; } }); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() { - OPENAUTO_LOG(info) << "[CS] Manual stop android auto entity."; + OPENAUTO_LOG(info) << "[Autoapp] Manual stop android auto entity."; try { if (std::ifstream("/tmp/android_device")) { + app->disableAutostartEntity = true; system("/usr/local/bin/autoapp_helper usbreset"); usleep(500000); app->stop(); } else { - app->onAndroidAutoQuit(); + app->stop(); + //app->onAndroidAutoQuit(); } } catch (...) { - OPENAUTO_LOG(info) << "[CS] Exception in Manual stop android auto entity."; + OPENAUTO_LOG(info) << "[Autoapp] Exception in Manual stop android auto entity."; } }); - warning.show(); + warningdialog.show(); app->waitForUSBDevice();