Add settings for brightness control / Auto Play / Add CSSTORAGE info / Switchable cursor

This commit is contained in:
hawkeyexp 2018-12-21 17:37:20 +01:00
parent db48323a19
commit 2ed095eed5
8 changed files with 665 additions and 354 deletions

View File

@ -58,6 +58,10 @@ public:
bool hideAlpha() const override;
void showLux(bool value) override;
bool showLux() const override;
void showCursor(bool value) override;
bool showCursor() const override;
void hideBrightnessControl(bool value) override;
bool hideBrightnessControl() const override;
std::string getMp3MasterPath() const override;
void setMp3MasterPath(const std::string& value) override;
@ -67,6 +71,8 @@ public:
void setMp3Track(int32_t value) override;
bool mp3AutoPlay() const override;
void mp3AutoPlay(bool value) override;
bool showAutoPlay() const override;
void showAutoPlay(bool value) override;
aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override;
void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) override;
@ -110,10 +116,13 @@ private:
bool hideMenuToggle_;
bool hideAlpha_;
bool showLux_;
bool showCursor_;
bool hideBrightnessControl_;
std::string mp3MasterPath_;
std::string mp3SubFolder_;
int32_t mp3Track_;
bool mp3AutoPlay_;
bool showAutoPlay_;
aasdk::proto::enums::VideoFPS::Enum videoFPS_;
aasdk::proto::enums::VideoResolution::Enum videoResolution_;
@ -138,6 +147,8 @@ private:
static const std::string cGeneralHideMenuToggleKey;
static const std::string cGeneralHideAlphaKey;
static const std::string cGeneralShowLuxKey;
static const std::string cGeneralShowCursorKey;
static const std::string cGeneralHideBrightnessControlKey;
static const std::string cGeneralHandednessOfTrafficTypeKey;
@ -145,6 +156,7 @@ private:
static const std::string cGeneralMp3SubFolderKey;
static const std::string cGeneralMp3TrackKey;
static const std::string cGeneralMp3AutoPlayKey;
static const std::string cGeneralShowAutoPlayKey;
static const std::string cVideoFPSKey;
static const std::string cVideoResolutionKey;

View File

@ -66,6 +66,10 @@ public:
virtual bool hideAlpha() const = 0;
virtual void showLux(bool value) = 0;
virtual bool showLux() const = 0;
virtual void showCursor(bool value) = 0;
virtual bool showCursor() const = 0;
virtual void hideBrightnessControl(bool value) = 0;
virtual bool hideBrightnessControl() const = 0;
virtual std::string getMp3MasterPath() const = 0;
virtual void setMp3MasterPath(const std::string& value) = 0;
@ -75,6 +79,8 @@ public:
virtual void setMp3Track(int32_t value) = 0;
virtual bool mp3AutoPlay() const = 0;
virtual void mp3AutoPlay(bool value) = 0;
virtual bool showAutoPlay() const = 0;
virtual void showAutoPlay(bool value) = 0;
virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0;
virtual void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) = 0;

View File

@ -243,6 +243,10 @@ private:
bool lightsensor = false;
bool holidaybg = false;
bool csmtupdate = false;
bool udevupdate = false;
bool openautoupdate = false;
};
}

View File

@ -39,6 +39,8 @@ const std::string Configuration::cGeneralAlphaTransKey = "General.AlphaTrans";
const std::string Configuration::cGeneralHideMenuToggleKey = "General.HideMenuToggle";
const std::string Configuration::cGeneralHideAlphaKey = "General.HideAlpha";
const std::string Configuration::cGeneralShowLuxKey = "General.ShowLux";
const std::string Configuration::cGeneralShowCursorKey = "General.ShowCursor";
const std::string Configuration::cGeneralHideBrightnessControlKey = "General.HideBrightnessControl";
const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType";
@ -46,6 +48,7 @@ const std::string Configuration::cGeneralMp3MasterPathKey = "General.Mp3MasterPa
const std::string Configuration::cGeneralMp3SubFolderKey = "General.Mp3SubFolder";
const std::string Configuration::cGeneralMp3TrackKey = "General.Mp3Track";
const std::string Configuration::cGeneralMp3AutoPlayKey = "General.Mp3AutoPlay";
const std::string Configuration::cGeneralShowAutoPlayKey = "General.ShowAutoPlay";
const std::string Configuration::cVideoFPSKey = "Video.FPS";
const std::string Configuration::cVideoResolutionKey = "Video.Resolution";
@ -101,17 +104,20 @@ void Configuration::load()
hideMenuToggle_ = iniConfig.get<bool>(cGeneralHideMenuToggleKey, false);
hideAlpha_ = iniConfig.get<bool>(cGeneralHideAlphaKey, false);
showLux_ = iniConfig.get<bool>(cGeneralShowLuxKey, false);
showCursor_ = iniConfig.get<bool>(cGeneralShowCursorKey, false);
hideBrightnessControl_ = iniConfig.get<bool>(cGeneralHideBrightnessControlKey, false);
mp3MasterPath_ = iniConfig.get<std::string>(cGeneralMp3MasterPathKey, "/media/MYMEDIA");
mp3SubFolder_ = iniConfig.get<std::string>(cGeneralMp3SubFolderKey, "/");
mp3Track_ = iniConfig.get<size_t>(cGeneralMp3TrackKey, 0);
mp3AutoPlay_ = iniConfig.get<bool>(cGeneralMp3AutoPlayKey, false);
showAutoPlay_ = iniConfig.get<bool>(cGeneralShowAutoPlayKey, false);
videoFPS_ = static_cast<aasdk::proto::enums::VideoFPS::Enum>(iniConfig.get<uint32_t>(cVideoFPSKey,
aasdk::proto::enums::VideoFPS::_30));
videoResolution_ = static_cast<aasdk::proto::enums::VideoResolution::Enum>(iniConfig.get<uint32_t>(cVideoResolutionKey,
aasdk::proto::enums::VideoResolution::_480p));
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 140);
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 100);
omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1);
videoMargins_ = QRect(0, 0, iniConfig.get<int32_t>(cVideoMarginWidth, 0), iniConfig.get<int32_t>(cVideoMarginHeight, 0));
@ -146,13 +152,16 @@ void Configuration::reset()
hideMenuToggle_ = false;
hideAlpha_ = false;
showLux_ = false;
showCursor_ = false;
hideBrightnessControl_ = false;
mp3MasterPath_ = "/media/MYMEDIA";
mp3SubFolder_ = "/";
mp3Track_ = 0;
mp3AutoPlay_ = false;
showAutoPlay_ = false;
videoFPS_ = aasdk::proto::enums::VideoFPS::_30;
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
screenDPI_ = 140;
screenDPI_ = 100;
omxLayerIndex_ = 1;
videoMargins_ = QRect(0, 0, 0, 0);
enableTouchscreen_ = true;
@ -176,10 +185,13 @@ void Configuration::save()
iniConfig.put<bool>(cGeneralHideMenuToggleKey, hideMenuToggle_);
iniConfig.put<bool>(cGeneralHideAlphaKey, hideAlpha_);
iniConfig.put<bool>(cGeneralShowLuxKey, showLux_);
iniConfig.put<bool>(cGeneralShowCursorKey, showCursor_);
iniConfig.put<bool>(cGeneralHideBrightnessControlKey, hideBrightnessControl_);
iniConfig.put<std::string>(cGeneralMp3MasterPathKey, mp3MasterPath_);
iniConfig.put<std::string>(cGeneralMp3SubFolderKey, mp3SubFolder_);
iniConfig.put<int32_t>(cGeneralMp3TrackKey, mp3Track_);
iniConfig.put<bool>(cGeneralMp3AutoPlayKey, mp3AutoPlay_);
iniConfig.put<bool>(cGeneralShowAutoPlayKey, showAutoPlay_);
iniConfig.put<uint32_t>(cVideoFPSKey, static_cast<uint32_t>(videoFPS_));
iniConfig.put<uint32_t>(cVideoResolutionKey, static_cast<uint32_t>(videoResolution_));
@ -299,6 +311,26 @@ bool Configuration::showLux() const
return showLux_;
}
void Configuration::showCursor(bool value)
{
showCursor_ = value;
}
bool Configuration::showCursor() const
{
return showCursor_;
}
void Configuration::hideBrightnessControl(bool value)
{
hideBrightnessControl_ = value;
}
bool Configuration::hideBrightnessControl() const
{
return hideBrightnessControl_;
}
std::string Configuration::getMp3MasterPath() const
{
return mp3MasterPath_;
@ -339,6 +371,16 @@ bool Configuration::mp3AutoPlay() const
return mp3AutoPlay_;
}
void Configuration::showAutoPlay(bool value)
{
showAutoPlay_ = value;
}
bool Configuration::showAutoPlay() const
{
return showAutoPlay_;
}
aasdk::proto::enums::VideoFPS::Enum Configuration::getVideoFPS() const
{
return videoFPS_;

View File

@ -353,8 +353,10 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
// run monitor for custom brightness command if enabled in crankshaft_env.sh
if (brigthnessvalues[3] == "1") {
ui_->pushButtonBrightness->show();
ui_->pushButtonBrightness2->show();
if (!configuration->hideBrightnessControl()) {
ui_->pushButtonBrightness->show();
ui_->pushButtonBrightness2->show();
}
this->customBrightnessControl = true;
system("/usr/local/bin/autoapp_helper startcustombrightness &");
}
@ -479,7 +481,19 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
MainWindow::playerShow();
MainWindow::playerHide();
MainWindow::on_pushButtonPlayerPlayList_clicked();
MainWindow::playerShow();
if (configuration->showAutoPlay()) {
MainWindow::playerShow();
}
}
// update notify
this->csmtupdate = check_file_exist("/tmp/csmt_update_available");
this->udevupdate = check_file_exist("/tmp/udev_update_available");
this->openautoupdate = check_file_exist("/tmp/openauto_update_available");
if (this->csmtupdate || this->udevupdate || this->openautoupdate) {
ui_->SysinfoTopLeft->setText("Update available!");
ui_->SysinfoTopLeft->show();
}
watcher = new QFileSystemWatcher(this);
@ -489,6 +503,21 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
watcher_tmp = new QFileSystemWatcher(this);
watcher_tmp->addPath("/tmp");
connect(watcher_tmp, &QFileSystemWatcher::directoryChanged, this, &MainWindow::tmpChanged);
// Experimental test code
//QBluetoothLocalDevice localDevice;
//QString localDeviceName;
//QString localDeviceAddress;
//if (localDevice.isValid()) {
// localDeviceName = localDevice.name();
// localDeviceAddress = localDevice.address().toString();
// QList<QBluetoothAddress> btdevices;
// btdevices = localDevice.connectedDevices();
// QString btdevice = btdevices.first().toString();
// QMessageBox btMessage(QMessageBox::Critical, "BT Device", btdevice, QMessageBox::Ok);
// btMessage.setWindowFlags(Qt::WindowStaysOnTopHint);
// btMessage.exec();
//}
}
MainWindow::~MainWindow()
@ -1568,6 +1597,23 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
ui_->pushButtonToggleGUI2->show();
}
// hide brightness button if eanbled in settings
if (configuration_->hideBrightnessControl()) {
if ((ui_->pushButtonBrightness->isVisible() == true) || (ui_->pushButtonBrightness->isVisible() == true) || (ui_->BrightnessSliderControl->isVisible() == true)) {
ui_->pushButtonBrightness->hide();
ui_->pushButtonBrightness2->hide();
ui_->BrightnessSliderControl->hide();
ui_->VolumeSliderControl->show();
}
} else {
if (!this->lightsensor) {
if ((ui_->pushButtonBrightness->isVisible() == false) || (ui_->pushButtonBrightness->isVisible() == false)) {
ui_->pushButtonBrightness->show();
ui_->pushButtonBrightness2->show();
}
}
}
// read value from tsl2561
if (std::ifstream("/tmp/tsl2561") && this->configuration_->showLux()) {
QFile paramFile("/tmp/tsl2561");

View File

@ -28,6 +28,7 @@
#include <QNetworkInterface>
#include <QNetworkConfigurationManager>
#include <fstream>
#include <QStorageInfo>
namespace f1x
{
@ -145,7 +146,10 @@ void SettingsWindow::onSave()
configuration_->setAlphaTrans(static_cast<size_t>(ui_->horizontalSliderAlphaTrans->value()));
configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked());
configuration_->showLux(ui_->checkBoxShowLux->isChecked());
configuration_->showCursor(ui_->checkBoxShowCursor->isChecked());
configuration_->hideBrightnessControl(ui_->checkBoxHideBrightnessControl->isChecked());
configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked());
configuration_->showAutoPlay(ui_->checkBoxShowPlayer->isChecked());
configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60);
@ -377,7 +381,10 @@ void SettingsWindow::load()
ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI());
ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle());
ui_->checkBoxShowLux->setChecked(configuration_->showLux());
ui_->checkBoxShowCursor->setChecked(configuration_->showCursor());
ui_->checkBoxHideBrightnessControl->setChecked(configuration_->hideBrightnessControl());
ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay());
ui_->checkBoxShowPlayer->setChecked(configuration_->showAutoPlay());
ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30);
ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_60);
@ -409,6 +416,17 @@ void SettingsWindow::load()
ui_->radioButtonQtAudio->setChecked(audioOutputBackendType == configuration::AudioOutputBackendType::QT);
ui_->checkBoxHardwareSave->setChecked(false);
QStorageInfo storage("/media/CSSTORAGE");
storage.refresh();
if (storage.isValid() && storage.isReady()) {
if (storage.isReadOnly()) {
ui_->labelStorage->setText("Storage is read only! (" + storage.device() + ") - This can be caused by demaged filesystem on CSSTORAGE. Try a reboot.");
} else {
ui_->labelStorage->setText("Device: " + storage.device() + " Label: " + storage.displayName() + " Total: " + QString::number(storage.bytesTotal()/1024/1024/1024) + "GB Free: " + QString::number(storage.bytesFree()/1024/1024/1024) + "GB (" + storage.fileSystemType() + ")");
}
} else {
ui_->labelStorage->setText("Storage is not ready or missing!");
}
}
void SettingsWindow::loadButtonCheckBoxes()

File diff suppressed because it is too large Load Diff

View File

@ -130,11 +130,11 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openWifiDialog, &wifiDialog, &autoapp::ui::WifiDialog::exec);
qApplication.setOverrideCursor(Qt::BlankCursor);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {
const auto cursor = qApplication.overrideCursor()->shape() == Qt::BlankCursor ? Qt::ArrowCursor : Qt::BlankCursor;
qApplication.setOverrideCursor(cursor);
});
if (configuration->showCursor() == false) {
qApplication.setOverrideCursor(Qt::BlankCursor);
} else {
qApplication.setOverrideCursor(Qt::ArrowCursor);
}
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() {
#ifdef RASPBERRYPI3