latest dev

This commit is contained in:
hawkeyexp 2019-01-16 20:45:41 +01:00
parent e653923eb6
commit b6c705544b
16 changed files with 2370 additions and 965 deletions

View File

@ -20,6 +20,10 @@
#include <boost/property_tree/ini_parser.hpp> #include <boost/property_tree/ini_parser.hpp>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp> #include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
#include <iostream>
#include <string>
#include <fstream>
#include <stdio.h>
namespace f1x namespace f1x
{ {
@ -64,6 +68,8 @@ public:
bool hideBrightnessControl() const override; bool hideBrightnessControl() const override;
void showNetworkinfo(bool value) override; void showNetworkinfo(bool value) override;
bool showNetworkinfo() const override; bool showNetworkinfo() const override;
void hideWarning(bool value) override;
bool hideWarning() const override;
std::string getMp3MasterPath() const override; std::string getMp3MasterPath() const override;
void setMp3MasterPath(const std::string& value) override; void setMp3MasterPath(const std::string& value) override;
@ -76,6 +82,10 @@ public:
bool showAutoPlay() const override; bool showAutoPlay() const override;
void showAutoPlay(bool value) override; void showAutoPlay(bool value) override;
QString getCSValue(QString searchString) const override;
QString readFileContent(QString fileName) const override;
QString getParamFromFile(QString fileName, QString searchString) const override;
aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override; aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override;
void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) override; void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) override;
aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override; aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override;
@ -89,6 +99,8 @@ public:
bool getTouchscreenEnabled() const override; bool getTouchscreenEnabled() const override;
void setTouchscreenEnabled(bool value) override; void setTouchscreenEnabled(bool value) override;
bool playerButtonControl() const override;
void playerButtonControl(bool value) override;
ButtonCodes getButtonCodes() const override; ButtonCodes getButtonCodes() const override;
void setButtonCodes(const ButtonCodes& value) override; void setButtonCodes(const ButtonCodes& value) override;
@ -121,6 +133,7 @@ private:
bool showCursor_; bool showCursor_;
bool hideBrightnessControl_; bool hideBrightnessControl_;
bool showNetworkinfo_; bool showNetworkinfo_;
bool hideWarning_;
std::string mp3MasterPath_; std::string mp3MasterPath_;
std::string mp3SubFolder_; std::string mp3SubFolder_;
int32_t mp3Track_; int32_t mp3Track_;
@ -133,6 +146,7 @@ private:
int32_t omxLayerIndex_; int32_t omxLayerIndex_;
QRect videoMargins_; QRect videoMargins_;
bool enableTouchscreen_; bool enableTouchscreen_;
bool enablePlayerControl_;
ButtonCodes buttonCodes_; ButtonCodes buttonCodes_;
BluetoothAdapterType bluetoothAdapterType_; BluetoothAdapterType bluetoothAdapterType_;
std::string bluetoothRemoteAdapterAddress_; std::string bluetoothRemoteAdapterAddress_;
@ -153,6 +167,7 @@ private:
static const std::string cGeneralShowCursorKey; static const std::string cGeneralShowCursorKey;
static const std::string cGeneralHideBrightnessControlKey; static const std::string cGeneralHideBrightnessControlKey;
static const std::string cGeneralShowNetworkinfoKey; static const std::string cGeneralShowNetworkinfoKey;
static const std::string cGeneralHideWarningKey;
static const std::string cGeneralHandednessOfTrafficTypeKey; static const std::string cGeneralHandednessOfTrafficTypeKey;
@ -177,6 +192,7 @@ private:
static const std::string cBluetoothRemoteAdapterAddressKey; static const std::string cBluetoothRemoteAdapterAddressKey;
static const std::string cInputEnableTouchscreenKey; static const std::string cInputEnableTouchscreenKey;
static const std::string cInputEnablePlayerControlKey;
static const std::string cInputPlayButtonKey; static const std::string cInputPlayButtonKey;
static const std::string cInputPauseButtonKey; static const std::string cInputPauseButtonKey;
static const std::string cInputTogglePlayButtonKey; static const std::string cInputTogglePlayButtonKey;

View File

@ -72,6 +72,8 @@ public:
virtual bool hideBrightnessControl() const = 0; virtual bool hideBrightnessControl() const = 0;
virtual void showNetworkinfo(bool value) = 0; virtual void showNetworkinfo(bool value) = 0;
virtual bool showNetworkinfo() const = 0; virtual bool showNetworkinfo() const = 0;
virtual void hideWarning(bool value) = 0;
virtual bool hideWarning() const = 0;
virtual std::string getMp3MasterPath() const = 0; virtual std::string getMp3MasterPath() const = 0;
virtual void setMp3MasterPath(const std::string& value) = 0; virtual void setMp3MasterPath(const std::string& value) = 0;
@ -84,6 +86,10 @@ public:
virtual bool showAutoPlay() const = 0; virtual bool showAutoPlay() const = 0;
virtual void showAutoPlay(bool value) = 0; virtual void showAutoPlay(bool value) = 0;
virtual QString getCSValue(QString searchString) const = 0;
virtual QString readFileContent(QString fileName) const = 0;
virtual QString getParamFromFile(QString fileName, QString searchString) const = 0;
virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0; virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0;
virtual void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) = 0; virtual void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) = 0;
virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0; virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0;
@ -97,6 +103,8 @@ public:
virtual bool getTouchscreenEnabled() const = 0; virtual bool getTouchscreenEnabled() const = 0;
virtual void setTouchscreenEnabled(bool value) = 0; virtual void setTouchscreenEnabled(bool value) = 0;
virtual bool playerButtonControl() const = 0;
virtual void playerButtonControl(bool value) = 0;
virtual ButtonCodes getButtonCodes() const = 0; virtual ButtonCodes getButtonCodes() const = 0;
virtual void setButtonCodes(const ButtonCodes& value) = 0; virtual void setButtonCodes(const ButtonCodes& value) = 0;

View File

@ -42,6 +42,10 @@
#include <taglib/tag.h> #include <taglib/tag.h>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QKeyEvent>
#include <QBluetoothLocalDevice>
//#include <QtBluetooth>
namespace Ui namespace Ui
{ {
@ -79,6 +83,12 @@ signals:
void cameraStop(); void cameraStop();
void cameraSave(); void cameraSave();
void cameraRecord(); void cameraRecord();
void cameraPosYUp();
void cameraPosYDown();
void cameraZoomPlus();
void cameraZoomMinus();
void cameraFlipX();
void cameraFlipY();
void openConnectDialog(); void openConnectDialog();
void openWifiDialog(); void openWifiDialog();
void openUpdateDialog(); void openUpdateDialog();
@ -89,6 +99,7 @@ signals:
void hideRearCam(); void hideRearCam();
void TriggerAppStart(); void TriggerAppStart();
void TriggerAppStop(); void TriggerAppStop();
void CloseAllDialogs();
private slots: private slots:
void on_horizontalSliderBrightness_valueChanged(int value); void on_horizontalSliderBrightness_valueChanged(int value);
@ -148,6 +159,9 @@ private slots:
void resetRetryUSBMessage(); void resetRetryUSBMessage();
void updateNetworkInfo(); void updateNetworkInfo();
bool check_file_exist(const char *filename); bool check_file_exist(const char *filename);
void KeyPress(QString key);
void hostModeStateChanged(QBluetoothLocalDevice::HostMode);
private: private:
Ui::MainWindow* ui_; Ui::MainWindow* ui_;
@ -250,6 +264,40 @@ private:
bool udevupdate = false; bool udevupdate = false;
bool openautoupdate = false; bool openautoupdate = false;
bool systemupdate = false; bool systemupdate = false;
int camera_ycorection;
int camera_zoom;
QBluetoothLocalDevice *localDevice;
protected:
void keyPressEvent(QKeyEvent *event) override
{
if (event->key() == Qt::Key_C) {
MainWindow::KeyPress("C");
}
if (event->key() == Qt::Key_X) {
MainWindow::KeyPress("X");
}
if (event->key() == Qt::Key_V) {
MainWindow::KeyPress("V");
}
if (event->key() == Qt::Key_N) {
MainWindow::KeyPress("N");
}
if (event->key() == Qt::Key_B) {
MainWindow::KeyPress("B");
}
if (event->key() == Qt::Key_H) {
MainWindow::KeyPress("H");
}
if (event->key() == Qt::Key_A) {
MainWindow::KeyPress("A");
}
if (event->key() == Qt::Key_L) {
MainWindow::KeyPress("L");
}
}
}; };
} }

View File

@ -22,6 +22,7 @@
#include <QWidget> #include <QWidget>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp> #include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
#include <QFileDialog> #include <QFileDialog>
#include <sys/sysinfo.h>
class QCheckBox; class QCheckBox;
class QTimer; class QTimer;
@ -77,8 +78,10 @@ private slots:
void onUpdateBrightness5(int value); void onUpdateBrightness5(int value);
void on_pushButtonNetwork0_clicked(); void on_pushButtonNetwork0_clicked();
void on_pushButtonNetwork1_clicked(); void on_pushButtonNetwork1_clicked();
void updateSystemInfo();
void updateInfo();
private slots: public slots:
void show_tab1(); void show_tab1();
void show_tab2(); void show_tab2();
void show_tab3(); void show_tab3();
@ -99,9 +102,6 @@ private:
Ui::SettingsWindow* ui_; Ui::SettingsWindow* ui_;
configuration::IConfiguration::Pointer configuration_; configuration::IConfiguration::Pointer configuration_;
QString hotspotssid;
QString wifissid;
}; };
} }

View File

@ -21,6 +21,7 @@ public:
explicit WarningDialog(QWidget *parent = nullptr); explicit WarningDialog(QWidget *parent = nullptr);
~WarningDialog() override; ~WarningDialog() override;
private:
Ui::WarningDialog* ui_; Ui::WarningDialog* ui_;
private slots: private slots:

View File

@ -110,14 +110,14 @@ void App::aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle)
{ {
// ignore autostart if exit to csng was used // ignore autostart if exit to csng was used
if (!disableAutostartEntity) { if (!disableAutostartEntity) {
OPENAUTO_LOG(info) << "[App] Autostart Entity allowed - let's go."; OPENAUTO_LOG(info) << "[App] Start Android Auto allowed - let's go.";
connectedAccessoriesEnumerator_->cancel(); connectedAccessoriesEnumerator_->cancel();
auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle)); auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle));
androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(aoapDevice)); androidAutoEntity_ = androidAutoEntityFactory_.create(std::move(aoapDevice));
androidAutoEntity_->start(*this); androidAutoEntity_->start(*this);
} else { } else {
OPENAUTO_LOG(info) << "[App] Autostart Entity not allowed - skip."; OPENAUTO_LOG(info) << "[App] Start Android Auto not allowed - skip.";
} }
} }
catch(const aasdk::error::Error& error) catch(const aasdk::error::Error& error)
@ -157,21 +157,12 @@ void App::onAndroidAutoQuit()
strand_.dispatch([this, self = this->shared_from_this()]() { strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit."; OPENAUTO_LOG(info) << "[App] onAndroidAutoQuit.";
try { androidAutoEntity_->stop();
androidAutoEntity_->stop(); androidAutoEntity_.reset();
androidAutoEntity_.reset();
} catch (...) {
OPENAUTO_LOG(info) << "[App] Exception in onAndroidAutoQuit.";
}
if(!isStopped_) if(!isStopped_)
{ {
try { this->waitForDevice();
this->waitForDevice();
} catch (...) {
OPENAUTO_LOG(info) << "[App] Exception in onAndroidAutoQuit - waitfordevice.";
}
} }
}); });
} }

View File

@ -42,6 +42,7 @@ const std::string Configuration::cGeneralShowLuxKey = "General.ShowLux";
const std::string Configuration::cGeneralShowCursorKey = "General.ShowCursor"; const std::string Configuration::cGeneralShowCursorKey = "General.ShowCursor";
const std::string Configuration::cGeneralHideBrightnessControlKey = "General.HideBrightnessControl"; const std::string Configuration::cGeneralHideBrightnessControlKey = "General.HideBrightnessControl";
const std::string Configuration::cGeneralShowNetworkinfoKey = "General.ShowNetworkinfo"; const std::string Configuration::cGeneralShowNetworkinfoKey = "General.ShowNetworkinfo";
const std::string Configuration::cGeneralHideWarningKey = "General.HideWarning";
const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType"; const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType";
@ -66,6 +67,7 @@ const std::string Configuration::cBluetoothAdapterTypeKey = "Bluetooth.AdapterTy
const std::string Configuration::cBluetoothRemoteAdapterAddressKey = "Bluetooth.RemoteAdapterAddress"; const std::string Configuration::cBluetoothRemoteAdapterAddressKey = "Bluetooth.RemoteAdapterAddress";
const std::string Configuration::cInputEnableTouchscreenKey = "Input.EnableTouchscreen"; const std::string Configuration::cInputEnableTouchscreenKey = "Input.EnableTouchscreen";
const std::string Configuration::cInputEnablePlayerControlKey = "Input.EnablePlayerControl";
const std::string Configuration::cInputPlayButtonKey = "Input.PlayButton"; const std::string Configuration::cInputPlayButtonKey = "Input.PlayButton";
const std::string Configuration::cInputPauseButtonKey = "Input.PauseButton"; const std::string Configuration::cInputPauseButtonKey = "Input.PauseButton";
const std::string Configuration::cInputTogglePlayButtonKey = "Input.TogglePlayButton"; const std::string Configuration::cInputTogglePlayButtonKey = "Input.TogglePlayButton";
@ -107,6 +109,7 @@ void Configuration::load()
showLux_ = iniConfig.get<bool>(cGeneralShowLuxKey, false); showLux_ = iniConfig.get<bool>(cGeneralShowLuxKey, false);
showCursor_ = iniConfig.get<bool>(cGeneralShowCursorKey, false); showCursor_ = iniConfig.get<bool>(cGeneralShowCursorKey, false);
hideBrightnessControl_ = iniConfig.get<bool>(cGeneralHideBrightnessControlKey, false); hideBrightnessControl_ = iniConfig.get<bool>(cGeneralHideBrightnessControlKey, false);
hideWarning_ = iniConfig.get<bool>(cGeneralHideWarningKey, false);
showNetworkinfo_ = iniConfig.get<bool>(cGeneralShowNetworkinfoKey, false); showNetworkinfo_ = iniConfig.get<bool>(cGeneralShowNetworkinfoKey, false);
mp3MasterPath_ = iniConfig.get<std::string>(cGeneralMp3MasterPathKey, "/media/MYMEDIA"); mp3MasterPath_ = iniConfig.get<std::string>(cGeneralMp3MasterPathKey, "/media/MYMEDIA");
mp3SubFolder_ = iniConfig.get<std::string>(cGeneralMp3SubFolderKey, "/"); mp3SubFolder_ = iniConfig.get<std::string>(cGeneralMp3SubFolderKey, "/");
@ -119,12 +122,13 @@ void Configuration::load()
videoResolution_ = static_cast<aasdk::proto::enums::VideoResolution::Enum>(iniConfig.get<uint32_t>(cVideoResolutionKey, videoResolution_ = static_cast<aasdk::proto::enums::VideoResolution::Enum>(iniConfig.get<uint32_t>(cVideoResolutionKey,
aasdk::proto::enums::VideoResolution::_480p)); aasdk::proto::enums::VideoResolution::_480p));
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 100); screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 140);
omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1); omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1);
videoMargins_ = QRect(0, 0, iniConfig.get<int32_t>(cVideoMarginWidth, 0), iniConfig.get<int32_t>(cVideoMarginHeight, 0)); videoMargins_ = QRect(0, 0, iniConfig.get<int32_t>(cVideoMarginWidth, 0), iniConfig.get<int32_t>(cVideoMarginHeight, 0));
enableTouchscreen_ = iniConfig.get<bool>(cInputEnableTouchscreenKey, true); enableTouchscreen_ = iniConfig.get<bool>(cInputEnableTouchscreenKey, true);
enablePlayerControl_ = iniConfig.get<bool>(cInputEnablePlayerControlKey, false);
this->readButtonCodes(iniConfig); this->readButtonCodes(iniConfig);
bluetoothAdapterType_ = static_cast<BluetoothAdapterType>(iniConfig.get<uint32_t>(cBluetoothAdapterTypeKey, bluetoothAdapterType_ = static_cast<BluetoothAdapterType>(iniConfig.get<uint32_t>(cBluetoothAdapterTypeKey,
@ -156,6 +160,7 @@ void Configuration::reset()
showLux_ = false; showLux_ = false;
showCursor_ = false; showCursor_ = false;
hideBrightnessControl_ = false; hideBrightnessControl_ = false;
hideWarning_ = false;
showNetworkinfo_ = false; showNetworkinfo_ = false;
mp3MasterPath_ = "/media/MYMEDIA"; mp3MasterPath_ = "/media/MYMEDIA";
mp3SubFolder_ = "/"; mp3SubFolder_ = "/";
@ -164,10 +169,11 @@ void Configuration::reset()
showAutoPlay_ = false; showAutoPlay_ = false;
videoFPS_ = aasdk::proto::enums::VideoFPS::_30; videoFPS_ = aasdk::proto::enums::VideoFPS::_30;
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p; videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
screenDPI_ = 100; screenDPI_ = 140;
omxLayerIndex_ = 1; omxLayerIndex_ = 1;
videoMargins_ = QRect(0, 0, 0, 0); videoMargins_ = QRect(0, 0, 0, 0);
enableTouchscreen_ = true; enableTouchscreen_ = true;
enablePlayerControl_ = false;
buttonCodes_.clear(); buttonCodes_.clear();
bluetoothAdapterType_ = BluetoothAdapterType::NONE; bluetoothAdapterType_ = BluetoothAdapterType::NONE;
bluetoothRemoteAdapterAddress_ = ""; bluetoothRemoteAdapterAddress_ = "";
@ -190,6 +196,7 @@ void Configuration::save()
iniConfig.put<bool>(cGeneralShowLuxKey, showLux_); iniConfig.put<bool>(cGeneralShowLuxKey, showLux_);
iniConfig.put<bool>(cGeneralShowCursorKey, showCursor_); iniConfig.put<bool>(cGeneralShowCursorKey, showCursor_);
iniConfig.put<bool>(cGeneralHideBrightnessControlKey, hideBrightnessControl_); iniConfig.put<bool>(cGeneralHideBrightnessControlKey, hideBrightnessControl_);
iniConfig.put<bool>(cGeneralHideWarningKey, hideWarning_);
iniConfig.put<bool>(cGeneralShowNetworkinfoKey, showNetworkinfo_); iniConfig.put<bool>(cGeneralShowNetworkinfoKey, showNetworkinfo_);
iniConfig.put<std::string>(cGeneralMp3MasterPathKey, mp3MasterPath_); iniConfig.put<std::string>(cGeneralMp3MasterPathKey, mp3MasterPath_);
iniConfig.put<std::string>(cGeneralMp3SubFolderKey, mp3SubFolder_); iniConfig.put<std::string>(cGeneralMp3SubFolderKey, mp3SubFolder_);
@ -205,6 +212,7 @@ void Configuration::save()
iniConfig.put<uint32_t>(cVideoMarginHeight, videoMargins_.height()); iniConfig.put<uint32_t>(cVideoMarginHeight, videoMargins_.height());
iniConfig.put<bool>(cInputEnableTouchscreenKey, enableTouchscreen_); iniConfig.put<bool>(cInputEnableTouchscreenKey, enableTouchscreen_);
iniConfig.put<bool>(cInputEnablePlayerControlKey, enablePlayerControl_);
this->writeButtonCodes(iniConfig); this->writeButtonCodes(iniConfig);
iniConfig.put<uint32_t>(cBluetoothAdapterTypeKey, static_cast<uint32_t>(bluetoothAdapterType_)); iniConfig.put<uint32_t>(cBluetoothAdapterTypeKey, static_cast<uint32_t>(bluetoothAdapterType_));
@ -335,6 +343,16 @@ bool Configuration::hideBrightnessControl() const
return hideBrightnessControl_; return hideBrightnessControl_;
} }
void Configuration::hideWarning(bool value)
{
hideWarning_ = value;
}
bool Configuration::hideWarning() const
{
return hideWarning_;
}
void Configuration::showNetworkinfo(bool value) void Configuration::showNetworkinfo(bool value)
{ {
showNetworkinfo_ = value; showNetworkinfo_ = value;
@ -455,6 +473,16 @@ void Configuration::setTouchscreenEnabled(bool value)
enableTouchscreen_ = value; enableTouchscreen_ = value;
} }
bool Configuration::playerButtonControl() const
{
return enablePlayerControl_;
}
void Configuration::playerButtonControl(bool value)
{
enablePlayerControl_ = value;
}
Configuration::ButtonCodes Configuration::getButtonCodes() const Configuration::ButtonCodes Configuration::getButtonCodes() const
{ {
return buttonCodes_; return buttonCodes_;
@ -515,6 +543,129 @@ void Configuration::setAudioOutputBackendType(AudioOutputBackendType value)
audioOutputBackendType_ = value; audioOutputBackendType_ = value;
} }
QString Configuration::getCSValue(QString searchString) const
{
using namespace std;
ifstream inFile;
ifstream inFile2;
string line;
searchString = searchString.append("=");
inFile.open("/boot/crankshaft/crankshaft_env.sh");
inFile2.open("/opt/crankshaft/crankshaft_default_env.sh");
size_t pos;
if(inFile) {
while(inFile.good())
{
getline(inFile,line); // get line from file
if (line[0] != '#') {
pos=line.find(searchString.toStdString()); // search
if(pos!=std::string::npos) // string::npos is returned if string is not found
{
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
}
OPENAUTO_LOG(warning) << "[Configuration] unable to find cs param: " << searchString.toStdString();
OPENAUTO_LOG(warning) << "[Configuration] Fallback to /opt/crankshaft/crankshaft_default_env.sh)";
while(inFile2.good())
{
getline(inFile2,line); // get line from file
if (line[0] != '#') {
pos=line.find(searchString.toStdString()); // search
if(pos!=std::string::npos) // string::npos is returned if string is not found
{
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
}
return "";
} else {
OPENAUTO_LOG(warning) << "[Configuration] unable to open cs param file (/boot/crankshaft/crankshaft_env.sh)";
OPENAUTO_LOG(warning) << "[Configuration] Fallback to /opt/crankshaft/crankshaft_default_env.sh)";
while(inFile2.good())
{
getline(inFile2,line); // get line from file
if (line[0] != '#') {
pos=line.find(searchString.toStdString()); // search
if(pos!=std::string::npos) // string::npos is returned if string is not found
{
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] CS param found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
}
return "";
}
}
QString Configuration::getParamFromFile(QString fileName, QString searchString) const
{
OPENAUTO_LOG(info) << "[Configuration] Request param from file: " << fileName.toStdString() << " param: " << searchString.toStdString();
using namespace std;
ifstream inFile;
string line;
if (!searchString.contains("dtoverlay")) {
searchString = searchString.append("=");
}
inFile.open(fileName.toStdString());
size_t pos;
if(inFile) {
while(inFile.good())
{
getline(inFile,line); // get line from file
if (line[0] != '#') {
pos=line.find(searchString.toStdString()); // search
if(pos!=std::string::npos) // string::npos is returned if string is not found
{
int equalPosition = line.find("=");
QString value = line.substr(equalPosition + 1).c_str();
value.replace("\"","");
OPENAUTO_LOG(info) << "[Configuration] Param from file: " << fileName.toStdString() << " found: " << searchString.toStdString() << " Value:" << value.toStdString();
return value;
}
}
}
return "";
} else {
return "";
}
}
QString Configuration::readFileContent(QString fileName) const
{
using namespace std;
ifstream inFile;
string line;
inFile.open(fileName.toStdString());
string result = "";
if(inFile) {
while(inFile.good())
{
getline(inFile,line); // get line from file
result.append(line);
}
return result.c_str();
} else {
return "";
}
}
void Configuration::readButtonCodes(boost::property_tree::ptree& iniConfig) void Configuration::readButtonCodes(boost::property_tree::ptree& iniConfig)
{ {
this->insertButtonCode(iniConfig, cInputPlayButtonKey, aasdk::proto::enums::ButtonCode::PLAY); this->insertButtonCode(iniConfig, cInputPlayButtonKey, aasdk::proto::enums::ButtonCode::PLAY);

View File

@ -74,12 +74,16 @@ void AndroidAutoEntity::stop()
strand_.dispatch([this, self = this->shared_from_this()]() { strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop."; OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop.";
eventHandler_ = nullptr; try {
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::stop, std::placeholders::_1)); eventHandler_ = nullptr;
pinger_->cancel(); std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::stop, std::placeholders::_1));
messenger_->stop(); pinger_->cancel();
transport_->stop(); messenger_->stop();
cryptor_->deinit(); transport_->stop();
cryptor_->deinit();
} catch (...) {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] exception in stop.";
}
}); });
} }

View File

@ -146,6 +146,20 @@ void ConnectDialog::loadClientList()
} }
} }
versionFile.close(); versionFile.close();
if (ui_->listWidgetClients->count() == 1) {
this->setControlsEnabledStatus(false);
const auto& ipAddress = ui_->lineEditIPAddress->text().toStdString();
auto socket = std::make_shared<boost::asio::ip::tcp::socket>(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 { } else {
ui_->lineEditIPAddress->setText(""); ui_->lineEditIPAddress->setText("");
} }

View File

@ -29,7 +29,6 @@
#include <QFont> #include <QFont>
#include <QScreen> #include <QScreen>
#include <QRect> #include <QRect>
#include <QFileSystemWatcher>
#include <QVideoWidget> #include <QVideoWidget>
#include <QNetworkInterface> #include <QNetworkInterface>
#include <iostream> #include <iostream>
@ -50,6 +49,7 @@ namespace ui
MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent) MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui_(new Ui::MainWindow) , ui_(new Ui::MainWindow)
, localDevice(new QBluetoothLocalDevice)
{ {
// set default bg color to black // set default bg color to black
this->setStyleSheet("QMainWindow {background-color: rgb(0,0,0);}"); this->setStyleSheet("QMainWindow {background-color: rgb(0,0,0);}");
@ -130,16 +130,15 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->clockOnlyWidget->hide(); ui_->clockOnlyWidget->hide();
// by default hide bluetooth button on init
ui_->pushButtonBluetooth->hide(); ui_->pushButtonBluetooth->hide();
ui_->labelBluetoothPairable->hide();
// by default hide media player // by default hide media player
ui_->mediaWidget->hide(); ui_->mediaWidget->hide();
ui_->pushButtonUSB->hide();
ui_->SysinfoTopLeft->hide(); ui_->SysinfoTopLeft->hide();
ui_->pushButtonAndroidAuto->hide(); ui_->ButtonAndroidAuto->hide();
ui_->pushButtonAndroidAuto2->hide(); ui_->pushButtonAndroidAuto2->hide();
ui_->SysinfoTopLeft2->hide(); ui_->SysinfoTopLeft2->hide();
@ -153,6 +152,11 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->networkInfo->hide(); ui_->networkInfo->hide();
} }
if (!this->devModeEnabled) {
ui_->labelLock->hide();
ui_->labelLockDummy->hide();
}
if (check_file_exist("/etc/crankshaft.branch")) { if (check_file_exist("/etc/crankshaft.branch")) {
QFile branchFile(QString("/etc/crankshaft.branch")); QFile branchFile(QString("/etc/crankshaft.branch"));
branchFile.open(QIODevice::ReadOnly); branchFile.open(QIODevice::ReadOnly);
@ -183,6 +187,12 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
connect(ui_->pushButtonStop, &QPushButton::clicked, this, &MainWindow::cameraStop); connect(ui_->pushButtonStop, &QPushButton::clicked, this, &MainWindow::cameraStop);
connect(ui_->pushButtonRecord, &QPushButton::clicked, this, &MainWindow::cameraRecord); connect(ui_->pushButtonRecord, &QPushButton::clicked, this, &MainWindow::cameraRecord);
connect(ui_->pushButtonSave, &QPushButton::clicked, this, &MainWindow::cameraSave); connect(ui_->pushButtonSave, &QPushButton::clicked, this, &MainWindow::cameraSave);
connect(ui_->pushButtonUp, &QPushButton::clicked, this, &MainWindow::cameraPosYUp);
connect(ui_->pushButtonDown, &QPushButton::clicked, this, &MainWindow::cameraPosYDown);
connect(ui_->pushButtonPlus, &QPushButton::clicked, this, &MainWindow::cameraZoomPlus);
connect(ui_->pushButtonMinus, &QPushButton::clicked, this, &MainWindow::cameraZoomMinus);
this->camera_ycorection=configuration->getCSValue("RPICAM_YCORRECTION").toInt();
this->camera_zoom=configuration->getCSValue("RPICAM_ZOOM").toInt();
} else { } else {
ui_->pushButtonCameraShow->hide(); ui_->pushButtonCameraShow->hide();
ui_->pushButtonCameraShow2->hide(); ui_->pushButtonCameraShow2->hide();
@ -375,19 +385,11 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->devlabel_right->hide(); ui_->devlabel_right->hide();
} }
// Load configured brightness values // set brightness slider attribs from cs config
system("/usr/local/bin/autoapp_helper getbrightnessvalues"); ui_->horizontalSliderBrightness->setMinimum(configuration->getCSValue("BR_MIN").toInt());
QFile paramFile(QString("/tmp/br_values")); ui_->horizontalSliderBrightness->setMaximum(configuration->getCSValue("BR_MAX").toInt());
paramFile.open(QIODevice::ReadOnly); ui_->horizontalSliderBrightness->setSingleStep(configuration->getCSValue("BR_STEP").toInt());
QTextStream data_param(&paramFile); ui_->horizontalSliderBrightness->setTickInterval(configuration->getCSValue("BR_STEP").toInt());
QStringList brigthnessvalues = data_param.readAll().split("#");
paramFile.close();
// set brightness slider attribs
ui_->horizontalSliderBrightness->setMinimum(brigthnessvalues[0].toInt());
ui_->horizontalSliderBrightness->setMaximum(brigthnessvalues[1].toInt());
ui_->horizontalSliderBrightness->setSingleStep(brigthnessvalues[2].toInt());
ui_->horizontalSliderBrightness->setTickInterval(brigthnessvalues[2].toInt());
// run monitor for custom brightness command if enabled in crankshaft_env.sh // run monitor for custom brightness command if enabled in crankshaft_env.sh
if (std::ifstream("/tmp/custombrightness")) { if (std::ifstream("/tmp/custombrightness")) {
@ -396,7 +398,6 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->pushButtonBrightness2->show(); ui_->pushButtonBrightness2->show();
} }
this->customBrightnessControl = true; this->customBrightnessControl = true;
system("/usr/local/bin/autoapp_helper startcustombrightness &");
} }
// read param file // read param file
@ -545,6 +546,13 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
watcher_tmp->addPath("/tmp"); watcher_tmp->addPath("/tmp");
connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &MainWindow::tmpChanged); connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &MainWindow::tmpChanged);
// Experimental test code
localDevice = new QBluetoothLocalDevice(this);
connect(localDevice, SIGNAL(hostModeStateChanged(QBluetoothLocalDevice::HostMode)),
this, SLOT(hostModeStateChanged(QBluetoothLocalDevice::HostMode)));
hostModeStateChanged(localDevice->hostMode());
updateNetworkInfo(); updateNetworkInfo();
} }
@ -558,6 +566,24 @@ MainWindow::~MainWindow()
} }
} }
void f1x::openauto::autoapp::ui::MainWindow::hostModeStateChanged(QBluetoothLocalDevice::HostMode mode)
{
if (mode != QBluetoothLocalDevice::HostPoweredOff) {
this->bluetoothEnabled = true;
ui_->pushButtonBluetooth->show();
if (std::ifstream("/tmp/bluetooth_pairable")) {
ui_->labelBluetoothPairable->show();
ui_->pushButtonBluetooth->hide();
} else {
ui_->labelBluetoothPairable->hide();
}
} else {
this->bluetoothEnabled = false;
ui_->pushButtonBluetooth->hide();
ui_->labelBluetoothPairable->hide();
}
}
void f1x::openauto::autoapp::ui::MainWindow::updateNetworkInfo() void f1x::openauto::autoapp::ui::MainWindow::updateNetworkInfo()
{ {
QNetworkInterface wlan0if = QNetworkInterface::interfaceFromName("wlan0"); QNetworkInterface wlan0if = QNetworkInterface::interfaceFromName("wlan0");
@ -568,26 +594,12 @@ void f1x::openauto::autoapp::ui::MainWindow::updateNetworkInfo()
//qDebug() << "wlan0: " << wlan0.ip(); //qDebug() << "wlan0: " << wlan0.ip();
ui_->value_ip->setText(wlan0.ip().toString().simplified()); ui_->value_ip->setText(wlan0.ip().toString().simplified());
ui_->value_mask->setText(wlan0.netmask().toString().simplified()); ui_->value_mask->setText(wlan0.netmask().toString().simplified());
if (std::ifstream("/tmp/wifi_ssid")) { if (std::ifstream("/tmp/hotspot_active")) {
QFile wifiData(QString("/tmp/wifi_ssid")); ui_->value_ssid->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid"));
wifiData.open(QIODevice::ReadOnly);
QTextStream gateway_date(&wifiData);
QString linedate = gateway_date.readAll();
wifiData.close();
ui_->value_ssid->setText(linedate.simplified());
} else { } else {
ui_->value_ssid->setText(""); ui_->value_ssid->setText(configuration_->readFileContent("/tmp/wifi_ssid"));
}
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("");
} }
ui_->value_gw->setText(configuration_->readFileContent("/tmp/gateway_wlan0"));
} }
} else { } else {
//qDebug() << "wlan0: down"; //qDebug() << "wlan0: down";
@ -783,7 +795,9 @@ void f1x::openauto::autoapp::ui::MainWindow::updateAlpha()
ui_->pushButtonDummy3->setStyleSheet( "background-color: rgba(186, 189, 182, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5);"); ui_->pushButtonDummy3->setStyleSheet( "background-color: rgba(186, 189, 182, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5);");
ui_->pushButtonDebug->setStyleSheet( "background-color: rgba(85, 87, 83, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5);"); ui_->pushButtonDebug->setStyleSheet( "background-color: rgba(85, 87, 83, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5);");
ui_->pushButtonMusic->setStyleSheet( "background-color: rgba(78, 154, 6, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);"); ui_->pushButtonMusic->setStyleSheet( "background-color: rgba(78, 154, 6, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);");
ui_->pushButtonAndroidAuto->setStyleSheet( "background-color: rgba(48, 140, 198, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);"); ui_->pushButtonAndroidAuto->setStyleSheet( "background-color: rgba(48, 140, 198, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255); border-bottom: 0px; border-top: 0px;");
ui_->labelAndroidAutoBottom->setStyleSheet( "background-color: rgba(48, 140, 198, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255); border-top: 0px;");
ui_->labelAndroidAutoTop->setStyleSheet( "background-color: rgba(48, 140, 198, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255); border-bottom: 0px;");
ui_->pushButtonNoDevice->setStyleSheet( "background-color: rgba(48, 140, 198, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);"); ui_->pushButtonNoDevice->setStyleSheet( "background-color: rgba(48, 140, 198, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);");
ui_->pushButtonNoWiFiDevice->setStyleSheet( "background-color: rgba(252, 175, 62, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);"); ui_->pushButtonNoWiFiDevice->setStyleSheet( "background-color: rgba(252, 175, 62, " + alp + " ); border-radius: 4px; border: 2px solid rgba(255,255,255,0.5); color: rgb(255,255,255);");
// old style // old style
@ -877,6 +891,10 @@ void f1x::openauto::autoapp::ui::MainWindow::playerShow()
ui_->VolumeSliderControlPlayer->show(); ui_->VolumeSliderControlPlayer->show();
ui_->VolumeSliderControl->hide(); ui_->VolumeSliderControl->hide();
ui_->BrightnessSliderControl->hide(); ui_->BrightnessSliderControl->hide();
ui_->networkInfo->hide();
if (player->state() == QMediaPlayer::PlayingState) {
on_pushButtonBackToPlayer_clicked();
}
} }
void f1x::openauto::autoapp::ui::MainWindow::playerHide() void f1x::openauto::autoapp::ui::MainWindow::playerHide()
@ -890,6 +908,9 @@ void f1x::openauto::autoapp::ui::MainWindow::playerHide()
ui_->VolumeSliderControl->show(); ui_->VolumeSliderControl->show();
ui_->VolumeSliderControlPlayer->hide(); ui_->VolumeSliderControlPlayer->hide();
ui_->BrightnessSliderControl->hide(); ui_->BrightnessSliderControl->hide();
if (configuration_->showNetworkinfo()) {
ui_->networkInfo->hide();
}
f1x::openauto::autoapp::ui::MainWindow::updateBG(); f1x::openauto::autoapp::ui::MainWindow::updateBG();
f1x::openauto::autoapp::ui::MainWindow::tmpChanged(); f1x::openauto::autoapp::ui::MainWindow::tmpChanged();
} }
@ -1218,6 +1239,12 @@ void f1x::openauto::autoapp::ui::MainWindow::on_comboBoxAlbum_currentIndexChange
{ {
this->albumfolder = arg1; this->albumfolder = arg1;
MainWindow::scanFiles(); MainWindow::scanFiles();
ui_->pushButtonPlayerPause->hide();
ui_->pushButtonPlayerStop->hide();
ui_->pushButtonList->hide();
ui_->pushButtonBackToPlayer->hide();
ui_->labelCurrentPlaying->setText("");
ui_->playerPositionTime->setText("");
} }
void f1x::openauto::autoapp::ui::MainWindow::setTrigger() void f1x::openauto::autoapp::ui::MainWindow::setTrigger()
@ -1344,6 +1371,12 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerPrevAlbum_clicke
ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1)); ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1));
player->play(); player->play();
} }
if (ui_->mp3selectWidget->isVisible() == false) {
ui_->pushButtonPlayerBack->show();
ui_->pushButtonList->show();
ui_->pushButtonPlayerPause->show();
ui_->pushButtonPlayerStop->show();
}
} }
void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerNextAlbum_clicked() void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerNextAlbum_clicked()
@ -1361,6 +1394,12 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerNextAlbum_clicke
ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1)); ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1));
player->play(); player->play();
} }
if (ui_->mp3selectWidget->isVisible() == false) {
ui_->pushButtonPlayerBack->show();
ui_->pushButtonList->show();
ui_->pushButtonPlayerPause->show();
ui_->pushButtonPlayerStop->show();
}
} }
void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBackToPlayer_clicked() void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBackToPlayer_clicked()
@ -1370,6 +1409,8 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBackToPlayer_clicked()
ui_->pushButtonBackToPlayer->hide(); ui_->pushButtonBackToPlayer->hide();
ui_->pushButtonPlayerPlayList->hide(); ui_->pushButtonPlayerPlayList->hide();
ui_->pushButtonList->show(); ui_->pushButtonList->show();
ui_->pushButtonPlayerPause->show();
ui_->pushButtonPlayerStop->show();
} }
void f1x::openauto::autoapp::ui::MainWindow::on_StateChanged(QMediaPlayer::State state) void f1x::openauto::autoapp::ui::MainWindow::on_StateChanged(QMediaPlayer::State state)
@ -1399,6 +1440,40 @@ bool f1x::openauto::autoapp::ui::MainWindow::check_file_exist(const char *fileNa
} }
} }
void f1x::openauto::autoapp::ui::MainWindow::KeyPress(QString key)
{
if (configuration_->playerButtonControl()) {
if (key == "C") {
on_pushButtonPlayerPause_clicked();
}
if (key == "X") {
on_pushButtonPlayerPlayList_clicked();
}
if (key == "V") {
on_pushButtonPlayerPrevBig_clicked();
}
if (key == "N") {
on_pushButtonPlayerNextBig_clicked();
}
if (key == "B") {
on_pushButtonPlayerPause_clicked();
}
if (key == "A") {
on_pushButtonPlayerPrevAlbum_clicked();
}
if (key == "L") {
on_pushButtonPlayerNextAlbum_clicked();
}
if (key == "H") {
if (ui_->mediaWidget->isVisible() == false) {
playerShow();
} else {
playerHide();
}
}
}
}
void f1x::openauto::autoapp::ui::MainWindow::tmpChanged() void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
{ {
try { try {
@ -1414,6 +1489,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
// check if system is in display off mode (tap2wake) // check if system is in display off mode (tap2wake)
if (std::ifstream("/tmp/blankscreen")) { if (std::ifstream("/tmp/blankscreen")) {
if (ui_->centralWidget->isVisible() == true) { if (ui_->centralWidget->isVisible() == true) {
CloseAllDialogs();
ui_->centralWidget->hide(); ui_->centralWidget->hide();
} }
} else { } else {
@ -1432,6 +1508,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
} }
if (ui_->headerWidget->isVisible() == true) { if (ui_->headerWidget->isVisible() == true) {
ui_->headerWidget->hide(); ui_->headerWidget->hide();
CloseAllDialogs();
} }
if (ui_->mediaWidget->isVisible() == true) { if (ui_->mediaWidget->isVisible() == true) {
ui_->mediaWidget->hide(); ui_->mediaWidget->hide();
@ -1484,33 +1561,57 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
// check if phone is conencted to usb // check if phone is conencted to usb
if (std::ifstream("/tmp/android_device")) { if (std::ifstream("/tmp/android_device")) {
if (ui_->pushButtonAndroidAuto->isVisible() == false) { if (ui_->ButtonAndroidAuto->isVisible() == false) {
ui_->pushButtonAndroidAuto->show(); ui_->ButtonAndroidAuto->show();
ui_->pushButtonNoDevice->hide(); ui_->pushButtonNoDevice->hide();
} }
if (ui_->pushButtonAndroidAuto2->isVisible() == false) { if (ui_->pushButtonAndroidAuto2->isVisible() == false) {
ui_->pushButtonAndroidAuto2->show(); ui_->pushButtonAndroidAuto2->show();
ui_->pushButtonNoDevice2->hide(); ui_->pushButtonNoDevice2->hide();
} }
try {
QFile deviceData(QString("/tmp/android_device"));
deviceData.open(QIODevice::ReadOnly);
QTextStream data_date(&deviceData);
QString linedate = data_date.readAll().split("\n")[1];
deviceData.close();
ui_->labelAndroidAutoBottom->setText(linedate.simplified().replace("_"," "));
} catch (...) {
ui_->labelAndroidAutoBottom->setText("");
}
} else { } else {
if (ui_->pushButtonAndroidAuto->isVisible() == true) { if (ui_->ButtonAndroidAuto->isVisible() == true) {
ui_->pushButtonNoDevice->show(); ui_->pushButtonNoDevice->show();
ui_->pushButtonAndroidAuto->hide(); ui_->ButtonAndroidAuto->hide();
} }
if (ui_->pushButtonAndroidAuto2->isVisible() == true) { if (ui_->pushButtonAndroidAuto2->isVisible() == true) {
ui_->pushButtonNoDevice2->show(); ui_->pushButtonNoDevice2->show();
ui_->pushButtonAndroidAuto2->hide(); ui_->pushButtonAndroidAuto2->hide();
} }
ui_->labelAndroidAutoBottom->setText("");
} }
// check if bluetooth available // check if bluetooth pairable
this->bluetoothEnabled = check_file_exist("/tmp/button_bluetooth_visible");
if (this->bluetoothEnabled) { if (this->bluetoothEnabled) {
if (ui_->pushButtonBluetooth->isVisible() == false) { if (std::ifstream("/tmp/bluetooth_pairable")) {
ui_->pushButtonBluetooth->show(); if (ui_->labelBluetoothPairable->isVisible() == false) {
ui_->labelBluetoothPairable->show();
}
if (ui_->pushButtonBluetooth->isVisible() == true) {
ui_->pushButtonBluetooth->hide();
}
} else {
if (ui_->labelBluetoothPairable->isVisible() == true) {
ui_->labelBluetoothPairable->hide();
}
if (ui_->pushButtonBluetooth->isVisible() == false) {
ui_->pushButtonBluetooth->show();
}
} }
} else { } else {
if (ui_->labelBluetoothPairable->isVisible() == true) {
ui_->labelBluetoothPairable->hide();
}
if (ui_->pushButtonBluetooth->isVisible() == true) { if (ui_->pushButtonBluetooth->isVisible() == true) {
ui_->pushButtonBluetooth->hide(); ui_->pushButtonBluetooth->hide();
} }
@ -1518,7 +1619,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
// check if a device is connected via bluetooth // check if a device is connected via bluetooth
if (std::ifstream("/tmp/btdevice")) { if (std::ifstream("/tmp/btdevice")) {
if (ui_->btDevice->isVisible() == false) { if (ui_->btDevice->isVisible() == false || ui_->btDevice->text().simplified() == "") {
QFile phoneBTData(QString("/tmp/btdevice")); QFile phoneBTData(QString("/tmp/btdevice"));
phoneBTData.open(QIODevice::ReadOnly); phoneBTData.open(QIODevice::ReadOnly);
QTextStream data_date(&phoneBTData); QTextStream data_date(&phoneBTData);
@ -1747,7 +1848,9 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
} }
} else { } else {
if (ui_->networkInfo->isVisible() == false) { if (ui_->networkInfo->isVisible() == false) {
ui_->networkInfo->show(); if (ui_->mediaWidget->isVisible() == false) {
ui_->networkInfo->show();
}
} }
} }
@ -1836,5 +1939,36 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
} }
} }
} }
if (std::ifstream("/tmp/btdevice") || std::ifstream("/tmp/media_playing") || std::ifstream("/tmp/dev_mode_enabled") || std::ifstream("/tmp/android_device")) {
if (ui_->labelLock->isVisible() == false) {
ui_->labelLock->show();
ui_->labelLockDummy->show();
}
} else {
if (ui_->labelLock->isVisible() == true) {
ui_->labelLock->hide();
ui_->labelLockDummy->hide();
}
}
updateNetworkInfo(); updateNetworkInfo();
//QString localDeviceName;
//QString localDeviceAddress;
//if (localDevice->isValid()) {
// localDeviceName = localDevice->name();
// localDeviceAddress = localDevice->address().toString();
// QList<QBluetoothAddress> btdevices;
// btdevices = localDevice->connectedDevices();
// int count = btdevices.count();
// if (count > 0) {
// QBluetoothAddress btdevice = btdevices[0];
// QString btmac = btdevice.toString();
// ui_->btDevice->setText("BT: " + QString::number(count));
// } else {
// ui_->btDevice->setText("BT: " + QString::number(count));
// }
//}
} }

View File

@ -1,4 +1,4 @@
/*subfolder /*subfolder
* This file is part of openauto project. * This file is part of openauto project.
* Copyright (C) 2018 f1x.studio (Michal Szwaj) * Copyright (C) 2018 f1x.studio (Michal Szwaj)
* *
@ -28,6 +28,7 @@
#include <QNetworkInterface> #include <QNetworkInterface>
#include <fstream> #include <fstream>
#include <QStorageInfo> #include <QStorageInfo>
#include <QProcess>
namespace f1x namespace f1x
{ {
@ -75,6 +76,7 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot); connect(ui_->radioButtonClient, &QPushButton::clicked, this, &SettingsWindow::onStopHotspot);
connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime); connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::setTime);
connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close); connect(ui_->pushButtonSetTime, &QPushButton::clicked, this, &SettingsWindow::close);
connect(ui_->pushButtonNTP, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft rtc sync &"); });
connect(ui_->pushButtonNTP, &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_->pushButtonCheckNow, &QPushButton::clicked, [&]() { system("/usr/local/bin/crankshaft update check &"); });
connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close); connect(ui_->pushButtonDebuglog, &QPushButton::clicked, this, &SettingsWindow::close);
@ -98,6 +100,7 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
ui_->labelBluetoothAdapterAddress->hide(); ui_->labelBluetoothAdapterAddress->hide();
ui_->lineEditExternalBluetoothAdapterAddress->hide(); ui_->lineEditExternalBluetoothAdapterAddress->hide();
ui_->labelTestInProgress->hide(); ui_->labelTestInProgress->hide();
ui_->pushButtonShowBindings->hide();
connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1); connect(ui_->pushButtonTab1, &QPushButton::clicked, this, &SettingsWindow::show_tab1);
connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2); connect(ui_->pushButtonTab2, &QPushButton::clicked, this, &SettingsWindow::show_tab2);
@ -118,10 +121,31 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
ui_->label_modeswitchprogress->setText("Ok"); ui_->label_modeswitchprogress->setText("Ok");
ui_->label_notavailable->hide(); ui_->label_notavailable->hide();
QString wifi_ssid = configuration_->getCSValue("WIFI_SSID");
QString wifi2_ssid = configuration_->getCSValue("WIFI2_SSID");
ui_->pushButtonNetwork0->setText(wifi_ssid);
ui_->pushButtonNetwork1->setText(wifi2_ssid);
if (!std::ifstream("/boot/crankshaft/network1.conf")) {
ui_->pushButtonNetwork1->hide();
ui_->pushButtonNetwork0->show();
}
if (!std::ifstream("/boot/crankshaft/network0.conf")) {
ui_->pushButtonNetwork1->hide();
ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID"));
}
if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) {
ui_->pushButtonNetwork0->hide();
ui_->pushButtonNetwork1->hide();
ui_->pushButtonNetworkAuto->hide();
ui_->label_notavailable->show();
}
if (std::ifstream("/tmp/hotspot_active")) { if (std::ifstream("/tmp/hotspot_active")) {
ui_->radioButtonClient->setChecked(0); ui_->radioButtonClient->setChecked(0);
ui_->radioButtonHotspot->setChecked(1); ui_->radioButtonHotspot->setChecked(1);
ui_->lineEditWifiSSID->setText(this->hotspotssid); ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid"));
ui_->lineEditPassword->show(); ui_->lineEditPassword->show();
ui_->label_password->show(); ui_->label_password->show();
ui_->lineEditPassword->setText("1234567890"); ui_->lineEditPassword->setText("1234567890");
@ -130,13 +154,17 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
} else { } else {
ui_->radioButtonClient->setChecked(1); ui_->radioButtonClient->setChecked(1);
ui_->radioButtonHotspot->setChecked(0); ui_->radioButtonHotspot->setChecked(0);
ui_->lineEditWifiSSID->setText(this->wifissid); ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid"));
ui_->lineEditPassword->hide(); ui_->lineEditPassword->hide();
ui_->label_password->hide(); ui_->label_password->hide();
ui_->lineEditPassword->setText(""); ui_->lineEditPassword->setText("");
ui_->clientNetworkSelect->hide(); ui_->clientNetworkSelect->hide();
ui_->label_notavailable->show(); ui_->label_notavailable->show();
} }
QTimer *refresh=new QTimer(this);
connect(refresh, SIGNAL(timeout()),this,SLOT(updateInfo()));
refresh->start(5000);
} }
SettingsWindow::~SettingsWindow() SettingsWindow::~SettingsWindow()
@ -144,6 +172,16 @@ SettingsWindow::~SettingsWindow()
delete ui_; delete ui_;
} }
void SettingsWindow::updateInfo()
{
if (ui_->tab6->isVisible() == true) {
updateSystemInfo();
}
if (ui_->tab5->isVisible() == true) {
updateNetworkInfo();
}
}
void SettingsWindow::onSave() void SettingsWindow::onSave()
{ {
configuration_->setHandednessOfTrafficType(ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); configuration_->setHandednessOfTrafficType(ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE);
@ -159,6 +197,7 @@ void SettingsWindow::onSave()
configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked()); configuration_->showNetworkinfo(ui_->checkBoxNetworkinfo->isChecked());
configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked()); configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked());
configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked()); configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked());
configuration_->hideWarning(ui_->checkBoxDontShowAgain->isChecked());
configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60); configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60);
@ -184,6 +223,8 @@ void SettingsWindow::onSave()
configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked()); configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked());
this->saveButtonCheckBoxes(); this->saveButtonCheckBoxes();
configuration_->playerButtonControl(ui_->checkBoxPlayerControl->isChecked());
if(ui_->radioButtonDisableBluetooth->isChecked()) if(ui_->radioButtonDisableBluetooth->isChecked())
{ {
configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::NONE); configuration_->setBluetoothAdapterType(configuration::BluetoothAdapterType::NONE);
@ -362,6 +403,22 @@ void SettingsWindow::onSave()
params.append("0"); params.append("0");
} }
params.append("#"); params.append("#");
if (ui_->checkBoxFlipX ->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append("#");
if (ui_->checkBoxFlipY ->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append("#");
params.append( std::string(ui_->comboBoxRotation->currentText().toStdString()) );
params.append("#");
params.append( std::string(ui_->comboBoxResolution->currentText().toStdString()) );
params.append("#");
system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str()); system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str());
this->close(); this->close();
@ -400,6 +457,7 @@ void SettingsWindow::load()
ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo()); ui_->checkBoxNetworkinfo->setChecked(configuration_->showNetworkinfo());
ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay()); ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay());
ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay()); ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay());
ui_->checkBoxDontShowAgain->setChecked(configuration_->hideWarning());
ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30); ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30);
ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_60); ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_60);
@ -416,6 +474,7 @@ void SettingsWindow::load()
ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled()); ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled());
this->loadButtonCheckBoxes(); this->loadButtonCheckBoxes();
ui_->checkBoxPlayerControl->setChecked(configuration_->playerButtonControl());
ui_->radioButtonDisableBluetooth->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::NONE); ui_->radioButtonDisableBluetooth->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::NONE);
ui_->radioButtonUseLocalBluetoothAdapter->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::LOCAL); ui_->radioButtonUseLocalBluetoothAdapter->setChecked(configuration_->getBluetoothAdapterType() == configuration::BluetoothAdapterType::LOCAL);
@ -431,7 +490,7 @@ void SettingsWindow::load()
ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT); ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT);
ui_->checkBoxHardwareSave->setChecked(false); ui_->checkBoxHardwareSave->setChecked(false);
QStorageInfo storage("/media/CSSTORAGE"); QStorageInfo storage("/media/USBDRIVES/CSSTORAGE");
storage.refresh(); storage.refresh();
if (storage.isValid() && storage.isReady()) { if (storage.isValid() && storage.isReady()) {
if (storage.isReadOnly()) { if (storage.isReadOnly()) {
@ -619,130 +678,104 @@ void SettingsWindow::syncNTPTime()
void SettingsWindow::loadSystemValues() void SettingsWindow::loadSystemValues()
{ {
system("/usr/local/bin/autoapp_helper getoutputs");
system("/usr/local/bin/autoapp_helper getinputs");
system("/usr/local/bin/autoapp_helper getparams");
system("/usr/local/bin/autoapp_helper getbrightnessvalues");
// set brightness slider attribs // set brightness slider attribs
QFile paramFile(QString("/tmp/br_values")); ui_->horizontalSliderDay->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
paramFile.open(QIODevice::ReadOnly); ui_->horizontalSliderDay->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
QTextStream data_param(&paramFile); ui_->horizontalSliderDay->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
QStringList brigthnessvalues = data_param.readAll().split("#"); ui_->horizontalSliderDay->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
paramFile.close(); ui_->horizontalSliderDay->setValue(configuration_->getCSValue("BR_DAY").toInt());
ui_->horizontalSliderDay->setMinimum(brigthnessvalues[0].toInt()); ui_->horizontalSliderNight->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
ui_->horizontalSliderDay->setMaximum(brigthnessvalues[1].toInt()); ui_->horizontalSliderNight->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
ui_->horizontalSliderDay->setSingleStep(brigthnessvalues[2].toInt()); ui_->horizontalSliderNight->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderDay->setTickInterval(brigthnessvalues[2].toInt()); ui_->horizontalSliderNight->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderDay->setValue(brigthnessvalues[3].toInt()); ui_->horizontalSliderNight->setValue(configuration_->getCSValue("BR_NIGHT").toInt());
ui_->horizontalSliderNight->setMinimum(brigthnessvalues[0].toInt()); ui_->horizontalSliderBrightness1->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
ui_->horizontalSliderNight->setMaximum(brigthnessvalues[1].toInt()); ui_->horizontalSliderBrightness1->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
ui_->horizontalSliderNight->setSingleStep(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness1->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderNight->setTickInterval(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness1->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderNight->setValue(brigthnessvalues[4].toInt());
ui_->horizontalSliderBrightness1->setMinimum(brigthnessvalues[0].toInt()); ui_->horizontalSliderBrightness2->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
ui_->horizontalSliderBrightness1->setMaximum(brigthnessvalues[1].toInt()); ui_->horizontalSliderBrightness2->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
ui_->horizontalSliderBrightness1->setSingleStep(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness2->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness1->setTickInterval(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness2->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness2->setMinimum(brigthnessvalues[0].toInt()); ui_->horizontalSliderBrightness3->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
ui_->horizontalSliderBrightness2->setMaximum(brigthnessvalues[1].toInt()); ui_->horizontalSliderBrightness3->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
ui_->horizontalSliderBrightness2->setSingleStep(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness3->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness2->setTickInterval(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness3->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness3->setMinimum(brigthnessvalues[0].toInt()); ui_->horizontalSliderBrightness4->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
ui_->horizontalSliderBrightness3->setMaximum(brigthnessvalues[1].toInt()); ui_->horizontalSliderBrightness4->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
ui_->horizontalSliderBrightness3->setSingleStep(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness4->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness3->setTickInterval(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness4->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness4->setMinimum(brigthnessvalues[0].toInt()); ui_->horizontalSliderBrightness5->setMinimum(configuration_->getCSValue("BR_MIN").toInt());
ui_->horizontalSliderBrightness4->setMaximum(brigthnessvalues[1].toInt()); ui_->horizontalSliderBrightness5->setMaximum(configuration_->getCSValue("BR_MAX").toInt());
ui_->horizontalSliderBrightness4->setSingleStep(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness5->setSingleStep(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness4->setTickInterval(brigthnessvalues[2].toInt()); ui_->horizontalSliderBrightness5->setTickInterval(configuration_->getCSValue("BR_STEP").toInt());
ui_->horizontalSliderBrightness5->setMinimum(brigthnessvalues[0].toInt());
ui_->horizontalSliderBrightness5->setMaximum(brigthnessvalues[1].toInt());
ui_->horizontalSliderBrightness5->setSingleStep(brigthnessvalues[2].toInt());
ui_->horizontalSliderBrightness5->setTickInterval(brigthnessvalues[2].toInt());
// set tsl2561 slider attribs // set tsl2561 slider attribs
QFile param2File(QString("/tmp/tsl2561_values")); ui_->horizontalSliderLux1->setValue(configuration_->getCSValue("LUX_LEVEL_1").toInt());
param2File.open(QIODevice::ReadOnly); ui_->horizontalSliderBrightness1->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_1").toInt());
QTextStream data_param2(&param2File); ui_->horizontalSliderLux2->setValue(configuration_->getCSValue("LUX_LEVEL_2").toInt());
QStringList brigthnessvalues2 = data_param2.readAll().split("#"); ui_->horizontalSliderBrightness2->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_2").toInt());
param2File.close(); ui_->horizontalSliderLux3->setValue(configuration_->getCSValue("LUX_LEVEL_3").toInt());
ui_->horizontalSliderBrightness3->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_3").toInt());
ui_->horizontalSliderLux1->setValue(brigthnessvalues2[0].toInt()); ui_->horizontalSliderLux4->setValue(configuration_->getCSValue("LUX_LEVEL_4").toInt());
ui_->horizontalSliderBrightness1->setValue(brigthnessvalues2[1].toInt()); ui_->horizontalSliderBrightness4->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_4").toInt());
ui_->horizontalSliderLux2->setValue(brigthnessvalues2[2].toInt()); ui_->horizontalSliderLux5->setValue(configuration_->getCSValue("LUX_LEVEL_5").toInt());
ui_->horizontalSliderBrightness2->setValue(brigthnessvalues2[3].toInt()); ui_->horizontalSliderBrightness5->setValue(configuration_->getCSValue("DISP_BRIGHTNESS_5").toInt());
ui_->horizontalSliderLux3->setValue(brigthnessvalues2[4].toInt()); ui_->comboBoxCheckInterval->setCurrentText(configuration_->getCSValue("TSL2561_CHECK_INTERVAL"));
ui_->horizontalSliderBrightness3->setValue(brigthnessvalues2[5].toInt()); ui_->comboBoxNightmodeStep->setCurrentText(configuration_->getCSValue("TSL2561_DAYNIGHT_ON_STEP"));
ui_->horizontalSliderLux4->setValue(brigthnessvalues2[6].toInt());
ui_->horizontalSliderBrightness4->setValue(brigthnessvalues2[7].toInt());
ui_->horizontalSliderLux5->setValue(brigthnessvalues2[8].toInt());
ui_->horizontalSliderBrightness5->setValue(brigthnessvalues2[9].toInt());
ui_->comboBoxCheckInterval->setCurrentText(brigthnessvalues2[10]);
ui_->comboBoxNightmodeStep->setCurrentText(brigthnessvalues2[11]);
if (std::ifstream("/tmp/return_value")) { if (std::ifstream("/tmp/return_value")) {
QFile paramFile(QString("/tmp/return_value")); QString return_values = configuration_->readFileContent("/tmp/return_value");
paramFile.open(QIODevice::ReadOnly); QStringList getparams = return_values.split("#");
QTextStream data_param(&paramFile);
QStringList getparams = data_param.readAll().split("#");
paramFile.close();
// version string // version string
ui_->valueSystemVersion->setText(getparams[0]); ui_->valueSystemVersion->setText(configuration_->readFileContent("/etc/crankshaft.build"));
// date string // date string
ui_->valueSystemBuildDate->setText(getparams[1]); ui_->valueSystemBuildDate->setText(configuration_->readFileContent("/etc/crankshaft.date"));
// set volume // set volume
ui_->labelSystemVolumeValue->setText(getparams[2]); ui_->labelSystemVolumeValue->setText(configuration_->readFileContent("/boot/crankshaft/volume"));
ui_->horizontalSliderSystemVolume->setValue(getparams[2].toInt()); ui_->horizontalSliderSystemVolume->setValue(configuration_->readFileContent("/boot/crankshaft/volume").toInt());
// set cap volume // set cap volume
ui_->labelSystemCaptureValue->setText(getparams[3]); ui_->labelSystemCaptureValue->setText(configuration_->readFileContent("/boot/crankshaft/capvolume"));
ui_->horizontalSliderSystemCapture->setValue(getparams[3].toInt()); ui_->horizontalSliderSystemCapture->setValue(configuration_->readFileContent("/boot/crankshaft/capvolume").toInt());
// set shutdown // set shutdown
ui_->valueShutdownTimer->setText(getparams[4]); ui_->valueShutdownTimer->setText("- - -");
ui_->spinBoxShutdown->setValue(getparams[5].toInt()); ui_->spinBoxShutdown->setValue(configuration_->getCSValue("DISCONNECTION_POWEROFF_MINS").toInt());
// set disconnect // set disconnect
ui_->valueDisconnectTimer->setText(getparams[6]); ui_->valueDisconnectTimer->setText("- - -");
ui_->spinBoxDisconnect->setValue(getparams[7].toInt()); ui_->spinBoxDisconnect->setValue(configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_SECS").toInt());
// set day/night // set day/night
ui_->spinBoxDay->setValue(getparams[8].toInt()); ui_->spinBoxDay->setValue(configuration_->getCSValue("RTC_DAY_START").toInt());
ui_->spinBoxNight->setValue(getparams[9].toInt()); ui_->spinBoxNight->setValue(configuration_->getCSValue("RTC_NIGHT_START").toInt());
// set gpios // set gpios
if (getparams[10] == "1") { if (configuration_->getCSValue("ENABLE_GPIO") == "1") {
ui_->checkBoxGPIO->setChecked(true); ui_->checkBoxGPIO->setChecked(true);
} else { } else {
ui_->checkBoxGPIO->setChecked(false); ui_->checkBoxGPIO->setChecked(false);
} }
ui_->comboBoxDevMode->setCurrentText(getparams[11]); ui_->comboBoxDevMode->setCurrentText(configuration_->getCSValue("DEV_PIN"));
ui_->comboBoxInvert->setCurrentText(getparams[12]); ui_->comboBoxInvert->setCurrentText(configuration_->getCSValue("INVERT_PIN"));
ui_->comboBoxX11->setCurrentText(getparams[13]); ui_->comboBoxX11->setCurrentText(configuration_->getCSValue("X11_PIN"));
ui_->comboBoxRearcam->setCurrentText(getparams[14]); ui_->comboBoxRearcam->setCurrentText(configuration_->getCSValue("REARCAM_PIN"));
ui_->comboBoxAndroid->setCurrentText(getparams[15]); ui_->comboBoxAndroid->setCurrentText(configuration_->getCSValue("ANDROID_PIN"));
// set mode // set mode
if (getparams[16] == "0") { if (configuration_->getCSValue("START_X11") == "0") {
ui_->radioButtonEGL->setChecked(true); ui_->radioButtonEGL->setChecked(true);
} else { } else {
ui_->radioButtonX11->setChecked(true); ui_->radioButtonX11->setChecked(true);
} }
// set rotation // set rotation
if (getparams[17] == "0") { if (configuration_->getCSValue("FLIP_SCREEN") == "0") {
ui_->radioButtonScreenNormal->setChecked(true); ui_->radioButtonScreenNormal->setChecked(true);
} else { } else {
ui_->radioButtonScreenRotated->setChecked(true); ui_->radioButtonScreenRotated->setChecked(true);
} }
// set free mem
ui_->valueSystemFreeMem->setText(getparams[18]);
// set cpu freq
ui_->valueSystemCPUFreq->setText(getparams[19] + "MHz");
// set cpu temp
ui_->valueSystemCPUTemp->setText(getparams[20]);
if (std::ifstream("/tmp/get_inputs")) { if (std::ifstream("/tmp/get_inputs")) {
QFile inputsFile(QString("/tmp/get_inputs")); QFile inputsFile(QString("/tmp/get_inputs"));
@ -782,23 +815,8 @@ void SettingsWindow::loadSystemValues()
} }
} }
if (std::ifstream("/tmp/get_default_output")) { ui_->comboBoxPulseOutput->setCurrentText(configuration_->readFileContent("/tmp/get_default_output"));
QFile defaultoutputFile(QString("/tmp/get_default_output")); ui_->comboBoxPulseInput->setCurrentText(configuration_->readFileContent("/tmp/get_default_input"));
defaultoutputFile.open(QIODevice::ReadOnly);
QTextStream data_return(&defaultoutputFile);
QStringList defoutput = data_return.readAll().split("\n");
defaultoutputFile.close();
ui_->comboBoxPulseOutput->setCurrentText(defoutput[0]);
}
if (std::ifstream("/tmp/get_default_input")) {
QFile defaultinputFile(QString("/tmp/get_default_input"));
defaultinputFile.open(QIODevice::ReadOnly);
QTextStream data_return(&defaultinputFile);
QStringList definput = data_return.readAll().split("\n");
defaultinputFile.close();
ui_->comboBoxPulseInput->setCurrentText(definput[0]);
}
if (std::ifstream("/tmp/timezone_listing")) { if (std::ifstream("/tmp/timezone_listing")) {
QFile zoneFile(QString("/tmp/timezone_listing")); QFile zoneFile(QString("/tmp/timezone_listing"));
@ -820,129 +838,157 @@ void SettingsWindow::loadSystemValues()
} }
// set rtc // set rtc
ui_->comboBoxHardwareRTC->setCurrentText(getparams[21]); QString rtcstring = configuration_->getParamFromFile("/boot/config.txt","dtoverlay=i2c-rtc");
// set timezone if (rtcstring != "") {
ui_->comboBoxTZ->setCurrentText(getparams[22]); QStringList rtc = rtcstring.split(",");
ui_->comboBoxHardwareRTC->setCurrentText(rtc[1].trimmed());
// set timezone
ui_->comboBoxTZ->setCurrentText(configuration_->readFileContent("/etc/timezone"));
} else {
ui_->comboBoxHardwareRTC->setCurrentText("none");
}
// set dac // set dac
QString dac = "Custom"; QString dac = "Custom";
if (getparams[23] == "allo-boss-dac-pcm512x-audio") { if (getparams[4] == "allo-boss-dac-pcm512x-audio") {
dac = "Allo - Boss"; dac = "Allo - Boss";
} }
if (getparams[23] == "allo-piano-dac-pcm512x-audio") { if (getparams[4] == "allo-piano-dac-pcm512x-audio") {
dac = "Allo - Piano"; dac = "Allo - Piano";
} }
if (getparams[23] == "iqaudio-dacplus") { if (getparams[4] == "iqaudio-dacplus") {
dac = "IQaudIO - Pi-DAC Plus/Pro/Zero"; dac = "IQaudIO - Pi-DAC Plus/Pro/Zero";
} }
if (getparams[23] == "iqaudio-dacplus,unmute_amp") { if (getparams[4] == "iqaudio-dacplus,unmute_amp") {
dac = "IQaudIO - Pi-Digi Amp Plus"; dac = "IQaudIO - Pi-Digi Amp Plus";
} }
if (getparams[23] == "iqaudio-dacplus,auto_mute_amp") { if (getparams[4] == "iqaudio-dacplus,auto_mute_amp") {
dac = "IQaudIO - Pi-Digi Amp Plus - Automute"; dac = "IQaudIO - Pi-Digi Amp Plus - Automute";
} }
if (getparams[23] == "iqaudio-digi-wm8804-audio") { if (getparams[4] == "iqaudio-digi-wm8804-audio") {
dac = "IQaudIO - Pi-Digi Plus"; dac = "IQaudIO - Pi-Digi Plus";
} }
if (getparams[23] == "audioinjector-wm8731-audio") { if (getparams[4] == "audioinjector-wm8731-audio") {
dac = "Audioinjector - Zero/Stereo"; dac = "Audioinjector - Zero/Stereo";
} }
if (getparams[23] == "hifiberry-dac") { if (getparams[4] == "hifiberry-dac") {
dac = "Hifiberry - DAC"; dac = "Hifiberry - DAC";
} }
if (getparams[23] == "hifiberry-dacplus") { if (getparams[4] == "hifiberry-dacplus") {
dac = "Hifiberry - DAC Plus"; dac = "Hifiberry - DAC Plus";
} }
if (getparams[23] == "hifiberry-digi") { if (getparams[4] == "hifiberry-digi") {
dac = "Hifiberry - Digi"; dac = "Hifiberry - Digi";
} }
if (getparams[23] == "hifiberry-digi-pro") { if (getparams[4] == "hifiberry-digi-pro") {
dac = "Hifiberry - Digi Pro"; dac = "Hifiberry - Digi Pro";
} }
if (getparams[23] == "hifiberry-amp") { if (getparams[4] == "hifiberry-amp") {
dac = "Hifiberry - DAC Amp"; dac = "Hifiberry - DAC Amp";
} }
if (getparams[23] == "audio") { if (getparams[4] == "audio") {
dac = "Raspberry Pi - Onboard"; dac = "Raspberry Pi - Onboard";
} }
ui_->comboBoxHardwareDAC->setCurrentText(dac); ui_->comboBoxHardwareDAC->setCurrentText(dac);
// set shutdown disable // set shutdown disable
if (getparams[24] == "1") { if (configuration_->getCSValue("DISCONNECTION_POWEROFF_DISABLE") == "1") {
ui_->checkBoxDisableShutdown->setChecked(true); ui_->checkBoxDisableShutdown->setChecked(true);
} else { } else {
ui_->checkBoxDisableShutdown->setChecked(false); ui_->checkBoxDisableShutdown->setChecked(false);
} }
// set screen off disable // set screen off disable
if (getparams[25] == "1") { if (configuration_->getCSValue("DISCONNECTION_SCREEN_POWEROFF_DISABLE") == "1") {
ui_->checkBoxDisableScreenOff->setChecked(true); ui_->checkBoxDisableScreenOff->setChecked(true);
} else { } else {
ui_->checkBoxDisableScreenOff->setChecked(false); ui_->checkBoxDisableScreenOff->setChecked(false);
} }
// set custom brightness command // set custom brightness command
if (getparams[26] != "0") { if (configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") != "") {
ui_->labelCustomBrightnessCommand->setText(getparams[26] + " brvalue"); ui_->labelCustomBrightnessCommand->setText(configuration_->getCSValue("CUSTOM_BRIGHTNESS_COMMAND") + " brvalue");
} else { } else {
ui_->labelCustomBrightnessCommand->setText("Disabled"); ui_->labelCustomBrightnessCommand->setText("Disabled");
} }
// set debug mode // set debug mode
if (getparams[27] == "1") { if (configuration_->getCSValue("DEBUG_MODE") == "1") {
ui_->radioButtonDebugmodeEnabled->setChecked(true); ui_->radioButtonDebugmodeEnabled->setChecked(true);
} else { } else {
ui_->radioButtonDebugmodeDisabled->setChecked(true); ui_->radioButtonDebugmodeDisabled->setChecked(true);
} }
// GPIO based shutdown // GPIO based shutdown
ui_->comboBoxGPIOShutdown->setCurrentText(getparams[28]); ui_->comboBoxGPIOShutdown->setCurrentText(configuration_->getCSValue("IGNITION_PIN"));
ui_->spinBoxGPIOShutdownDelay->setValue(getparams[29].toInt()); ui_->spinBoxGPIOShutdownDelay->setValue(configuration_->getCSValue("IGNITION_DELAY").toInt());
// Wifi Credentials // Wifi Hotspot
this->wifissid = getparams[30]; if (configuration_->getCSValue("ENABLE_HOTSPOT") == "1") {
// Wifi Hotspot Credentials
if (getparams[31] == "1") {
ui_->checkBoxHotspot->setChecked(true); ui_->checkBoxHotspot->setChecked(true);
} else { } else {
ui_->checkBoxHotspot->setChecked(false); ui_->checkBoxHotspot->setChecked(false);
} }
this->hotspotssid = getparams[32];
// set cam // set cam
ui_->comboBoxCam->setCurrentText(getparams[33]); if (configuration_->getParamFromFile("/boot/config.txt","start_x") == "1") {
ui_->comboBoxCam->setCurrentText("enabled");
} else {
ui_->comboBoxCam->setCurrentText("disabled");
}
if (configuration_->getCSValue("RPICAM_HFLIP") == "1") {
ui_->checkBoxFlipX->setChecked(true);
} else {
ui_->checkBoxFlipX->setChecked(false);
}
if (configuration_->getCSValue("RPICAM_VFLIP") == "1") {
ui_->checkBoxFlipY->setChecked(true);
} else {
ui_->checkBoxFlipY->setChecked(false);
}
ui_->comboBoxRotation->setCurrentText(configuration_->getCSValue("RPICAM_ROTATION"));
ui_->comboBoxResolution->setCurrentText(configuration_->getCSValue("RPICAM_RESOLUTION"));
// set bluetooth // set bluetooth
if (getparams[34] == "1") { if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") {
// check external bluetooth enabled // check external bluetooth enabled
if (getparams[36] == "1") { if (configuration_->getCSValue("EXTERNAL_BLUETOOTH") == "1") {
ui_->radioButtonUseExternalBluetoothAdapter->setChecked(true); ui_->radioButtonUseExternalBluetoothAdapter->setChecked(true);
} else { } else {
ui_->radioButtonUseLocalBluetoothAdapter->setChecked(true); ui_->radioButtonUseLocalBluetoothAdapter->setChecked(true);
} }
// mac // mac
ui_->lineEditExternalBluetoothAdapterAddress->setText(getparams[37]); //ui_->lineEditExternalBluetoothAdapterAddress->setText(getparams[37]);
} else { } else {
ui_->radioButtonDisableBluetooth->setChecked(true); ui_->radioButtonDisableBluetooth->setChecked(true);
ui_->lineEditExternalBluetoothAdapterAddress->setText(""); ui_->lineEditExternalBluetoothAdapterAddress->setText("");
} }
if (getparams[35] == "1") { if (configuration_->getCSValue("ENABLE_PAIRABLE") == "1") {
ui_->checkBoxBluetoothAutoPair->setChecked(true); ui_->checkBoxBluetoothAutoPair->setChecked(true);
} else { } else {
ui_->checkBoxBluetoothAutoPair->setChecked(false); ui_->checkBoxBluetoothAutoPair->setChecked(false);
} }
// set bluetooth type // set bluetooth type
ui_->comboBoxBluetooth->setCurrentText(getparams[38]); if (configuration_->getCSValue("ENABLE_BLUETOOTH") == "1") {
QString bt = configuration_->getParamFromFile("/boot/config.txt","dtoverlay=pi3-disable-bt");
if (bt.contains("pi3-disable-bt")) {
ui_->comboBoxBluetooth->setCurrentText("external");
} else {
ui_->comboBoxBluetooth->setCurrentText("builtin");
}
} else {
ui_->comboBoxBluetooth->setCurrentText("none");
}
// set sdoc // set sdoc
if (getparams[39] == "enabled") { QString sdoc = configuration_->getParamFromFile("/boot/config.txt","dtoverlay=sdtweak");
if (sdoc.contains("sdtweak")) {
ui_->comboBoxSDOC->setCurrentIndex(1); ui_->comboBoxSDOC->setCurrentIndex(1);
} else { } else {
ui_->comboBoxSDOC->setCurrentIndex(0); ui_->comboBoxSDOC->setCurrentIndex(0);
} }
// set lightsensor // set lightsensor
if (getparams[40] == "enabled") { if (std::ifstream("/etc/cs_lightsensor")) {
ui_->comboBoxLS->setCurrentIndex(1); ui_->comboBoxLS->setCurrentIndex(1);
ui_->groupBoxSliderDay->hide(); ui_->groupBoxSliderDay->hide();
ui_->groupBoxSliderNight->hide(); ui_->groupBoxSliderNight->hide();
@ -952,24 +998,26 @@ void SettingsWindow::loadSystemValues()
ui_->groupBoxSliderDay->show(); ui_->groupBoxSliderDay->show();
ui_->groupBoxSliderNight->show(); ui_->groupBoxSliderNight->show();
} }
ui_->comboBoxDayNight->setCurrentText(getparams[41]); ui_->comboBoxDayNight->setCurrentText(configuration_->getCSValue("DAYNIGHT_PIN"));
if (getparams[42] == "1") { if (configuration_->getCSValue("RTC_DAYNIGHT") == "1") {
ui_->checkBoxDisableDayNightRTC->setChecked(false); ui_->checkBoxDisableDayNightRTC->setChecked(false);
} else { } else {
ui_->checkBoxDisableDayNightRTC->setChecked(true); ui_->checkBoxDisableDayNightRTC->setChecked(true);
} }
if (getparams[43] == "csnganimation") { QString theme = configuration_->getParamFromFile("/etc/plymouth/plymouthd.conf","Theme");
if (theme == "csnganimation") {
ui_->radioButtonAnimatedCSNG->setChecked(true); ui_->radioButtonAnimatedCSNG->setChecked(true);
} }
else if (getparams[43] == "crankshaft") { else if (theme == "crankshaft") {
ui_->radioButtonCSNG->setChecked(true); ui_->radioButtonCSNG->setChecked(true);
} }
else if (getparams[43] == "custom") { else if (theme == "custom") {
ui_->radioButtonCustom->setChecked(true); ui_->radioButtonCustom->setChecked(true);
} }
ui_->comboBoxCountryCode->setCurrentIndex(ui_->comboBoxCountryCode->findText(getparams[44], Qt::MatchFlag::MatchStartsWith)); // wifi country code
ui_->comboBoxCountryCode->setCurrentIndex(ui_->comboBoxCountryCode->findText(configuration_->getCSValue("WIFI_COUNTRY"), Qt::MatchFlag::MatchStartsWith));
// set screen blank instead off // set screen blank instead off
if (getparams[45] == "1") { if (configuration_->getCSValue("SCREEN_POWEROFF_OVERRIDE") == "1") {
ui_->checkBoxBlankOnly->setChecked(true); ui_->checkBoxBlankOnly->setChecked(true);
} else { } else {
ui_->checkBoxBlankOnly->setChecked(false); ui_->checkBoxBlankOnly->setChecked(false);
@ -1013,11 +1061,11 @@ void SettingsWindow::onStartHotspot()
ui_->radioButtonHotspot->setEnabled(0); ui_->radioButtonHotspot->setEnabled(0);
ui_->lineEdit_wlan0->setText(""); ui_->lineEdit_wlan0->setText("");
ui_->lineEditWifiSSID->setText(""); ui_->lineEditWifiSSID->setText("");
ui_->pushButtonNetworkAuto->hide();
qApp->processEvents(); qApp->processEvents();
std::remove("/tmp/manual_hotspot_control"); std::remove("/tmp/manual_hotspot_control");
std::ofstream("/tmp/manual_hotspot_control"); std::ofstream("/tmp/manual_hotspot_control");
system("/opt/crankshaft/service_hotspot.sh start &"); system("/opt/crankshaft/service_hotspot.sh start &");
QTimer::singleShot(15000, this, SLOT(updateNetworkInfo()));
} }
void SettingsWindow::onStopHotspot() void SettingsWindow::onStopHotspot()
@ -1030,9 +1078,57 @@ void SettingsWindow::onStopHotspot()
ui_->lineEdit_wlan0->setText(""); ui_->lineEdit_wlan0->setText("");
ui_->lineEditWifiSSID->setText(""); ui_->lineEditWifiSSID->setText("");
ui_->lineEditPassword->setText(""); ui_->lineEditPassword->setText("");
ui_->pushButtonNetworkAuto->hide();
qApp->processEvents(); qApp->processEvents();
system("/opt/crankshaft/service_hotspot.sh stop &"); system("/opt/crankshaft/service_hotspot.sh stop &");
QTimer::singleShot(15000, this, SLOT(updateNetworkInfo())); }
void SettingsWindow::updateSystemInfo()
{
// free ram
struct sysinfo info;
sysinfo(&info);
ui_->valueSystemFreeMem->setText(QString::number(info.freeram/1024/1024) + " MB");
// current cpu speed
QString freq = configuration_->readFileContent("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq");
int currentfreq = freq.toInt()/1000;
ui_->valueSystemCPUFreq->setText(QString::number(currentfreq) + "MHz");
// current cpu temp
QString temp = configuration_->readFileContent("/sys/class/thermal/thermal_zone0/temp");
int currenttemp = temp.toInt()/1000;
ui_->valueSystemCPUTemp->setText(QString::number(currenttemp) + "°C");
// get remaining times
QProcess process;
process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $1'}");
process.waitForFinished(-1);
QString stdout = process.readAllStandardOutput();
if (stdout.simplified() != "n/a") {
process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep disconnect | awk {'print $5\" \"$6'}");
process.waitForFinished(-1);
QString stdout = process.readAllStandardOutput();
if (stdout.simplified() != "") {
ui_->valueDisconnectTimer->setText(stdout.simplified());
} else {
ui_->valueDisconnectTimer->setText("Stopped");
}
} else {
ui_->valueDisconnectTimer->setText("Stopped");
}
process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $1'}");
process.waitForFinished(-1);
stdout = process.readAllStandardOutput();
if (stdout.simplified() != "n/a") {
process.start("/bin/bash", QStringList() << "-c" << "systemctl list-timers -all | grep shutdown | awk {'print $5\" \"$6'}");
process.waitForFinished(-1);
QString stdout = process.readAllStandardOutput();
if (stdout.simplified() != "") {
ui_->valueShutdownTimer->setText(stdout.simplified());
} else {
ui_->valueShutdownTimer->setText("Stopped");
}
} else {
ui_->valueShutdownTimer->setText("Stopped");
}
} }
void SettingsWindow::show_tab1() void SettingsWindow::show_tab1()
@ -1169,64 +1265,75 @@ void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonAudioTest_clicked(
void f1x::openauto::autoapp::ui::SettingsWindow::updateNetworkInfo() void f1x::openauto::autoapp::ui::SettingsWindow::updateNetworkInfo()
{ {
QNetworkInterface eth0if = QNetworkInterface::interfaceFromName("eth0"); if (!std::ifstream("/tmp/mode_change_progress")) {
if (eth0if.flags().testFlag(QNetworkInterface::IsUp)) { QNetworkInterface eth0if = QNetworkInterface::interfaceFromName("eth0");
QList<QNetworkAddressEntry> entrieseth0 = eth0if.addressEntries(); if (eth0if.flags().testFlag(QNetworkInterface::IsUp)) {
if (!entrieseth0.isEmpty()) { QList<QNetworkAddressEntry> entrieseth0 = eth0if.addressEntries();
QNetworkAddressEntry eth0 = entrieseth0.first(); if (!entrieseth0.isEmpty()) {
//qDebug() << "eth0: " << eth0.ip(); QNetworkAddressEntry eth0 = entrieseth0.first();
ui_->lineEdit_eth0->setText(eth0.ip().toString()); //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<QNetworkAddressEntry> entrieswlan0 = wlan0if.addressEntries();
if (!entrieswlan0.isEmpty()) {
QNetworkAddressEntry wlan0 = entrieswlan0.first();
//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 { } else {
ui_->lineEditWifiSSID->setText(""); //qDebug() << "eth0: down";
ui_->lineEdit_eth0->setText("interface down");
} }
} else {
//qDebug() << "wlan0: down";
ui_->lineEdit_wlan0->setText("interface down");
}
if (std::ifstream("/tmp/hotspot_active")) { QNetworkInterface wlan0if = QNetworkInterface::interfaceFromName("wlan0");
ui_->radioButtonClient->setEnabled(1); if (wlan0if.flags().testFlag(QNetworkInterface::IsUp)) {
ui_->radioButtonHotspot->setEnabled(1); QList<QNetworkAddressEntry> entrieswlan0 = wlan0if.addressEntries();
ui_->radioButtonHotspot->setChecked(1); if (!entrieswlan0.isEmpty()) {
ui_->radioButtonClient->setChecked(0); QNetworkAddressEntry wlan0 = entrieswlan0.first();
ui_->label_modeswitchprogress->setText("Ok"); //qDebug() << "wlan0: " << wlan0.ip();
ui_->lineEditWifiSSID->setText(this->hotspotssid); ui_->lineEdit_wlan0->setText(wlan0.ip().toString());
ui_->lineEditPassword->show(); }
ui_->label_password->show(); } else {
ui_->lineEditPassword->setText("1234567890"); //qDebug() << "wlan0: down";
} else { ui_->lineEdit_wlan0->setText("interface down");
ui_->radioButtonClient->setEnabled(1); }
ui_->radioButtonHotspot->setEnabled(1);
ui_->radioButtonHotspot->setChecked(0); if (std::ifstream("/tmp/hotspot_active")) {
ui_->radioButtonClient->setChecked(1); ui_->radioButtonClient->setEnabled(1);
ui_->label_modeswitchprogress->setText("Ok"); ui_->radioButtonHotspot->setEnabled(1);
ui_->lineEditWifiSSID->setText(this->wifissid); ui_->radioButtonHotspot->setChecked(1);
ui_->lineEditPassword->hide(); ui_->radioButtonClient->setChecked(0);
ui_->label_password->hide(); ui_->label_modeswitchprogress->setText("Ok");
ui_->lineEditPassword->setText(""); ui_->lineEditWifiSSID->setText(configuration_->getParamFromFile("/etc/hostapd/hostapd.conf","ssid"));
ui_->clientNetworkSelect->show(); ui_->lineEditPassword->show();
ui_->label_notavailable->hide(); ui_->label_password->show();
ui_->lineEditPassword->setText("1234567890");
ui_->clientNetworkSelect->hide();
ui_->pushButtonNetworkAuto->hide();
ui_->label_notavailable->show();
} else {
ui_->radioButtonClient->setEnabled(1);
ui_->radioButtonHotspot->setEnabled(1);
ui_->radioButtonHotspot->setChecked(0);
ui_->radioButtonClient->setChecked(1);
ui_->label_modeswitchprogress->setText("Ok");
ui_->lineEditWifiSSID->setText(configuration_->readFileContent("/tmp/wifi_ssid"));
ui_->lineEditPassword->hide();
ui_->label_password->hide();
ui_->lineEditPassword->setText("");
ui_->clientNetworkSelect->show();
ui_->label_notavailable->hide();
ui_->pushButtonNetworkAuto->show();
if (!std::ifstream("/boot/crankshaft/network1.conf")) {
ui_->pushButtonNetwork1->hide();
ui_->pushButtonNetwork0->show();
}
if (!std::ifstream("/boot/crankshaft/network0.conf")) {
ui_->pushButtonNetwork1->hide();
ui_->pushButtonNetwork0->setText(configuration_->getCSValue("WIFI2_SSID"));
}
if (!std::ifstream("/boot/crankshaft/network0.conf") && !std::ifstream("/boot/crankshaft/network1.conf")) {
ui_->pushButtonNetwork0->hide();
ui_->pushButtonNetwork1->hide();
ui_->pushButtonNetworkAuto->hide();
ui_->label_notavailable->show();
}
}
} }
} }
@ -1236,7 +1343,7 @@ void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork0_clicked()
ui_->lineEditWifiSSID->setText(""); ui_->lineEditWifiSSID->setText("");
ui_->lineEditPassword->setText(""); ui_->lineEditPassword->setText("");
qApp->processEvents(); qApp->processEvents();
system("/usr/local/bin/crankshaft network 0 &"); system("/usr/local/bin/crankshaft network 0 >/dev/null 2>&1 &");
} }
@ -1246,6 +1353,5 @@ void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonNetwork1_clicked()
ui_->lineEditWifiSSID->setText(""); ui_->lineEditWifiSSID->setText("");
ui_->lineEditPassword->setText(""); ui_->lineEditPassword->setText("");
qApp->processEvents(); qApp->processEvents();
system("/usr/local/bin/crankshaft network 1 &"); system("/usr/local/bin/crankshaft network 1 >/dev/null 2>&1 &");
QTimer::singleShot(15000, this, SLOT(updateNetworkInfo()));
} }

View File

@ -39,7 +39,7 @@ UpdateDialog::UpdateDialog(QWidget *parent)
connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &UpdateDialog::updateCheck); connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &UpdateDialog::updateCheck);
watcher_download = new QFileSystemWatcher(this); watcher_download = new QFileSystemWatcher(this);
watcher_download->addPath("/media/CSSTORAGE"); watcher_download->addPath("/media/USBDRIVES/CSSTORAGE");
connect(watcher_download, &QFileSystemWatcher::directoryChanged, this, &UpdateDialog::downloadCheck); connect(watcher_download, &QFileSystemWatcher::directoryChanged, this, &UpdateDialog::downloadCheck);
} }
@ -94,7 +94,7 @@ void f1x::openauto::autoapp::ui::UpdateDialog::on_pushButtonUpdateCheck_clicked(
void f1x::openauto::autoapp::ui::UpdateDialog::downloadCheck() void f1x::openauto::autoapp::ui::UpdateDialog::downloadCheck()
{ {
QDir directory("/media/CSSTORAGE"); QDir directory("/media/USBDRIVES/CSSTORAGE");
QStringList files = directory.entryList(QStringList() << "*.zip", QDir::AllEntries, QDir::Name); QStringList files = directory.entryList(QStringList() << "*.zip", QDir::AllEntries, QDir::Name);
foreach(QString filename, files) { foreach(QString filename, files) {
if (filename != "") { if (filename != "") {
@ -136,6 +136,9 @@ void f1x::openauto::autoapp::ui::UpdateDialog::updateCheck()
ui_->progressBarOpenauto->hide(); ui_->progressBarOpenauto->hide();
ui_->labelOpenautoOK->show(); ui_->labelOpenautoOK->show();
} }
} else {
ui_->labelOpenautoOK->hide();
ui_->pushButtonUpdateOpenauto->hide();
} }
if (std::ifstream("/tmp/system_update_ready")) { if (std::ifstream("/tmp/system_update_ready")) {
@ -153,15 +156,21 @@ void f1x::openauto::autoapp::ui::UpdateDialog::updateCheck()
if (std::ifstream("/tmp/system_update_downloading")) { if (std::ifstream("/tmp/system_update_downloading")) {
ui_->labelSystemOK->hide(); ui_->labelSystemOK->hide();
ui_->pushButtonUpdateSystem->hide(); ui_->pushButtonUpdateSystem->hide();
ui_->pushButtonUpdateCheck->hide();
ui_->progressBarSystem->show(); ui_->progressBarSystem->show();
QFileInfo downloadfile = "/media/CSSTORAGE/" + ui_->labelDownload->text(); QFileInfo downloadfile = "/media/USBDRIVES/CSSTORAGE/" + ui_->labelDownload->text();
if (downloadfile.exists()) { if (downloadfile.exists()) {
qint64 size = downloadfile.size(); qint64 size = downloadfile.size();
size = size/1024/1024; size = size/1024/1024;
ui_->progressBarSystem->setValue(size); ui_->progressBarSystem->setValue(size);
} }
} else {
if (ui_->pushButtonUpdateCheck->isVisible() == false) {
ui_->pushButtonUpdateCheck->show();
}
} }
if (!std::ifstream("/tmp/system_update_available") && !std::ifstream("/tmp/system_update_downloading")) { if (!std::ifstream("/tmp/system_update_available") && !std::ifstream("/tmp/system_update_downloading")) {
ui_->progressBarSystem->hide(); ui_->progressBarSystem->hide();
ui_->labelSystemOK->show(); ui_->labelSystemOK->show();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>929</width> <width>1010</width>
<height>1511</height> <height>1657</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -139,6 +139,40 @@
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QLabel" name="labelLock">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(78, 154, 6);
color: rgb(239, 239, 239);
outline: none;
border-radius: 4px;</string>
</property>
<property name="text">
<string>Lock</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="devlabel_right"> <widget class="QLabel" name="devlabel_right">
<property name="minimumSize"> <property name="minimumSize">
@ -221,7 +255,7 @@ border-radius: 4px;
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>10</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@ -241,11 +275,23 @@ color: rgb(211, 215, 207);</string>
<item> <item>
<widget class="QLabel" name="Header_Label"> <widget class="QLabel" name="Header_Label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="font"> <property name="font">
<font> <font>
<family>DejaVu Sans</family> <family>DejaVu Sans</family>
@ -326,6 +372,34 @@ color: rgb(211, 215, 207);</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="labelLockDummy">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="devlabel_left"> <widget class="QLabel" name="devlabel_left">
<property name="sizePolicy"> <property name="sizePolicy">
@ -607,7 +681,7 @@ color: rgb(0, 102, 255);</string>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_13"> <spacer name="horizontalSpacer_16">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -644,8 +718,8 @@ color: rgb(0, 102, 255);</string>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>50</weight>
<bold>true</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -679,10 +753,44 @@ border-radius: 4px;
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QLabel" name="labelBluetoothPairable">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(32, 74, 135);
color: rgb(255, 255, 255);
outline: none;
border-radius: 4px;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#29ffff;&quot;&gt;Pairable&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="pushButtonBluetooth"> <widget class="QPushButton" name="pushButtonBluetooth">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -1340,41 +1448,124 @@ border: no-border;</string>
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QPushButton" name="pushButtonAndroidAuto"> <widget class="QWidget" name="ButtonAndroidAuto" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <layout class="QVBoxLayout" name="verticalLayout_16">
<font> <property name="spacing">
<weight>75</weight> <number>0</number>
<bold>true</bold> </property>
</font> <property name="leftMargin">
</property> <number>0</number>
<property name="styleSheet"> </property>
<string notr="true">background-color: rgba(48, 140, 198, 0.5); <property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelAndroidAutoTop">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(48, 140, 198, 0.5);
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
border-radius: 4px; border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5); border: 2px solid rgba(255,255,255,0.5);
outline: none; outline: none;
border-bottom: 0px;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonAndroidAuto">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(48, 140, 198, 0.5);
color: rgb(255, 255, 255);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
outline: none;
border-top: 0px;
border-bottom: 0px;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normalon>:/aausb-hot.png</normalon> <normalon>:/aausb-hot.png</normalon>
</iconset> </iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>50</width> <width>50</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="autoRepeat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelAndroidAutoBottom">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(48, 140, 198, 0.5);
color: rgb(255, 255, 255);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
outline: none;
border-top: 0px;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -3208,7 +3399,7 @@ outline: none;</string>
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QPushButton" name="pushButtonCameraHide"> <widget class="QWidget" name="horizontalWidget" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -3218,11 +3409,260 @@ outline: none;</string>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 1); <string notr="true">background-color: rgba(0, 0, 0, 1);
border-radius: 4px; border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);</string> border: 2px solid rgba(255,255,255,0.5);
</property> outline: none;</string>
<property name="text">
<string/>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="verticalWidget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 0);
border: 0px;</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButtonUp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>66</width>
<height>66</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>66</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(136, 138, 133, 0.5);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
border-left: 0px;
border-top: 0px;
color: rgb(255, 255, 255);
outline: none;</string>
</property>
<property name="text">
<string>Up</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDown">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>66</width>
<height>66</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>66</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(136, 138, 133, 0.5);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
border-left: 0px;
border-bottom: 0px;
color: rgb(255, 255, 255);
outline: none;</string>
</property>
<property name="text">
<string>Down</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCameraHide">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 0);
border: 0px;
outline: none;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="verticalWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(0, 0, 0, 0);
border: 0px;
</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButtonPlus">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>66</width>
<height>66</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>66</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(136, 138, 133, 0.5);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
border-right: 0px;
border-top: 0px;
color: rgb(255, 255, 255);
outline: none;</string>
</property>
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonMinus">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>66</width>
<height>66</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>66</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(136, 138, 133, 0.5);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
border-right: 0px;
border-bottom: 0px;
color: rgb(255, 255, 255);
outline: none;</string>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -4780,45 +5220,6 @@ outline: none;
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="pushButtonUSB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(186, 189, 182, 0.7);
border-radius: 4px;
border: 2px solid rgba(255,255,255,0.5);
color: rgb(255, 255, 255);
outline: none;</string>
</property>
<property name="text">
<string>USB</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="pushButtonPlayerBack"> <widget class="QPushButton" name="pushButtonPlayerBack">
<property name="sizePolicy"> <property name="sizePolicy">

File diff suppressed because it is too large Load Diff

View File

@ -106,32 +106,36 @@ border-color: rgb(186, 189, 182);
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButtonClose"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="minimumSize"> <item>
<size> <widget class="QPushButton" name="pushButtonClose">
<width>0</width> <property name="minimumSize">
<height>40</height> <size>
</size> <width>0</width>
</property> <height>40</height>
<property name="maximumSize"> </size>
<size> </property>
<width>16777215</width> <property name="maximumSize">
<height>40</height> <size>
</size> <width>16777215</width>
</property> <height>40</height>
<property name="font"> </size>
<font> </property>
<weight>75</weight> <property name="font">
<bold>true</bold> <font>
</font> <weight>75</weight>
</property> <bold>true</bold>
<property name="styleSheet"> </font>
<string notr="true">background-color: rgb(186, 189, 182);</string> </property>
</property> <property name="styleSheet">
<property name="text"> <string notr="true">background-color: rgb(186, 189, 182);</string>
<string>OK</string> </property>
</property> <property name="text">
</widget> <string>OK</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -122,8 +122,9 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::exit, []() { system("touch /tmp/shutdown"); std::exit(0); }); 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::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::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::showFullScreen);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::show_tab1);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectdialog, &autoapp::ui::ConnectDialog::loadClientList); 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::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::updateCheck);
@ -136,85 +137,69 @@ int main(int argc, char* argv[])
} }
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py Background &"); system("/opt/crankshaft/cameracontrol.py Background &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Background.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py Foreground &"); system("/opt/crankshaft/cameracontrol.py Foreground &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Foreground.";
#else });
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYUp, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py PosYUp &");
OPENAUTO_LOG(info) << "[Camera] PosY up.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraPosYDown, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py PosYDown &");
OPENAUTO_LOG(info) << "[Camera] PosY down.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomPlus, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py ZoomPlus &");
OPENAUTO_LOG(info) << "[Camera] Zoom plus.";
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraZoomMinus, [&qApplication]() {
system("/opt/crankshaft/cameracontrol.py ZoomMinus &");
OPENAUTO_LOG(info) << "[Camera] Zoom minus.";
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::hideRearCam, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::hideRearCam, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py DashcamMode &"); system("/opt/crankshaft/cameracontrol.py DashcamMode &");
system("sudo rm /tmp/rearcam_enabled &"); system("sudo rm /tmp/rearcam_enabled &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Dashcam mode.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::showRearCam, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::showRearCam, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py Rearcam &"); system("/opt/crankshaft/cameracontrol.py Rearcam &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Rearcam mode.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py Record &"); system("/opt/crankshaft/cameracontrol.py Record &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Record.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py Stop &"); system("/opt/crankshaft/cameracontrol.py Stop &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Stop.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/cameracontrol.py Save &"); system("/opt/crankshaft/cameracontrol.py Save &");
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script."; OPENAUTO_LOG(info) << "[Camera] Save.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/service_daynight.sh app night"); system("/opt/crankshaft/service_daynight.sh app night");
OPENAUTO_LOG(info) << "[CS] Run night script."; OPENAUTO_LOG(info) << "[MainWindow] Night.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Day/Night script.";
#endif
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/service_daynight.sh app day"); system("/opt/crankshaft/service_daynight.sh app day");
OPENAUTO_LOG(info) << "[CS] Run day script."; OPENAUTO_LOG(info) << "[MainWindow] Day.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Day/Night script.";
#endif
}); });
mainWindow.showFullScreen(); mainWindow.showFullScreen();
@ -236,36 +221,46 @@ int main(int argc, char* argv[])
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStart, [&app]() {
OPENAUTO_LOG(info) << "[Autoapp] Manual start android auto entity by reset usb."; OPENAUTO_LOG(info) << "[Autoapp] Manual start android auto.";
try { try {
if (std::ifstream("/tmp/android_device")) { if (std::ifstream("/tmp/android_device")) {
//system("/usr/local/bin/autoapp_helper usbreset");
app->disableAutostartEntity = false; app->disableAutostartEntity = false;
app->stop();
app->waitForUSBDevice(); app->waitForUSBDevice();
} }
} catch (...) { } catch (...) {
OPENAUTO_LOG(info) << "[Autoapp] Exception in Manual start android auto entity by reset usb."; OPENAUTO_LOG(info) << "[Autoapp] Exception in Manual start android auto.";
} }
}); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() { QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerAppStop, [&app]() {
OPENAUTO_LOG(info) << "[Autoapp] Manual stop android auto entity.";
try { try {
if (std::ifstream("/tmp/android_device")) { if (std::ifstream("/tmp/android_device")) {
OPENAUTO_LOG(info) << "[Autoapp] Manual stop usb android auto.";
app->disableAutostartEntity = true; app->disableAutostartEntity = true;
system("/usr/local/bin/autoapp_helper usbreset"); system("/usr/local/bin/autoapp_helper usbreset");
usleep(500000); usleep(1000000);
app->stop(); app->stop();
} else { } else {
OPENAUTO_LOG(info) << "[Autoapp] Manual stop wifi android auto.";
app->stop(); app->stop();
//app->onAndroidAutoQuit();
} }
} catch (...) { } catch (...) {
OPENAUTO_LOG(info) << "[Autoapp] Exception in Manual stop android auto entity."; OPENAUTO_LOG(info) << "[Autoapp] Exception in manual stop android auto.";
} }
}); });
warningdialog.show(); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::CloseAllDialogs, [&settingsWindow, &connectdialog, &updatedialog, &warningdialog]() {
settingsWindow.close();
connectdialog.close();
warningdialog.close();
updatedialog.close();
OPENAUTO_LOG(info) << "[Autoapp] Close all possible open dialogs.";
});
if (configuration->hideWarning() == false) {
warningdialog.show();
}
app->waitForUSBDevice(); app->waitForUSBDevice();