--- /dev/null
+#include "AutoTapModel.hpp"
+
+#include "UniversalSwitchConstants.hpp"
+
+AutoTapModel::AutoTapModel()
+{
+ stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_STATE, defaultState_, [this](auto val) {
+ this->state_ = val;
+ });
+
+ state_.attach([](auto val) {
+ Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_STATE, val);
+ });
+
+ valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_VALUE, defaultValue_, [this](auto val) {
+ this->value_ = val;
+ });
+
+ value_.attach([](auto val) {
+ Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_VALUE, val);
+ });
+}
\ No newline at end of file
--- /dev/null
+#ifndef AUTO_TAP_MODEL_HPP_
+#define AUTO_TAP_MODEL_HPP_
+
+#include "ObservableProperty.hpp"
+#include "VConf.hpp"
+#include "utils.hpp"
+
+class AutoTapModel
+{
+ public:
+ AutoTapModel();
+ ObservableProperty<bool> state_;
+ ObservableProperty<double> value_;
+
+ const utils::Range<double> range_ = {0.5, 5.0};
+
+ const double step_ = 0.1;
+ const double defaultValue_ = 1.0;
+
+ const bool editable_ = true;
+ const bool defaultState_ = false;
+
+ private:
+ VConfInterface::CallbackHandle stateHandle_;
+ VConfInterface::CallbackHandle valueHandle_;
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+#include "AutoTapPresenter.hpp"
+
+AutoTapPresenter::AutoTapPresenter()
+ : SpinnerPresenterWithToggle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP")
+{
+ state_ = model_.state_.value();
+ state_.attach([this](auto state) {
+ model_.state_ = state;
+ });
+
+ value_ = model_.value_.value();
+ value_.attach([this](auto val) {
+ model_.value_ = val;
+ });
+}
+
+utils::Range<double> AutoTapPresenter::getRange()
+{
+ return model_.range_;
+}
+
+bool AutoTapPresenter::isEditable()
+{
+ return model_.editable_;
+}
+
+double AutoTapPresenter::getStep()
+{
+ return model_.step_;
+}
+
+std::string AutoTapPresenter::getFormat()
+{
+ return "%1.1f seconds";
+}
+
+std::string AutoTapPresenter::getLabel()
+{
+ return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP";
+}
\ No newline at end of file
--- /dev/null
+#ifndef AUTO_TAP_PRESENTER_HPP_
+#define AUTO_TAP_PRESENTER_HPP_
+
+#include "SpinnerPresenterWithToggle.hpp"
+#include "AutoTapModel.hpp"
+
+class AutoTapPresenter : public SpinnerPresenterWithToggle
+{
+ public:
+ AutoTapPresenter();
+
+ utils::Range<double> getRange() override;
+ double getStep() override;
+ bool isEditable() override;
+ std::string getLabel() override;
+ std::string getFormat() override;
+
+ private:
+ AutoTapModel model_;
+};
+#endif
\ No newline at end of file
#include "ManageMenuOptionsPagePresenter.hpp"
#include "PauseOnFirstPresenter.hpp"
#include "TapDurationPresenter.hpp"
+#include "AutoTapPresenter.hpp"
UniversalSwitchSettingsPagePresenter::UniversalSwitchSettingsPagePresenter()
{
: std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"},
[this](auto item) {
DEBUG("auto tap widget");
+ Singleton<AppContext>::instance().push(std::make_unique<AutoTapPresenter>());
},
ListItem::WidgetType::toggle,
[this](auto item) {