Make lux values switchable via setings

This commit is contained in:
hawkeyexp 2018-11-30 13:32:24 +01:00
parent c30bdeb20b
commit 802393d427
7 changed files with 31 additions and 4255 deletions

View File

@ -56,6 +56,8 @@ public:
bool hideMenuToggle() const override;
void hideAlpha(bool value) override;
bool hideAlpha() const override;
void showLux(bool value) override;
bool showLux() const override;
std::string getMp3MasterPath() const override;
void setMp3MasterPath(const std::string& value) override;
@ -107,6 +109,7 @@ private:
size_t alphaTrans_;
bool hideMenuToggle_;
bool hideAlpha_;
bool showLux_;
std::string mp3MasterPath_;
std::string mp3SubFolder_;
int32_t mp3Track_;
@ -134,6 +137,7 @@ private:
static const std::string cGeneralAlphaTransKey;
static const std::string cGeneralHideMenuToggleKey;
static const std::string cGeneralHideAlphaKey;
static const std::string cGeneralShowLuxKey;
static const std::string cGeneralHandednessOfTrafficTypeKey;

View File

@ -64,6 +64,8 @@ public:
virtual bool hideMenuToggle() const = 0;
virtual void hideAlpha(bool value) = 0;
virtual bool hideAlpha() const = 0;
virtual void showLux(bool value) = 0;
virtual bool showLux() const = 0;
virtual std::string getMp3MasterPath() const = 0;
virtual void setMp3MasterPath(const std::string& value) = 0;

View File

@ -38,6 +38,7 @@ const std::string Configuration::cGeneralOldGUIKey = "General.OldGUI";
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::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType";
@ -99,6 +100,7 @@ void Configuration::load()
alphaTrans_ = iniConfig.get<size_t>(cGeneralAlphaTransKey, 50);
hideMenuToggle_ = iniConfig.get<bool>(cGeneralHideMenuToggleKey, false);
hideAlpha_ = iniConfig.get<bool>(cGeneralHideAlphaKey, false);
showLux_ = iniConfig.get<bool>(cGeneralShowLuxKey, false);
mp3MasterPath_ = iniConfig.get<std::string>(cGeneralMp3MasterPathKey, "/media/MYMEDIA");
mp3SubFolder_ = iniConfig.get<std::string>(cGeneralMp3SubFolderKey, "/");
mp3Track_ = iniConfig.get<size_t>(cGeneralMp3TrackKey, 0);
@ -143,6 +145,7 @@ void Configuration::reset()
alphaTrans_ = 50;
hideMenuToggle_ = false;
hideAlpha_ = false;
showLux_ = false;
mp3MasterPath_ = "/media/MYMEDIA";
mp3SubFolder_ = "/";
mp3Track_ = 0;
@ -172,6 +175,7 @@ void Configuration::save()
iniConfig.put<size_t>(cGeneralAlphaTransKey, alphaTrans_);
iniConfig.put<bool>(cGeneralHideMenuToggleKey, hideMenuToggle_);
iniConfig.put<bool>(cGeneralHideAlphaKey, hideAlpha_);
iniConfig.put<bool>(cGeneralShowLuxKey, showLux_);
iniConfig.put<std::string>(cGeneralMp3MasterPathKey, mp3MasterPath_);
iniConfig.put<std::string>(cGeneralMp3SubFolderKey, mp3SubFolder_);
iniConfig.put<int32_t>(cGeneralMp3TrackKey, mp3Track_);
@ -285,6 +289,16 @@ bool Configuration::hideAlpha() const
return hideAlpha_;
}
void Configuration::showLux(bool value)
{
showLux_ = value;
}
bool Configuration::showLux() const
{
return showLux_;
}
std::string Configuration::getMp3MasterPath() const
{
return mp3MasterPath_;

View File

@ -1610,7 +1610,7 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
// read value from tsl2561
QFileInfo lightsensorFile("/tmp/tsl2561");
if (lightsensorFile.exists()) {
if (lightsensorFile.exists() && this->configuration_->showLux()) {
QFile paramFile("/tmp/tsl2561");
paramFile.open(QIODevice::ReadOnly);
QTextStream data(&paramFile);

View File

@ -125,6 +125,7 @@ void SettingsWindow::onSave()
configuration_->setAlphaTrans(static_cast<size_t>(ui_->horizontalSliderAlphaTrans->value()));
configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked());
configuration_->hideAlpha(ui_->checkBoxHideAlpha->isChecked());
configuration_->showLux(ui_->checkBoxShowLux->isChecked());
configuration_->mp3AutoPlay(ui_->checkBoxAutoPlay->isChecked());
configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60);
@ -308,6 +309,7 @@ void SettingsWindow::load()
ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI());
ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle());
ui_->checkBoxHideAlpha->setChecked(configuration_->hideAlpha());
ui_->checkBoxShowLux->setChecked(configuration_->showLux());
ui_->checkBoxAutoPlay->setChecked(configuration_->mp3AutoPlay());
ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30);

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>963</width>
<height>3006</height>
<height>3033</height>
</rect>
</property>
<property name="sizePolicy">
@ -403,6 +403,13 @@ outline: none;
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowLux">
<property name="text">
<string>Show Lux value from tls2561</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>