--- /dev/null
+#include "TapDurationModel.hpp"
+
+#include "setting-accessibility.h"
+
+TapDurationModel::TapDurationModel()
+{
+ stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE, defaultState_, [this](auto val) {
+ this->state_ = val;
+ });
+
+ state_.attach([](auto val) {
+ Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE, val);
+ });
+
+ valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_VALUE, defaultValue_, [this](auto val) {
+ this->value_ = val;
+ });
+
+ value_.attach([](auto val) {
+ Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_VALUE, val);
+ });
+}
\ No newline at end of file
--- /dev/null
+#ifndef TAP_DURATION_MODEL_HPP_
+#define TAP_DURATION_MODEL_HPP_
+
+#include "ObservableProperty.hpp"
+#include "VConf.hpp"
+#include "utils.hpp"
+
+class TapDurationModel
+{
+ public:
+ TapDurationModel();
+ 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 "TapDurationPresenter.hpp"
+
+TapDurationPresenter::TapDurationPresenter()
+ : SpinnerPresenterWithToggle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION")
+{
+ 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> TapDurationPresenter::getRange()
+{
+ return model_.range_;
+}
+
+bool TapDurationPresenter::isEditable()
+{
+ return model_.editable_;
+}
+
+double TapDurationPresenter::getStep()
+{
+ return model_.step_;
+}
+
+std::string TapDurationPresenter::getFormat()
+{
+ return "%1.1f seconds";
+}
+
+std::string TapDurationPresenter::getLabel()
+{
+ return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION";
+}
\ No newline at end of file
--- /dev/null
+#ifndef TAP_DURATION_PRESENTER_HPP_
+#define TAP_DURATION_PRESENTER_HPP_
+
+#include "SpinnerPresenterWithToggle.hpp"
+#include "TapDurationModel.hpp"
+
+class TapDurationPresenter : public SpinnerPresenterWithToggle
+{
+ public:
+ TapDurationPresenter();
+
+ utils::Range<double> getRange() override;
+ double getStep() override;
+ bool isEditable() override;
+ std::string getLabel() override;
+ std::string getFormat() override;
+
+ private:
+ TapDurationModel model_;
+};
+#endif
\ No newline at end of file
#include "AutoScanIntervalPresenter.hpp"
#include "ManageMenuOptionsPagePresenter.hpp"
#include "PauseOnFirstPresenter.hpp"
+#include "TapDurationPresenter.hpp"
UniversalSwitchSettingsPagePresenter::UniversalSwitchSettingsPagePresenter()
{
: std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"},
[this](auto item) {
DEBUG("tap duration widget");
+ Singleton<AppContext>::instance().push(std::make_unique<TapDurationPresenter>());
},
ListItem::WidgetType::toggle,
[this](auto item) {