msgid "IDS_TPLATFORM_OPT_BLUETOOTH"
msgstr "Bluetooth"
-msgid "IDS_ACCS_UNIVERSAL_SWITCH"
-msgstr "Universal switch"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_HINT"
-msgstr "Control your device with your customized switches."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ON"
-msgstr "On"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_OFF"
-msgstr "Off"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_COMMENT"
-msgstr "Use customizable switches to interact with the device and select items shown on the screen.You can set your personal interaction method by connecting external accessories, tapping the screen or using the front camera to detect the rotation of your head, the opening of your mouth and the blinking of your eyes."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS"
-msgstr "Universal switch settings"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_POPUP_ADD"
-msgstr "Add switch"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_CANCEL"
-msgstr "Cancel"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SAVE"
-msgstr "Save"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_NAME"
-msgstr "Name"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ACTION"
-msgstr "Action"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES"
-msgstr "Switches"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES_ADD_SWITCH"
-msgstr "Add switch"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES_DELETE"
-msgstr "DELETE"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING"
-msgstr "Scanning"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_AUTO_SCAN"
-msgstr "Auto scan"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_AUTO_SCAN_INT"
-msgstr "Auto scan interval"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_NUM_OF_SCANS"
-msgstr "Number of auto scan loops"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD"
-msgstr "Scan method"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD_POINT"
-msgstr "Point"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD_ROW"
-msgstr "Row"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR"
-msgstr "Scan direction"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR_TB"
-msgstr "Top to bottom"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR_BT"
-msgstr "Bottom to top"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_PT_SPEED"
-msgstr "Point scan speed"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS"
-msgstr "Additional settings"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_PAUSE_ON_FIRST"
-msgstr "Pause on first item"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"
-msgstr "Tap duration"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_SGL_IACTION_INT"
-msgstr "Single interaction interval"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP"
-msgstr "Auto tap"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT"
-msgstr "Auto move interval"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP_KBD"
-msgstr "Auto tap keyboard"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP_KBD_SUB"
-msgstr "Do not show a menu of additional actions when the keyboard is tapped while using Row scan."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK"
-msgstr "Feedback"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL"
-msgstr "Cursor color"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_RED"
-msgstr "Red"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_ORANGE"
-msgstr "Orange"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_YELLOW"
-msgstr "Yellow"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GREEN"
-msgstr "Green"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_BLUE"
-msgstr "Blue"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GRAY"
-msgstr "Gray"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND"
-msgstr "Sound"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND_VOLUME"
-msgstr "Volume"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE"
-msgstr "Voice"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_RATE"
-msgstr "Speech rate"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_VOLUME"
-msgstr "Speech volume"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_OPTIONS"
-msgstr "Options"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE"
-msgstr "Manage menu options"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_SUB"
-msgstr "Select which menu options to show in Universal switch."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_GESTURES"
-msgstr "Gestures"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_ACTIONS"
-msgstr "Actions"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_SETTINGS"
-msgstr "Settings"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_RECENT_APPS"
-msgstr "Recent apps"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_HOME_SCREEN"
-msgstr "Home screen"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_BACK"
-msgstr "Back"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_BUTTONS_AND_KEYS"
-msgstr "Buttons and keys"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_CONTEXTUAL_MENU"
-msgstr "Contextual menu"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_CONTEXTUAL_MENU_DESC"
-msgstr "Place contextual menu on the first row depending on the activity"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"
-msgstr "%.1f seconds"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_ON"
-msgstr "On"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"
-msgstr "Off"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_UNDEFINED"
-msgstr "Undefined"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES"
-msgstr "%d Switches"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_AUTO_SCAN_INT"
-msgstr "Select the length of the time to wait before the next item is highlighted."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_NUM_OF_SCANS"
-msgstr "Select the number of times the screen is scanned automatically for interactive items when there is no interaction."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_SCAN_SPEED"
-msgstr "Select the movement speed of the vertical and horizontal screen scanning lines."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_PAUSE_ON_FIRST"
-msgstr "Select how much more time you want the 1st item to stay highlighted for while Auto scan is turned on. This will be added to the Auto scan interval time (%.1f seconds). The 1st item will stay highlighted for %.1f seconds in total."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_TAP_DURATION"
-msgstr "Select how long you need to hold an interaction for it to be recognized as a tap.<br> This duration must be less than the Auto tap time."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_SGL_IACTION_INT"
-msgstr "Select the minimum length of time that must pass between interactions for them to be recognized as separate."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_AUTO_TAP"
-msgstr "Select how long to wait before a selected item is tapped automatically. Use the Select item switch again during this time to show menu options instead."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_AUTO_MOVE_INT"
-msgstr "Select how long a switch must be held before the highlight skips to the next or previous item. This function cannot be used while Auto scan is turned on."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_FEEDBACK_SOUND"
-msgstr "Select the volume of the sound feedback."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_FEEDBACK_VOICE"
-msgstr "Select the volume and speed of voice feedback."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_SELECT_ACTION"
-msgstr "Select switch action"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH"
-msgstr "Add switch"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES"
-msgstr "Delete switches"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_DELETE_ALL_SWITCHES_DESC"
-msgstr "All switches will be removed. Universal Switch will be disabled."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES_DESC"
-msgstr "switches will be removed."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_OK"
-msgstr "Ok"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_UNABLE_TO_ADD"
-msgstr "Unable to add accessory"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ALREADY_ADDED"
-msgstr "This accessory has already been added. Try adding another accessory."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_NAME"
-msgstr "Switch name"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_SCREEN"
-msgstr "Screen"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_SCREEN_HINT"
-msgstr "Tap anywhere on the screen."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES"
-msgstr "Accessories"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_HINT"
-msgstr "Connect accessories before adding switches."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA"
-msgstr "Camera"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_HINT"
-msgstr "Set your device to detect the movement of your head, eyes and moth."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_SCREEN_TITLE"
-msgstr "Screen"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_TITLE"
-msgstr "Accessories"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_DESC"
-msgstr "Connect an accessory and press any of its buttons."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_TITLE"
-msgstr "Camera"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_COMMENT"
-msgstr "Control your device with gestures and motions via the camera. Note that these camera switches cannot be used while using the camera hardware in any app."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD"
-msgstr "Head"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_LEFT"
-msgstr "Turn head left"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_RIGHT"
-msgstr "Turn head right"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_UP"
-msgstr "Move head up"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_DOWN"
-msgstr "Move head down"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_BLINK"
-msgstr "Blink"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_BLINK_SUB"
-msgstr "Close your eyes for at least 2.0 seconds to allow the device to recognise this switch."
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD_MOUTH"
-msgstr "Open mouth"
-
msgid "IDS_ACCS_SELECT_ITEMS"
msgstr "Select items"
msgid "IDS_ACCS_SETTINGS_CAPS"
msgstr "SETTINGS"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_NO_SWITCHES_TITLE"
-msgstr "Add switch?"
-
-msgid "IDS_ACCS_UNIVERSAL_SWITCH_NO_SWITCHES_TEXT"
-msgstr "To turn on Universal switch, at least one switch needs to be added."
#include "MainPagePresenter.hpp"
#include "NavigationContext.hpp"
#include "Singleton.hpp"
-#include "UniversalSwitchSettingsPagePresenter.hpp"
#include <app.h>
#include <appcore-common.h>
static void on_app_control(app_control_h service, void *priv)
{
- char *value = NULL;
- if (!app_control_get_extra_data(service, "SHOW_US_SETTINGS", &value) && value != NULL && strcmp(value, "1") == 0)
- Singleton<AppContext>::instance().push(std::make_unique<UniversalSwitchSettingsPagePresenter>());
- else
- Singleton<AppContext>::instance().push(std::make_unique<MainPagePresenter>());
- free(value);
+ Singleton<AppContext>::instance().push(std::make_unique<MainPagePresenter>());
}
static void _lang_changed(app_event_info_h event_info, void *data)
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AddAccessoriesSwitchesPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-AddAccessoriesSwitchesPageModel::AddAccessoriesSwitchesPageModel()
-{
- dBusClient_ = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION};
-}
-
-AddAccessoriesSwitchesPageModel::~AddAccessoriesSwitchesPageModel()
-{
- cancelCaptureSwitch();
-}
-
-void AddAccessoriesSwitchesPageModel::captureSwitch(std::function<void(std::string)> onCapture, std::string providerId)
-{
- dBusClient_.method<std::string(std::string)>("captureSwitch").timeout(DBus::InfinitiveTimeout).asyncCall([onCapture](DBus::ValueOrError<std::string> msg) {
- if (msg) {
- onCapture(std::get<0>(msg));
- } else {
- ERROR("Error on function captureSwitch asyncCall");
- ERROR("failed '%s'", msg.getError().message.c_str());
- }
- },
- providerId);
-}
-
-void AddAccessoriesSwitchesPageModel::cancelCaptureSwitch()
-{
- auto reply = dBusClient_.method<DBus::ValueOrError<>()>("cancelCaptureSwitch").call();
- if (!reply) {
- ERROR("Error on function cancelCaptureSwitch call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
-
-bool AddAccessoriesSwitchesPageModel::isConfigured(const std::string &switchId)
-{
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string, ChangeType>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- for (auto &item : std::get<0>(reply))
- if (std::get<0>(item) == switchId)
- return true;
- } else {
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- ASSERT(0, "unable to know that switch is configured");
- }
- return false;
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ADD_ACCESSORIES_SWITCHES_PAGE_MODEL_HPP
-#define ADD_ACCESSORIES_SWITCHES_PAGE_MODEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-#include <chrono>
-
-class AddAccessoriesSwitchesPageModel
-{
- public:
- AddAccessoriesSwitchesPageModel();
- ~AddAccessoriesSwitchesPageModel();
- void captureSwitch(std::function<void(std::string)> onCapture, std::string providerId);
- void cancelCaptureSwitch();
- bool isConfigured(const std::string &switchId);
-
- private:
- DBus::DBusClient dBusClient_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AddSwitchPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-AddSwitchPageModel::AddSwitchPageModel()
-{
- dBusClient_ = DBus::DBusClient(BUS, PATH, IFACE, DBus::ConnectionType::SESSION);
- synchronizeProviders();
- dBusClient_.addSignal<void()>(std::string{"switchesConfigurationChanged"}, [this]() {
- this->switchesConfigurationChanged_ = std::chrono::system_clock::now();
- });
-}
-
-void AddSwitchPageModel::synchronizeProviders()
-{
- providers_.clear();
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>()>("getAllSwitchProviders").call();
- if (reply) {
- for (auto provider : std::get<0>(reply))
- providers_.push_back(InfoType{std::get<0>(provider), std::get<1>(provider), std::get<2>(provider)});
- } else {
- ERROR("Error on function getAllSwitchProviders call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
-
-bool AddSwitchPageModel::areAllSwitchesConfigured(const InfoType &switchProvider)
-{
- auto configuredSwitches = getAllSwitchConfigurationItems();
- auto isSwitchConfigured = [&](const InfoType &switchItem) {
- for (auto &configured : configuredSwitches) {
- if (switchItem.id == configured.switchId)
- return true;
- }
- return false;
- };
- for (auto &aSwitch : getAllSwitchesByProviderId(switchProvider.id)) {
- if (!isSwitchConfigured(aSwitch))
- return false;
- }
- return true;
-}
-
-const std::vector<InfoType> &AddSwitchPageModel::getProviders()
-{
- return providers_;
-}
-
-std::vector<InfoType> AddSwitchPageModel::getAllSwitchesByProviderId(const std::string &providerId)
-{
- std::vector<InfoType> allSwitches;
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>(std::string)>("getAllSwitchesByProviderId").call(providerId);
- if (reply) {
- for (auto aSwitch : std::get<0>(reply))
- allSwitches.push_back(InfoType{std::get<0>(aSwitch), std::get<1>(aSwitch), std::get<2>(aSwitch)});
- } else {
- ERROR("Error on function getAllSwitchProviders call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return allSwitches;
-}
-
-std::vector<SwitchConfigurationItem> AddSwitchPageModel::getAllSwitchConfigurationItems()
-{
- std::vector<SwitchConfigurationItem> configurationItems{};
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string, ChangeType>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- for (auto item : std::get<0>(reply))
- configurationItems.push_back(SwitchConfigurationItem{std::get<0>(item), std::get<1>(item), std::get<2>(item)});
- } else {
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return configurationItems;
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ADD_SWITCH_PAGE_MODEL_HPP
-#define ADD_SWITCH_PAGE_MODEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-#include <chrono>
-
-class AddSwitchPageModel
-{
- public:
- AddSwitchPageModel();
- const std::vector<InfoType> &getProviders();
- bool areAllSwitchesConfigured(const InfoType &switchProvider);
- ObservableProperty<std::chrono::system_clock::time_point> switchesConfigurationChanged_;
- std::vector<InfoType> getAllSwitchesByProviderId(const std::string &providerId);
-
- private:
- void synchronizeProviders();
- std::vector<SwitchConfigurationItem> getAllSwitchConfigurationItems();
-
- DBus::DBusClient dBusClient_;
- std::vector<InfoType> providers_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AutoMoveIntervalModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-AutoMoveIntervalModel::AutoMoveIntervalModel()
-{
- stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE, defaultState_, [this](auto val) {
- this->state_ = val;
- });
-
- state_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE, val);
- });
-
- valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_VALUE, defaultValue_, [this](auto val) {
- this->value_ = val;
- });
-
- value_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_VALUE, val);
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef AUTO_MOVE_INTERVAL_MODEL_HPP_
-#define AUTO_MOVE_INTERVAL_MODEL_HPP_
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class AutoMoveIntervalModel
-{
- public:
- AutoMoveIntervalModel();
- ObservableProperty<bool> state_;
- ObservableProperty<double> value_;
-
- const utils::Range<double> range_ = {0.1, 5.0};
-
- const double step_ = 0.1;
- const double defaultValue_ = 1.0;
-
- const bool defaultState_ = false;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AutoScanModel.hpp"
-
-#include "Singleton.hpp"
-
-AutoScanModel::AutoScanModel()
-{
- enabledHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>("db/setting/accessibility/universal-switch/AUTO_SCAN_ENABLED", true, [this](auto val) {
- this->enabled_ = val;
- });
-
- enabled_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/AUTO_SCAN_ENABLED", val);
- });
-
- intervalHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>("db/setting/accessibility/universal-switch/AUTO_SCAN_INTERVAL", 1, [this](auto val) {
- this->interval_ = val;
- });
-
- interval_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/AUTO_SCAN_INTERVAL", val);
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef AUTO_SCAN_MODEL_HPP
-#define AUTO_SCAN_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class AutoScanModel
-{
- public:
- AutoScanModel();
- ObservableProperty<bool> enabled_;
- ObservableProperty<double> interval_;
-
- const utils::Range<double> range_ = {0.5, 9.9};
- const double step_ = 0.1;
-
- private:
- VConfInterface::CallbackHandle enabledHandle_;
- VConfInterface::CallbackHandle intervalHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#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
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#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 defaultState_ = false;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "CameraSwitchesPageModel.hpp"
-
-#include "DBus.hpp"
-#include "UniversalSwitchConstants.hpp"
-
-std::vector<InfoType> CameraSwitchesPageModel::getAllSwitchesByProvider(const std::string &providerId)
-{
- std::vector<InfoType> allSwitches;
- auto reply = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION}.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>(std::string)>("getAllSwitchesByProviderId").call(providerId);
- if (reply) {
- for (auto aSwitch : std::get<0>(reply))
- allSwitches.push_back(InfoType{std::get<0>(aSwitch), std::get<1>(aSwitch), std::get<2>(aSwitch)});
- } else {
- ERROR("Error on function getAllSwitchesByProviderId call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return allSwitches;
-}
-
-bool CameraSwitchesPageModel::isSwitchConfigured(const std::string &switchId)
-{
- auto reply = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION}.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- for (auto item : std::get<0>(reply))
- if (std::get<0>(item) == switchId)
- return true;
- } else {
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return false;
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef CAMERA_SWITCHES_PAGE_MODEL_HPP
-#define CAMERA_SWITCHES_PAGE_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-class CameraSwitchesPageModel
-{
- public:
- std::vector<InfoType> getAllSwitchesByProvider(const std::string &provider);
- bool isSwitchConfigured(const std::string &switchId);
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "CursorColorModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-CursorColorModel::CursorColorModel()
-{
- vconfHandle_ = Singleton<VConfInterface>::instance().registerAndGet<int>(
- VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_CURSOR_COLOR,
- DEFAULT_FEEDBACK_CURSOR_COLOR,
- [this](auto value) {
- this->cursorColor_ = Color::fromABGR(value);
- });
- cursorColor_.attach([this](auto value) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_CURSOR_COLOR, value.toABGRInt());
- });
-}
-
-std::string CursorColorModel::getColorText(Color color)
-{
- if (color == Color::RED)
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_RED";
- if (color == Color::ORANGE)
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_ORANGE";
- if (color == Color::YELLOW)
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_YELLOW";
- if (color == Color::GREEN)
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GREEN";
- if (color == Color::BLUE)
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_BLUE";
- if (color == Color::GRAY)
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL_GRAY";
-
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_UNDEFINED";
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef CURSOR_COLOR_MODEL_HPP
-#define CURSOR_COLOR_MODEL_HPP
-
-#include "Geometry.hpp"
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-
-class CursorColorModel
-{
- public:
- CursorColorModel();
- ObservableProperty<Color> cursorColor_;
- std::string getColorText(Color color);
-
- private:
- VConfInterface::CallbackHandle vconfHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ManageMenuOptionsPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-ManageMenuOptionsPageModel::ManageMenuOptionsPageModel()
-{
- std::vector<std::string> vconfKeys{
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_ACTIONS},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_SETTINGS},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_HOMESCREEN},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_KEYS},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_CONTEXTUAL_MENU},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_GESTURES},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_RECENT_APPS},
- {VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_BACK}};
- manageMenuOptionStates_.resize(ManageMenuOptionsCount);
- vconfHandles_.resize(ManageMenuOptionsCount);
-
- for (auto i = 0u; i < ManageMenuOptionsCount; ++i) {
- auto key = vconfKeys[i];
- vconfHandles_[i] = Singleton<VConfInterface>::instance().registerAndGet<bool>(
- key,
- false,
- [this, i](auto value) {
- this->manageMenuOptionStates_[i] = value;
- });
-
- manageMenuOptionStates_[i].attach([this, key](auto newValue) {
- Singleton<VConfInterface>::instance().set(key, newValue);
- });
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MANAGE_MENU_OPTIONS_PAGE_MODEL_HPP
-#define MANAGE_MENU_OPTIONS_PAGE_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-
-class ManageMenuOptionsPageModel
-{
- public:
- static const int ManageMenuOptionsCount = 8;
- ManageMenuOptionsPageModel();
- std::vector<ObservableProperty<bool>> manageMenuOptionStates_;
-
- private:
- std::vector<VConfInterface::CallbackHandle> vconfHandles_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "NumberOfAutoScanLoopsModel.hpp"
-#include "Singleton.hpp"
-#include "UniversalSwitchConstants.hpp"
-
-NumberOfAutoScanLoopsModel::NumberOfAutoScanLoopsModel()
-{
- valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<int>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_NUM_OF_SCANS, defaultValue_, [this](auto val) {
- this->value_ = val;
- });
-
- value_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_NUM_OF_SCANS, val);
- });
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef NUMBER_OF_AUTO_SCAN_LOOPS_MODEL_HPP_
-#define NUMBER_OF_AUTO_SCAN_LOOPS_MODEL_HPP_
-
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchConstants.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class NumberOfAutoScanLoopsModel
-{
- public:
- NumberOfAutoScanLoopsModel();
- ObservableProperty<int> value_;
-
- const utils::Range<double> range_ = {RANGE_MIN_SCANS_NUM, RANGE_MAX_SCANS_NUM};
- const double step_ = STEP_SCANS_NUM;
- const double defaultValue_ = DEFAULT_AUTO_SCAN_NUMBER;
-
- private:
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "PauseOnFirstModel.hpp"
-
-PauseOnFirstModel::PauseOnFirstModel()
-{
- stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>("db/setting/accessibility/universal-switch/PAUSE_ON_FIRST_ELEMENT_ENABLED", false, [this](auto val) {
- this->state_ = val;
- });
-
- state_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/PAUSE_ON_FIRST_ELEMENT_ENABLED", val);
- });
-
- valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>("db/setting/accessibility/universal-switch/PAUSE_ON_FIRST_ELEMENT_TIME", 1, [this](auto val) {
- this->value_ = val;
- });
-
- value_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/PAUSE_ON_FIRST_ELEMENT_TIME", val);
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef PAUSE_ON_FIRST_MODEL_HPP_
-#define PAUSE_ON_FIRST_MODEL_HPP_
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class PauseOnFirstModel
-{
- public:
- PauseOnFirstModel();
- ObservableProperty<bool> state_;
- ObservableProperty<double> value_;
-
- const utils::Range<double> range_ = {0.1, 5.0};
- const double step_ = 0.1;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "PointScanSpeedModel.hpp"
-#include "Singleton.hpp"
-
-PointScanSpeedModel::PointScanSpeedModel()
-{
- valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<int>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_PT_SPEED, DEFAULT_SCAN_PT_SPEED, [this](auto val) {
- this->value_ = val;
- });
-
- value_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_PT_SPEED, val);
- });
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef POINT_SCAN_SPEED_MODEL_HPP_
-#define POINT_SCAN_SPEED_MODEL_HPP_
-
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchConstants.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class PointScanSpeedModel
-{
- public:
- PointScanSpeedModel();
- ObservableProperty<int> value_;
-
- const utils::Range<double> range_ = {RANGE_MIN_SCAN_SPEED, RANGE_MAX_SCAN_SPEED};
- const double step_ = STEP_SCAN_SPEED;
- const double defaultValue_ = DEFAULT_SCAN_PT_SPEED;
-
- private:
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "RemoveSwitchesModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-RemoveSwitchesModel::RemoveSwitchesModel()
-{
- isUniversalSwitchActiveHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE, false, [this](auto val) {
- this->isUniversalSwitchActive_ = val;
- });
-
- isUniversalSwitchActive_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE, val);
- });
-}
-
-void RemoveSwitchesModel::removeSwitches(std::vector<std::string> &switchesIds)
-{
- auto dBusClient_ = DBus::DBusClient(BUS, PATH, IFACE, DBus::ConnectionType::SESSION);
- for (auto &s : switchesIds) {
- DEBUG("removing: %s", s.c_str());
- dBusClient_.method<void(std::string)>("removeSwitchConfigurationItem").call(s);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef REMOVE_SWITCHES_MODEL_HPP
-#define REMOVE_SWITCHES_MODEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-
-class RemoveSwitchesModel
-{
- public:
- RemoveSwitchesModel();
- ObservableProperty<bool> isUniversalSwitchActive_;
- void removeSwitches(std::vector<std::string> &switchesIds);
-
- private:
- VConfInterface::CallbackHandle isUniversalSwitchActiveHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ScanDirectionModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-ScanDirectionModel::ScanDirectionModel()
-{
- vconfHandle_ = Singleton<VConfInterface>::instance().registerAndGet<int>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_DIR_VERTICAL,
- static_cast<int>(DEFAULT_SCAN_DIR),
- [this](auto value) {
- this->direction_ = static_cast<ScanDirection>(value);
- });
-
- direction_.attach([this](auto value) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_DIR_VERTICAL, static_cast<int>(value));
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SCAN_DIRECTION_MODEL_HPP
-#define SCAN_DIRECTION_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-class ScanDirectionModel
-{
- public:
- ScanDirectionModel();
- ObservableProperty<ScanDirection> direction_;
-
- private:
- VConfInterface::CallbackHandle vconfHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ScanMethodModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-ScanMethodModel::ScanMethodModel()
-{
- vconfHandle_ = Singleton<VConfInterface>::instance().registerAndGet<int>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_METHOD,
- static_cast<int>(DEFAULT_SCAN_METHOD),
- [this](auto value) {
- this->method_ = static_cast<ScanMethod>(value);
- });
-
- method_.attach([this](auto value) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_METHOD, static_cast<int>(value));
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SCAN_METHOD_MODEL_HPP
-#define SCAN_METHOD_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-class ScanMethodModel
-{
- public:
- ScanMethodModel();
- ObservableProperty<ScanMethod> method_;
-
- private:
- VConfInterface::CallbackHandle vconfHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SelectActionPageModel.hpp"
-
-#include "DBus.hpp"
-#include "UniversalSwitchConstants.hpp"
-
-std::vector<InfoType> SelectActionPageModel::getBindableActivityTypes()
-{
- std::vector<InfoType> bindableActivities{};
- auto dBusClient = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION};
- auto reply = dBusClient.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>()>("getBindableActivityTypes").call();
- if (reply) {
- for (auto activity : std::get<0>(reply))
- bindableActivities.push_back(InfoType{std::get<0>(activity), std::get<1>(activity), std::get<2>(activity)});
- } else {
- ERROR("Error on function getBindableActivityTypes call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return bindableActivities;
-}
-
-void SelectActionPageModel::updateSwitch(const SwitchConfigurationItem &item)
-{
- auto dBusClient = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION};
- auto reply = dBusClient.method<DBus::ValueOrError<>(std::string, std::string, std::string)>("updateSwitchConfigurationItem").call(item.switchId, item.userName, item.activityType);
- if (reply)
- DEBUG("Switch: %s updated successfully", item.switchId.c_str());
- else {
- ERROR("Error on function updateSwitchConfigurationItem call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
-
-void SelectActionPageModel::addSwitch(const SwitchConfigurationItem &item)
-{
- auto dBusClient = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION};
- auto reply = dBusClient.method<DBus::ValueOrError<>(std::string, std::string, std::string)>("addSwitchConfigurationItem").call(item.switchId, item.userName, item.activityType);
- if (reply)
- DEBUG("Switch: %s added successfully", item.switchId.c_str());
- else {
- ERROR("Error on function addSwitchConfigurationItem call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SELECT_ACTION_PAGE_MODEL_HPP
-#define SELECT_ACTION_PAGE_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-class SelectActionPageModel
-{
- public:
- std::vector<InfoType> getBindableActivityTypes();
- void updateSwitch(const SwitchConfigurationItem &item);
- void addSwitch(const SwitchConfigurationItem &item);
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SingleInteractionIntervalModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-SingleInteractionIntervalModel::SingleInteractionIntervalModel()
-{
- stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_STATE, defaultState_, [this](auto val) {
- this->state_ = val;
- });
-
- state_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_STATE, val);
- });
-
- valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_VALUE, defaultValue_, [this](auto val) {
- this->value_ = val;
- });
-
- value_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_VALUE, val);
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SINGLE_INTERACTION_INTERVAL_HPP_
-#define SINGLE_INTERACTION_INTERVAL_HPP_
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class SingleInteractionIntervalModel
-{
- public:
- SingleInteractionIntervalModel();
- ObservableProperty<bool> state_;
- ObservableProperty<double> value_;
-
- const utils::Range<double> range_ = {0.1, 2.5};
-
- const double step_ = 0.1;
- const double defaultValue_ = 1.0;
-
- const bool defaultState_ = false;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SoundModel.hpp"
-
-SoundModel::SoundModel()
-{
- stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>("db/setting/accessibility/universal-switch/FEEDBACK_SOUND_ENABLED", false, [this](auto val) {
- this->state_ = val;
- });
-
- state_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/FEEDBACK_SOUND_ENABLED", val);
- });
-
- valueHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>("db/setting/accessibility/universal-switch/FEEDBACK_SOUND_VOLUME", 1.0, [this](auto val) {
- this->value_ = val;
- });
-
- value_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/FEEDBACK_SOUND_VOLUME", val);
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SOUND_MODEL_HPP
-#define SOUND_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-
-class SoundModel
-{
- public:
- SoundModel();
-
- ObservableProperty<bool> state_;
- ObservableProperty<double> value_;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SwitchesPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-SwitchesPageModel::SwitchesPageModel()
-{
- dBusClient_ = DBus::DBusClient(BUS, PATH, IFACE, DBus::ConnectionType::SESSION);
- dBusClient_.addSignal<void()>(std::string{"switchesConfigurationChanged"}, [this]() {
- this->switchesConfigurationChanged_ = std::chrono::system_clock::now();
- });
- synchronizeBindableActivities();
-}
-
-std::vector<SwitchConfigurationItem> SwitchesPageModel::getAllSwitchConfigurationItems()
-{
- std::vector<SwitchConfigurationItem> configurationItems{};
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string, ChangeType>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- for (auto item : std::get<0>(reply))
- configurationItems.push_back(SwitchConfigurationItem{std::get<0>(item), std::get<1>(item), std::get<2>(item)});
- } else {
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return configurationItems;
-}
-
-std::string SwitchesPageModel::getActivityName(std::string activityType)
-{
- for (auto activity : bindableActivities_)
- if (activity.id == activityType)
- return activity.name;
- return {};
-}
-
-void SwitchesPageModel::synchronizeBindableActivities()
-{
- bindableActivities_.clear();
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>()>("getBindableActivityTypes").call();
- if (reply) {
- for (auto activity : std::get<0>(reply))
- bindableActivities_.push_back(InfoType{std::get<0>(activity), std::get<1>(activity), std::get<2>(activity)});
- } else {
- ERROR("Error on function getBindableActivityTypes call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SWITCHES_PAGE_MODEL_HPP
-#define SWITCHES_PAGE_MODEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-#include <chrono>
-
-class SwitchesPageModel
-{
- public:
- SwitchesPageModel();
- ObservableProperty<std::chrono::system_clock::time_point> switchesConfigurationChanged_;
- std::vector<SwitchConfigurationItem> getAllSwitchConfigurationItems();
- std::string getActivityName(std::string activityType);
-
- private:
- void synchronizeBindableActivities();
- std::vector<InfoType> bindableActivities_;
- DBus::DBusClient dBusClient_;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TapDurationModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-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
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#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 defaultState_ = false;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle valueHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UniversalSwitchPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-UniversalSwitchPageModel::UniversalSwitchPageModel()
-{
- connectionPtr_ = DBus::getDBusConnectionByType(DBus::ConnectionType::SESSION);
- sentinel_ = Singleton<UniversalSwitchSentinelService>::instance().getSentinel();
- sentinel_->setConfigurationServiceState(true);
-}
-
-bool UniversalSwitchPageModel::atLeastOneSwitchConfigured()
-{
- DBus::DBusClient client{BUS, PATH, IFACE, connectionPtr_};
- auto reply = client.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string, int32_t>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- return std::get<0>(reply).size() > 0;
- }
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- return false;
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_PAGE_MODEL_HPP
-#define UNIVERSAL_SWITCH_PAGE_MODEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchSentinel.hpp"
-#include "VConf.hpp"
-
-class UniversalSwitchPageModel
-{
- public:
- UniversalSwitchPageModel();
- bool atLeastOneSwitchConfigured();
- UniversalSwitchSentinel sentinel_;
-
- private:
- DBus::DBusWrapper::ConnectionPtr connectionPtr_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UniversalSwitchSettingsPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-UniversalSwitchSettingsPageModel::UniversalSwitchSettingsPageModel()
-{
- synchronizePropertyWithVConf(autoTapKeyboardState_, VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_KBD_STATE, DEFAULT_AUTO_TAP_KEYBOARD_STATE);
-
- sentinel_ = Singleton<UniversalSwitchSentinelService>::instance().getSentinel();
- sentinel_->setConfigurationServiceState(true);
- sentinel_->configurationServiceState_.attach([this](auto val) {
- this->initDbusClient();
- });
-
- if (sentinel_->configurationServiceState_.value())
- initDbusClient();
-}
-
-void UniversalSwitchSettingsPageModel::initDbusClient()
-{
- connectionPtr_ = DBus::getDBusConnectionByType(DBus::ConnectionType::SESSION);
- dBusClient_ = DBus::DBusClient{BUS, PATH, IFACE, connectionPtr_};
-
- dBusClient_.addSignal<void()>(std::string{"switchesConfigurationChanged"}, [this]() {
- getConfiguredSwitchesCount();
- });
- getConfiguredSwitchesCount();
-}
-
-void UniversalSwitchSettingsPageModel::getConfiguredSwitchesCount()
-{
- auto reply = dBusClient_.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string, int32_t>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- configuredSwitchesCount_ = std::get<0>(reply).size();
- } else {
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_SETTINGS_PAGE_MODEL_HPP
-#define UNIVERSAL_SWITCH_SETTINGS_PAGE_MODEL_HPP
-
-#include "DBus.hpp"
-#include "Geometry.hpp"
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchSentinel.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-class UniversalSwitchSettingsPageModel
-{
- public:
- UniversalSwitchSettingsPageModel();
-
- ObservableProperty<int> configuredSwitchesCount_;
- ObservableProperty<bool> autoTapKeyboardState_;
- UniversalSwitchSentinel sentinel_;
-
- private:
- template <typename T>
- void synchronizePropertyWithVConf(ObservableProperty<T> &property, const std::string &vconfKey, T defaultValue)
- {
- vconfHandles_.push_back(Singleton<VConfInterface>::instance().registerAndGet<T>(
- vconfKey,
- defaultValue,
- [&property](auto value) {
- property = value;
- }));
-
- property.attach([this, vconfKey](auto newValue) {
- Singleton<VConfInterface>::instance().set(vconfKey, newValue);
- });
- }
- std::vector<VConfInterface::CallbackHandle> vconfHandles_;
- DBus::DBusWrapper::ConnectionPtr connectionPtr_;
- DBus::DBusClient dBusClient_;
- void initDbusClient();
- void getConfiguredSwitchesCount();
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UpdateAccessoriesSwitchPageModel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-UpdateAccessoriesSwitchPageModel::UpdateAccessoriesSwitchPageModel()
-{
-}
-
-SwitchConfigurationItem UpdateAccessoriesSwitchPageModel::getDetailsForSwitchConfigurationItem(const std::string &switchId)
-{
- auto reply = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION}.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>()>("getAllSwitchConfigurationItems").call();
- if (reply) {
- for (auto &item : std::get<0>(reply))
- if (std::get<0>(item) == switchId)
- return SwitchConfigurationItem{std::get<0>(item), std::get<1>(item), std::get<2>(item)};
- } else {
- ERROR("Error on function getAllSwitchConfigurationItems call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return {};
-}
-
-InfoType UpdateAccessoriesSwitchPageModel::getActivityDetails(const std::string &activityId)
-{
- auto dBusClient = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION};
- auto reply = dBusClient.method<DBus::ValueOrError<std::vector<std::tuple<std::string, std::string, std::string>>>()>("getBindableActivityTypes").call();
- if (reply) {
- for (auto &activity : std::get<0>(reply))
- if (std::get<0>(activity) == activityId)
- return InfoType{std::get<0>(activity), std::get<1>(activity), std::get<2>(activity)};
- } else {
- ERROR("Error on function getBindableActivityTypes call");
- ERROR("%s", reply.getError().message.c_str());
- }
- return {};
-}
-
-void UpdateAccessoriesSwitchPageModel::updateSwitch(const SwitchConfigurationItem &item)
-{
- auto dBusClient = DBus::DBusClient{BUS, PATH, IFACE, DBus::ConnectionType::SESSION};
- auto reply = dBusClient.method<DBus::ValueOrError<>(std::string, std::string, std::string)>("updateSwitchConfigurationItem").call(item.switchId, item.userName, item.activityType);
- if (reply)
- DEBUG("Switch: %s updated successfully", item.switchId.c_str());
- else {
- ERROR("Error on function updateSwitchConfigurationItem call");
- ERROR("%s", reply.getError().message.c_str());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UPDATE_ACCESSORIES_SWITCH_PAGE_MODEL_HPP
-#define UPDATE_ACCESSORIES_SWITCH_PAGE_MODEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VConf.hpp"
-
-#include <chrono>
-
-class UpdateAccessoriesSwitchPageModel
-{
- public:
- UpdateAccessoriesSwitchPageModel();
- SwitchConfigurationItem getDetailsForSwitchConfigurationItem(const std::string &switchId);
- InfoType getActivityDetails(const std::string &actionId);
- void updateSwitch(const SwitchConfigurationItem &item);
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "VoiceModel.hpp"
-
-VoiceModel::VoiceModel()
-{
- stateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>("db/setting/accessibility/universal-switch/FEEDBACK_VOICE_ENABLED", false, [this](auto val) {
- this->state_ = val;
- });
-
- state_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/FEEDBACK_VOICE_ENABLED", val);
- });
-
- rateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<int>("db/setting/accessibility/universal-switch/FEEDBACK_VOICE_SPEECH_RATE", 7, [this](auto val) {
- this->rate_ = utils::rescale<int, double>(val, utils::Range<int>{0, 15}, this->range_);
- });
-
- rate_.attach([this](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/FEEDBACK_VOICE_SPEECH_RATE", utils::rescale<double, int>(val, this->range_, utils::Range<int>{0, 15}));
- });
-
- volumeHandle_ = Singleton<VConfInterface>::instance().registerAndGet<double>("db/setting/accessibility/universal-switch/FEEDBACK_VOICE_SPEECH_VOLUME", 1.0, [this](auto val) {
- this->volume_ = val;
- });
-
- volume_.attach([](auto val) {
- Singleton<VConfInterface>::instance().set("db/setting/accessibility/universal-switch/FEEDBACK_VOICE_SPEECH_VOLUME", val);
- });
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef VOICE_MODEL_HPP
-#define VOICE_MODEL_HPP
-
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-#include "utils.hpp"
-
-class VoiceModel
-{
- public:
- VoiceModel();
-
- const utils::Range<double> range_ = {0.0, 1.0};
- const double step_ = 0.1;
-
- ObservableProperty<bool> state_;
- ObservableProperty<double> rate_;
- ObservableProperty<double> volume_;
-
- private:
- VConfInterface::CallbackHandle stateHandle_;
- VConfInterface::CallbackHandle rateHandle_;
- VConfInterface::CallbackHandle volumeHandle_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AddAccessoriesSwitchesPagePresenter.hpp"
-
-#include "AlreadyMappedSwitchModalPresenter.hpp"
-#include "AppContext.hpp"
-#include "EntryNameModalPresenter.hpp"
-#include "Singleton.hpp"
-#include "UniversalSwitchConstants.hpp"
-
-AddAccessoriesSwitchesPagePresenter::AddAccessoriesSwitchesPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_TITLE");
- labelText_ = "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_DESC";
-}
-
-void AddAccessoriesSwitchesPagePresenter::onTop()
-{
- model_.captureSwitch([this](auto switchId) {
- this->onSwitchCapture(switchId);
- },
- ACCESSIBILITY_UNIVERSAL_SWITCH_ACCESSORIES_SWITCH_PROVIDER);
-}
-
-void AddAccessoriesSwitchesPagePresenter::notOnTop()
-{
- model_.cancelCaptureSwitch();
-}
-
-void AddAccessoriesSwitchesPagePresenter::onSwitchCapture(const std::string &switchId)
-{
- notOnTop();
- if (model_.isConfigured(switchId))
- Singleton<AppContext>::instance().pushModal(std::make_unique<AlreadyMappedSwitchModalPresenter>());
- else
- Singleton<AppContext>::instance().pushModal(std::make_unique<EntryNameModalPresenter>(switchId));
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ADD_ACCESSORIES_SWITCHES_PAGE_PRESENTER
-#define ADD_ACCESSORIES_SWITCHES_PAGE_PRESENTER
-
-#include "AddAccessoriesSwitchesPageModel.hpp"
-#include "LabelPresenter.hpp"
-
-class AddAccessoriesSwitchesPagePresenter : public LabelPresenter
-{
- public:
- AddAccessoriesSwitchesPagePresenter();
-
- private:
- void onTop() override;
- void notOnTop() override;
- void onSwitchCapture(const std::string &switchId);
- AddAccessoriesSwitchesPageModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AddSwitchPagePresenter.hpp"
-
-#include "AddAccessoriesSwitchesPagePresenter.hpp"
-#include "AppContext.hpp"
-#include "CameraSwitchesPagePresenter.hpp"
-#include "SelectActionPagePresenter.hpp"
-#include "UniversalSwitchConstants.hpp"
-
-AddSwitchPagePresenter::AddSwitchPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES");
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
- for (auto &provider : model_.getProviders()) {
- items.push_back(std::make_unique<ListItem>(
- provider.name,
- provider.description,
- [=](auto item) {
- this->createPageForProvider(provider);
- }));
- }
- auto onConfigurationChange = [this](auto changeTime) {
- auto providers = this->model_.getProviders();
- auto size = providers.size();
- for (auto i = 0u; i < size; ++i)
- this->groups_.back().items_[i]->enabled_ = !this->model_.areAllSwitchesConfigured(providers[i]);
- };
- model_.switchesConfigurationChanged_.attach(onConfigurationChange);
- onConfigurationChange(std::chrono::system_clock::now());
-}
-
-void AddSwitchPagePresenter::createPageForProvider(const InfoType &provider)
-{
- if (provider.id == ACCESSIBILITY_UNIVERSAL_SWITCH_SCREEN_SWITCH_PROVIDER) {
- createPageForScreenProvider();
- return;
- }
- if (provider.id == ACCESSIBILITY_UNIVERSAL_SWITCH_ACCESSORIES_SWITCH_PROVIDER) {
- createPageForAccessoriesProvider();
- return;
- }
- if (provider.id == ACCESSIBILITY_UNIVERSAL_SWITCH_CAMERA_SWITCH_PROVIDER) {
- createPageForCameraProvider();
- return;
- }
-}
-
-void AddSwitchPagePresenter::createPageForScreenProvider()
-{
- auto switches = model_.getAllSwitchesByProviderId(ACCESSIBILITY_UNIVERSAL_SWITCH_SCREEN_SWITCH_PROVIDER);
- if (switches.size() != 1)
- return;
- auto screenSwitch = switches[0];
- Singleton<AppContext>::instance().push(std::make_unique<SelectActionPagePresenter>(screenSwitch.id, ACCESSIBILITY_UNIVERSAL_SWITCH_SCREEN, ChangeType::ADD, 1));
-}
-
-void AddSwitchPagePresenter::createPageForAccessoriesProvider()
-{
- Singleton<AppContext>::instance().push(std::make_unique<AddAccessoriesSwitchesPagePresenter>());
-}
-
-void AddSwitchPagePresenter::createPageForCameraProvider()
-{
- Singleton<AppContext>::instance().push(std::make_unique<CameraSwitchesPagePresenter>());
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ADD_SWITCH_PAGE_PRESENTER_HPP
-#define ADD_SWITCH_PAGE_PRESENTER_HPP
-
-#include "AddSwitchPageModel.hpp"
-#include "ListPresenter.hpp"
-#include "UniversalSwitchTypes.hpp"
-
-class AddSwitchPagePresenter : public ListPresenter
-{
- public:
- AddSwitchPagePresenter();
-
- private:
- AddSwitchPageModel model_;
- void createPageForProvider(const InfoType &provider);
- void createPageForScreenProvider();
- void createPageForAccessoriesProvider();
- void createPageForCameraProvider();
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AlreadyMappedSwitchModalPresenter.hpp"
-
-#include "AppContext.hpp"
-#include "Singleton.hpp"
-
-AlreadyMappedSwitchModalPresenter::AlreadyMappedSwitchModalPresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_UNABLE_TO_ADD");
- text_ = "IDS_ACCS_UNIVERSAL_SWITCH_ALREADY_ADDED";
- addAction(std::make_unique<Action>("doneAction", "IDS_ACCS_UNIVERSAL_SWITCH_OK", [](auto action) {
- Singleton<AppContext>::instance().popModal();
- }));
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ALREADY_MAPPED_SWITCH_MODAL_PRESENTER
-#define ALREADY_MAPPED_SWITCH_MODAL_PRESENTER
-
-#include "ModalPresenter.hpp"
-
-class AlreadyMappedSwitchModalPresenter : public ModalPresenter
-{
- public:
- AlreadyMappedSwitchModalPresenter();
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AutoMoveIntervalPresenter.hpp"
-
-AutoMoveIntervalPresenter::AutoMoveIntervalPresenter()
- : SpinnerPresenterWithToggle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT")
-{
- 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> AutoMoveIntervalPresenter::getRange()
-{
- return model_.range_;
-}
-
-double AutoMoveIntervalPresenter::getStep()
-{
- return model_.step_;
-}
-
-std::string AutoMoveIntervalPresenter::getFormat()
-{
- return "%1.1f seconds";
-}
-
-std::string AutoMoveIntervalPresenter::getLabel()
-{
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT";
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef AUTO_MOVE_INTERVAL_PRESENTER_HPP_
-#define AUTO_MOVE_INTERVAL_PRESENTER_HPP_
-
-#include "AutoMoveIntervalModel.hpp"
-#include "SpinnerPresenterWithToggle.hpp"
-
-class AutoMoveIntervalPresenter : public SpinnerPresenterWithToggle
-{
- public:
- AutoMoveIntervalPresenter();
-
- utils::Range<double> getRange() override;
- double getStep() override;
- std::string getLabel() override;
- std::string getFormat() override;
-
- private:
- AutoMoveIntervalModel model_;
-};
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AutoScanIntervalPresenter.hpp"
-
-AutoScanIntervalPresenter::AutoScanIntervalPresenter()
- : SpinnerPresenter("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_AUTO_SCAN_INT")
-{
- value_ = model_.interval_;
- value_.attach([this](auto val) {
- model_.interval_ = val;
- });
-}
-
-utils::Range<double> AutoScanIntervalPresenter::getRange()
-{
- return model_.range_;
-}
-
-double AutoScanIntervalPresenter::getStep()
-{
- return model_.step_;
-}
-
-std::string AutoScanIntervalPresenter::getLabel()
-{
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_AUTO_SCAN_INT";
-}
-
-std::string AutoScanIntervalPresenter::getFormat()
-{
- return "%1.1f seconds";
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef AUTO_SCAN_INTERVAL_PRESENTER
-#define AUTO_SCAN_INTERVAL_PRESENTER
-
-#include "AutoScanModel.hpp"
-#include "SpinnerPresenter.hpp"
-
-class AutoScanIntervalPresenter : public SpinnerPresenter
-{
- public:
- AutoScanIntervalPresenter();
- utils::Range<double> getRange() override;
- double getStep() override;
- std::string getLabel() override;
- std::string getFormat() override;
-
- private:
- AutoScanModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#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_;
-}
-
-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
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef AUTO_TAP_PRESENTER_HPP_
-#define AUTO_TAP_PRESENTER_HPP_
-
-#include "AutoTapModel.hpp"
-#include "SpinnerPresenterWithToggle.hpp"
-
-class AutoTapPresenter : public SpinnerPresenterWithToggle
-{
- public:
- AutoTapPresenter();
-
- utils::Range<double> getRange() override;
- double getStep() override;
- std::string getLabel() override;
- std::string getFormat() override;
-
- private:
- AutoTapModel model_;
-};
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "CameraSwitchesPagePresenter.hpp"
-
-#include "AppContext.hpp"
-#include "SelectActionPagePresenter.hpp"
-#include "UniversalSwitchConstants.hpp"
-
-CameraSwitchesPagePresenter::CameraSwitchesPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_TITLE");
- groups_.emplace_back("");
- groups_.back().items_.push_back(std::make_unique<ListItem>(
- std::string{},
- "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_COMMENT"));
-
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_GROUP_HEAD");
- auto &items = groups_.back().items_;
- for (auto &aSwitch : model_.getAllSwitchesByProvider(ACCESSIBILITY_UNIVERSAL_SWITCH_CAMERA_SWITCH_PROVIDER)) {
- items.push_back(std::make_unique<ListItem>(
- aSwitch.name,
- aSwitch.description,
- [=](auto item) {
- this->createSelectActionPageForSwitch(aSwitch);
- }));
- items.back()->enabled_ = !model_.isSwitchConfigured(aSwitch.id);
- }
-}
-
-void CameraSwitchesPagePresenter::createSelectActionPageForSwitch(const InfoType &aSwitch)
-{
- Singleton<AppContext>::instance().push(std::make_unique<SelectActionPagePresenter>(aSwitch.id, aSwitch.name, ChangeType::ADD, 2));
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef CAMERA_SWITCHES_PAGE_PRESENTER_HPP
-#define CAMERA_SWITCHES_PAGE_PRESENTER_HPP
-
-#include "CameraSwitchesPageModel.hpp"
-#include "ListPresenter.hpp"
-
-class CameraSwitchesPagePresenter : public ListPresenter
-{
- public:
- CameraSwitchesPagePresenter();
-
- private:
- CameraSwitchesPageModel model_;
- void createSelectActionPageForSwitch(const InfoType &aSwitch);
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "CursorColorPagePresenter.hpp"
-
-#include "AppContext.hpp"
-
-CursorColorPagePresenter::CursorColorPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL");
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
- for (auto color : colors_) {
- items.push_back(std::make_unique<ListItem>(
- model_.getColorText(color),
- std::string{},
- [this, color](auto item) {
- this->model_.cursorColor_ = color;
- Singleton<AppContext>::instance().pop();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- color == model_.cursorColor_.value()));
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef CURSOR_COLOR_PAGE_PRESENTER_HPP
-#define CURSOR_COLOR_PAGE_PRESENTER_HPP
-
-#include "CursorColorModel.hpp"
-#include "ListPresenter.hpp"
-
-#include <vector>
-
-class CursorColorPagePresenter : public ListPresenter
-{
- public:
- CursorColorPagePresenter();
-
- private:
- CursorColorModel model_;
- std::vector<Color> colors_ = {
- Color::RED,
- Color::ORANGE,
- Color::YELLOW,
- Color::GREEN,
- Color::BLUE,
- Color::GRAY};
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "EntryNameModalPresenter.hpp"
-
-#include "AppContext.hpp"
-#include "SelectActionPagePresenter.hpp"
-#include "Singleton.hpp"
-
-EntryNameModalPresenter::EntryNameModalPresenter(std::string switchId)
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH");
- entryAction_ = addAction(std::make_unique<Action>("modalEntry", "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_NAME", [this](auto action) {
- doneAction_->enabled_ = !entryAction_->title_.value().empty();
- }));
-
- addAction(std::make_unique<Action>("cancelAction", "IDS_ACCS_UNIVERSAL_SWITCH_CANCEL", std::function<void(Action *)>{}));
- doneAction_ = addAction(std::make_unique<Action>("doneAction", "IDS_ACCS_UNIVERSAL_SWITCH_SAVE", [this, switchId](auto action) {
- auto switchUserName = this->entryAction_->title_.value();
- Singleton<AppContext>::instance().popModal();
- Singleton<AppContext>::instance().push(std::make_unique<SelectActionPagePresenter>(switchId, switchUserName, ChangeType::ADD, 2));
- },
- false));
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ENTRY_NAME_MODAL_PRESENTER_HPP
-#define ENTRY_NAME_MODAL_PRESENTER_HPP
-
-#include "ModalPresenter.hpp"
-
-class EntryNameModalPresenter : public ModalPresenter
-{
- public:
- EntryNameModalPresenter(std::string switchId);
-
- private:
- Action *entryAction_ = nullptr;
- Action *doneAction_ = nullptr;
-};
-
-#endif
\ No newline at end of file
std::function<void(ListItem * item)>{},
std::function<void(ListItem * item)>{},
model_.state_.value()));
- groups_.back().items_.push_back(std::make_unique<ListItem>(
- "IDS_ACCS_UNIVERSAL_SWITCH",
- "IDS_ACCS_UNIVERSAL_SWITCH_HINT",
- [this](auto item) { Singleton<AppContext>::instance().push(std::make_unique<UniversalSwitchPagePresenter>()); }));
onPopCallback_ = [this]() {
screenReaderStateHandle_ = {};
#include "ListPresenter.hpp"
#include "ScreenReaderModel.hpp"
-#include "UniversalSwitchPagePresenter.hpp"
#include "VConf.hpp"
class MainPagePresenter : public ListPresenter
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ManageMenuOptionsPagePresenter.hpp"
-
-ManageMenuOptionsPagePresenter::ManageMenuOptionsPagePresenter()
-{
- std::vector<std::pair<std::string, std::string>> titleAndDescription =
- {
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_GESTURES", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_ACTIONS", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_SETTINGS", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_RECENT_APPS", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_HOME_SCREEN", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_BACK", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_BUTTONS_AND_KEYS", ""},
- {"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_CONTEXTUAL_MENU", "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_CONTEXTUAL_MENU_DESC"}};
-
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE");
- groups_.emplace_back("");
-
- for (auto i = 0u; i < ManageMenuOptionsPageModel::ManageMenuOptionsCount; ++i) {
- groups_.back().items_.push_back(std::make_unique<ListItem>(
- titleAndDescription[i].first,
- titleAndDescription[i].second,
- [this, i](auto item) {
- model_.manageMenuOptionStates_[i] = item->widgetState_.value();
- },
- ListItem::WidgetType::toggle,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.manageMenuOptionStates_[i].value()));
- auto item = groups_.back().items_.back().get();
- model_.manageMenuOptionStates_[i].attach([item](auto state) {
- item->widgetState_ = state;
- });
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MANAGE_MENU_OPTIONS_PAGE_PRESENTER_HPP
-#define MANAGE_MENU_OPTIONS_PAGE_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "ManageMenuOptionsPageModel.hpp"
-
-#include <vector>
-
-class ManageMenuOptionsPagePresenter : public ListPresenter
-{
- public:
- ManageMenuOptionsPagePresenter();
-
- private:
- ManageMenuOptionsPageModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "NoSwitchesModalPresenter.hpp"
-
-#include "AddSwitchPagePresenter.hpp"
-#include "AppContext.hpp"
-
-NoSwitchesModalPresenter::NoSwitchesModalPresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_NO_SWITCHES_TITLE");
- text_ = "IDS_ACCS_UNIVERSAL_SWITCH_NO_SWITCHES_TEXT";
-
- addAction(std::make_unique<Action>("cancelAction", "IDS_ACCS_UNIVERSAL_SWITCH_CANCEL", std::function<void(Action *)>{}));
- addAction(std::make_unique<Action>("doneAction", "IDS_ACCS_UNIVERSAL_SWITCH_POPUP_ADD", [this](auto action) {
- Singleton<AppContext>::instance().popModal();
- Singleton<AppContext>::instance().push(std::make_unique<AddSwitchPagePresenter>());
- }));
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef NO_SWITCHES_MODAL_PRESENTER_HPP
-#define NO_SWITCHES_MODAL_PRESENTER_HPP
-
-#include "ModalPresenter.hpp"
-
-class NoSwitchesModalPresenter : public ModalPresenter
-{
- public:
- NoSwitchesModalPresenter();
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "NumberOfAutoScanLoopsPresenter.hpp"
-
-NumberOfAutoScanLoopsPresenter::NumberOfAutoScanLoopsPresenter()
- : SpinnerPresenter("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_NUM_OF_SCANS")
-{
- value_ = model_.value_.value();
- value_.attach([this](auto val) {
- model_.value_ = val;
- });
-}
-
-utils::Range<double> NumberOfAutoScanLoopsPresenter::getRange()
-{
- return model_.range_;
-}
-
-double NumberOfAutoScanLoopsPresenter::getStep()
-{
- return model_.step_;
-}
-
-std::string NumberOfAutoScanLoopsPresenter::getFormat()
-{
- return "%d times";
-}
-
-std::string NumberOfAutoScanLoopsPresenter::getLabel()
-{
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_NUM_OF_SCANS";
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef NUMBER_OF_AUTO_SCAN_LOOPS_PRESENTER_HPP_
-#define NUMBER_OF_AUTO_SCAN_LOOPS_PRESENTER_HPP_
-
-#include "NumberOfAutoScanLoopsModel.hpp"
-#include "SpinnerPresenter.hpp"
-
-class NumberOfAutoScanLoopsPresenter : public SpinnerPresenter
-{
- public:
- NumberOfAutoScanLoopsPresenter();
-
- utils::Range<double> getRange();
- double getStep();
- std::string getFormat();
- std::string getLabel();
-
- private:
- NumberOfAutoScanLoopsModel model_;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "PauseOnFirstPresenter.hpp"
-
-PauseOnFirstPresenter::PauseOnFirstPresenter()
- : SpinnerPresenterWithToggle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_PAUSE_ON_FIRST")
-{
- 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> PauseOnFirstPresenter::getRange()
-{
- return model_.range_;
-}
-
-double PauseOnFirstPresenter::getStep()
-{
- return model_.step_;
-}
-
-std::string PauseOnFirstPresenter::getLabel()
-{
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_PAUSE_ON_FIRST";
-}
-
-std::string PauseOnFirstPresenter::getFormat()
-{
- return "%1.1f seconds";
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef PAUSE_ON_FIRST_PRESENTER_HPP_
-#define PAUSE_ON_FIRST_PRESENTER_HPP_
-
-#include "PauseOnFirstModel.hpp"
-#include "SpinnerPresenterWithToggle.hpp"
-
-class PauseOnFirstPresenter : public SpinnerPresenterWithToggle
-{
- public:
- PauseOnFirstPresenter();
-
- utils::Range<double> getRange() override;
- double getStep() override;
- std::string getLabel() override;
- std::string getFormat() override;
-
- private:
- PauseOnFirstModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "PointScanSpeedPresenter.hpp"
-
-PointScanSpeedPresenter::PointScanSpeedPresenter()
- : SpinnerPresenter("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_PT_SPEED")
-{
- value_ = model_.value_.value();
- value_.attach([this](auto val) {
- model_.value_ = val;
- });
-}
-
-utils::Range<double> PointScanSpeedPresenter::getRange()
-{
- return model_.range_;
-}
-
-double PointScanSpeedPresenter::getStep()
-{
- return model_.step_;
-}
-
-std::string PointScanSpeedPresenter::getFormat()
-{
- return "%d";
-}
-
-std::string PointScanSpeedPresenter::getLabel()
-{
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_SCAN_SPEED";
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef POINT_SCAN_SPEED_PRESENTER_HPP_
-#define POINT_SCAN_SPEED_PRESENTER_HPP_
-
-#include "PointScanSpeedModel.hpp"
-#include "SpinnerPresenter.hpp"
-
-class PointScanSpeedPresenter : public SpinnerPresenter
-{
- public:
- PointScanSpeedPresenter();
-
- utils::Range<double> getRange() override;
- double getStep() override;
- std::string getFormat() override;
- std::string getLabel() override;
-
- private:
- PointScanSpeedModel model_;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "RemoveSwitchesModalPresenter.hpp"
-
-#include "AppContext.hpp"
-
-RemoveSwitchesModalPresenter::RemoveSwitchesModalPresenter(std::vector<SwitchConfigurationItem> switches, std::vector<std::string> switchesToRemove)
- : switches_(std::move(switches)), switchesToRemove_(std::move(switchesToRemove))
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES");
-
- if (switchesToRemove_.size() == switches_.size() && model_.isUniversalSwitchActive_.value()) {
- text_ = "IDS_ACCS_UNIVERSAL_SWITCH_DELETE_ALL_SWITCHES_DESC";
- } else {
- text_ = std::to_string(switchesToRemove_.size()) + " " + TranslatedString{"IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES_DESC"}.str();
- }
-
- addAction(std::make_unique<Action>("cancelAction", "IDS_ST_BUTTON_CANCEL", std::function<void(Action *)>{}));
- addAction(std::make_unique<Action>("doneAction", "IDS_ACCS_DELETE", [this](auto action) {
- model_.removeSwitches(switchesToRemove_);
- Singleton<AppContext>::instance().popModal();
- Singleton<AppContext>::instance().pop();
- }));
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef REMOVE_SWITCHES_MODAL_PRESENTER_HPP
-#define REMOVE_SWITCHES_MODAL_PRESENTER_HPP
-
-#include "ModalPresenter.hpp"
-#include "RemoveSwitchesModel.hpp"
-#include "UniversalSwitchTypes.hpp"
-
-class RemoveSwitchesModalPresenter : public ModalPresenter
-{
- public:
- RemoveSwitchesModalPresenter(std::vector<SwitchConfigurationItem> switches, std::vector<std::string> switchesToRemove);
-
- private:
- RemoveSwitchesModel model_;
- std::vector<SwitchConfigurationItem> switches_;
- std::vector<std::string> switchesToRemove_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "RemoveSwitchesPagePresenter.hpp"
-
-#include "AppContext.hpp"
-#include "RemoveSwitchesModalPresenter.hpp"
-
-RemoveSwitchesPagePresenter::RemoveSwitchesPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES");
- groups_.emplace_back("");
-
- deleteAction_ = addAction(std::make_unique<Action>("titleRightAction", "IDS_ACCS_DELETE_CAPS", [this](auto action) {
- std::vector<std::string> toRemove;
- for (auto i = 0u; i < groups_[0].items_.size(); ++i) {
- if (groups_[0].items_[i]->widgetState_.value())
- toRemove.push_back(switches_[i].switchId);
- }
-
- Singleton<AppContext>::instance().pushModal(std::make_unique<RemoveSwitchesModalPresenter>(switches_, toRemove));
- },
- false));
-
- selectAllAction_ = addAction(std::make_unique<Action>("selectAll", std::string{}, [this](auto action) {
- if (!changeAllSelectedItems_) {
- changeAllSelectedItems_ = true;
- return;
- }
-
- for (auto &it : groups_[0].items_) {
- it->widgetState_ = action->state_.value();
- }
- selectedNo_ = action->state_.value() ? groups_[0].items_.size() : 0;
-
- if (selectedNo_ == 0)
- deleteAction_->enabled_ = false;
- else
- deleteAction_->enabled_ = true;
- },
- true));
-
- addItemsToList();
- model_.switchesConfigurationChanged_.attach([this](auto timeStamp) {
- groups_.back().items_.clear();
- this->addItemsToList();
- if (this->onListUpdate_)
- this->onListUpdate_();
- });
-}
-
-void RemoveSwitchesPagePresenter::addItemsToList()
-{
- auto &items = groups_.back().items_;
- switches_ = model_.getAllSwitchConfigurationItems();
- for (auto oneSwitch : switches_) {
- items.push_back(std::make_unique<ListItem>(
- oneSwitch.userName,
- model_.getActivityName(oneSwitch.activityType),
- [this](auto item) {
- if (item->widgetState_.value())
- ++selectedNo_;
- else
- --selectedNo_;
-
- if (selectedNo_ == groups_[0].items_.size() && !selectAllAction_->state_.value()) {
- changeAllSelectedItems_ = false;
- selectAllAction_->state_ = true;
- } else if (selectedNo_ < groups_[0].items_.size() && selectAllAction_->state_.value()) {
- changeAllSelectedItems_ = false;
- selectAllAction_->state_ = false;
- }
- if (selectedNo_ == 0)
- deleteAction_->enabled_ = false;
- else
- deleteAction_->enabled_ = true;
- },
- ListItem::WidgetType::check));
- }
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef REMOVE_SWITCHES_PAGE_PRESENTER_HPP
-#define REMOVE_SWITCHES_PAGE_PRESENTER_HPP
-
-#include "Action.hpp"
-#include "ListPresenter.hpp"
-#include "SwitchesPageModel.hpp"
-
-class RemoveSwitchesPagePresenter : public ListPresenter
-{
- public:
- RemoveSwitchesPagePresenter();
-
- private:
- SwitchesPageModel model_;
- void addItemsToList();
-
- Action *deleteAction_ = nullptr;
- Action *selectAllAction_ = nullptr;
- std::vector<SwitchConfigurationItem> switches_;
- size_t selectedNo_ = 0;
- bool changeAllSelectedItems_ = true;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ScanDirectionPresenter.hpp"
-
-#include "AppContext.hpp"
-
-ScanDirectionPresenter::ScanDirectionPresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR");
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
- for (auto direction : directions_) {
- items.push_back(std::make_unique<ListItem>(
- scanDirectionToString(direction),
- std::string{},
- [this, direction](auto item) {
- this->model_.direction_ = direction;
- Singleton<AppContext>::instance().pop();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- direction == model_.direction_.value()));
- }
-}
-
-std::string ScanDirectionPresenter::scanDirectionToString(ScanDirection scanDirection)
-{
- switch (scanDirection) {
- case ScanDirection::TO_BOTTOM:
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR_TB";
- case ScanDirection::TO_TOP:
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR_BT";
- default:
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_UNDEFINED";
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SCAN_DIRECTION_PRESENTER_HPP
-#define SCAN_DIRECTION_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "ScanDirectionModel.hpp"
-
-class ScanDirectionPresenter : public ListPresenter
-{
- public:
- ScanDirectionPresenter();
- static std::string scanDirectionToString(ScanDirection scanDirection);
-
- private:
- ScanDirectionModel model_;
- std::vector<ScanDirection> directions_ = {
- ScanDirection::TO_BOTTOM,
- ScanDirection::TO_TOP};
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ScanMethodPresenter.hpp"
-
-#include "AppContext.hpp"
-
-ScanMethodPresenter::ScanMethodPresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD");
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
- for (auto method : methods_) {
- items.push_back(std::make_unique<ListItem>(
- scanMethodToString(method),
- std::string{},
- [this, method](auto item) {
- this->model_.method_ = method;
- Singleton<AppContext>::instance().pop();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- method == model_.method_.value()));
- }
-}
-
-std::string ScanMethodPresenter::scanMethodToString(ScanMethod scanMethod)
-{
- switch (scanMethod) {
- case ScanMethod::POINT:
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD_POINT";
- case ScanMethod::ROW:
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD_ROW";
- default:
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_UNDEFINED";
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SCAN_METHOD_PRESENTER_HPP
-#define SCAN_METHOD_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "ScanMethodModel.hpp"
-
-class ScanMethodPresenter : public ListPresenter
-{
- public:
- ScanMethodPresenter();
- static std::string scanMethodToString(ScanMethod scanMethod);
-
- private:
- ScanMethodModel model_;
- std::vector<ScanMethod> methods_ = {
- ScanMethod::POINT,
- ScanMethod::ROW};
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SelectActionPagePresenter.hpp"
-
-#include "AppContext.hpp"
-
-SelectActionPagePresenter::SelectActionPagePresenter(std::string switchId, std::string userName, ChangeType changeType, size_t countOfPagesToPop, std::string activityId, bool locally)
- : switchId_(std::move(switchId)), userName_(std::move(userName)), changeType_(changeType), countOfPagesToPop_(countOfPagesToPop)
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SELECT_ACTION");
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
-
- for (auto &activity : model_.getBindableActivityTypes()) {
- items.push_back(std::make_unique<ListItem>(
- activity.name,
- std::string{},
- [=](auto item) {
- this->addOrUpdateSwitchConfigurationItem(activity.id, locally);
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- activityId == activity.id));
- }
-}
-
-void SelectActionPagePresenter::addOrUpdateSwitchConfigurationItem(const std::string &activityType, bool locally)
-{
- switch (changeType_) {
- case ChangeType::ADD:
- model_.addSwitch({switchId_, userName_, activityType});
- break;
- case ChangeType::UPDATE:
- if (locally)
- Singleton<AppContext>::instance().sharedPreferences.insert_or_assign(switchId_, activityType);
- else
- model_.updateSwitch({switchId_, userName_, activityType});
- break;
- default:
- ASSERT(0, "Unhandled change type");
- break;
- }
- Singleton<AppContext>::instance().pop(countOfPagesToPop_ + 1);
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SELECT_ACTION_PAGE_PRESENTER_HPP
-#define SELECT_ACTION_PAGE_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "SelectActionPageModel.hpp"
-#include "UniversalSwitchTypes.hpp"
-
-class SelectActionPagePresenter : public ListPresenter
-{
- public:
- SelectActionPagePresenter(std::string switchId, std::string userName, ChangeType changeType, size_t countOfPagesToPop, std::string activityId = {}, bool locally = false);
-
- private:
- void addOrUpdateSwitchConfigurationItem(const std::string &activityType, bool locally);
- const std::string switchId_;
- const std::string userName_;
- ChangeType changeType_;
- const size_t countOfPagesToPop_;
- SelectActionPageModel model_;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SingleInteractionIntervalPresenter.hpp"
-
-SingleInteractionIntervalPresenter::SingleInteractionIntervalPresenter()
- : SpinnerPresenterWithToggle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_SGL_IACTION_INT")
-{
- 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> SingleInteractionIntervalPresenter::getRange()
-{
- return model_.range_;
-}
-double SingleInteractionIntervalPresenter::getStep()
-{
- return model_.step_;
-}
-
-std::string SingleInteractionIntervalPresenter::getFormat()
-{
- return "%1.1f seconds";
-}
-
-std::string SingleInteractionIntervalPresenter::getLabel()
-{
- return "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_SGL_IACTION_INT";
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SINGLE_INTERACTION_INTERVAL_PRESENTER_HPP_
-#define SINGLE_INTERACTION_INTERVAL_PRESENTER_HPP_
-
-#include "SingleInteractionIntervalModel.hpp"
-#include "SpinnerPresenterWithToggle.hpp"
-
-class SingleInteractionIntervalPresenter : public SpinnerPresenterWithToggle
-{
- public:
- SingleInteractionIntervalPresenter();
-
- utils::Range<double> getRange() override;
- double getStep() override;
- std::string getLabel() override;
- std::string getFormat() override;
-
- private:
- SingleInteractionIntervalModel model_;
-};
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SoundPresenter.hpp"
-
-SoundPresenter::SoundPresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND");
-
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
-
- items.push_back(std::make_unique<ListItem>(
- model_.state_.value() ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF",
- std::string{},
- [this](auto item) {
- this->model_.state_ = item->widgetState_.value();
- },
- ListItem::WidgetType::toggle,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.state_.value()));
- model_.state_.attach([this](auto val) {
- groups_[0].items_[0]->title_ = val ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF";
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{},
- "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_FEEDBACK_SOUND"));
-
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND_VOLUME");
- auto &radioItems = groups_.back().items_;
-
- radioItems.push_back(std::make_unique<ListItem>(
- "Match media volume",
- std::string{},
- [this](auto item) {
- this->model_.value_ = 1.0;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.value_.value() == 1.0));
-
- radioItems.push_back(std::make_unique<ListItem>(
- "75% of media volume",
- std::string{},
- [this](auto item) {
- this->model_.value_ = 0.75;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.value_.value() == 0.75));
-
- radioItems.push_back(std::make_unique<ListItem>(
- "50% of media volume",
- std::string{},
- [this](auto item) {
- this->model_.value_ = 0.50;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.value_.value() == 0.50));
-
- radioItems.push_back(std::make_unique<ListItem>(
- "25% of media volume",
- std::string{},
- [this](auto item) {
- this->model_.value_ = 0.25;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.value_.value() == 0.25));
-}
-
-void SoundPresenter::updateRadioItems()
-{
- for (auto i = 1; i <= 4; ++i) {
- auto idx = 4 - i;
- groups_[1].items_[idx]->widgetState_ = model_.value_.value() == 0.25 * i;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SOUND_PRESENTER_HPP
-#define SOUND_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "SoundModel.hpp"
-
-class SoundPresenter : public ListPresenter
-{
- public:
- SoundPresenter();
-
- private:
- void updateRadioItems();
-
- SoundModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SwitchesPagePresenter.hpp"
-
-#include "AddSwitchPagePresenter.hpp"
-#include "AppContext.hpp"
-#include "RemoveSwitchesPagePresenter.hpp"
-#include "SelectActionPagePresenter.hpp"
-#include "UniversalSwitchConstants.hpp"
-#include "UpdateAccessoriesSwitchPagePresenter.hpp"
-
-SwitchesPagePresenter::SwitchesPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES");
- groups_.emplace_back("");
-
- deleteSwitchesAction_ = addAction(std::make_unique<Action>("titleRightAction", "IDS_ACCS_DELETE_CAPS", [this](auto action) {
- Singleton<AppContext>::instance().push(std::make_unique<RemoveSwitchesPagePresenter>());
- },
- true));
- updateSwitchDeleteAction();
- addItemsToList();
- model_.switchesConfigurationChanged_.attach([this](auto timeStamp) {
- this->updateSwitchDeleteAction();
- groups_.back().items_.clear();
- this->addItemsToList();
- if (this->onListUpdate_)
- this->onListUpdate_();
- });
-}
-
-void SwitchesPagePresenter::addItemsToList()
-{
- auto &items = groups_.back().items_;
- auto switches = model_.getAllSwitchConfigurationItems();
- for (auto &oneSwitch : switches) {
- items.push_back(std::make_unique<ListItem>(
- oneSwitch.userName,
- model_.getActivityName(oneSwitch.activityType),
- [this, oneSwitch](auto item) {
- this->createUpdatePage(oneSwitch);
- }));
- }
- items.push_back(std::make_unique<ListItem>(
- "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES_ADD_SWITCH",
- std::string{},
- [this](auto item) {
- Singleton<AppContext>::instance().push(std::make_unique<AddSwitchPagePresenter>());
- },
- ListItem::WidgetType::icon,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- true,
- ACCESSIBILITY_UNIVERSAL_SWITCH_PLUS_ICON));
-}
-
-void SwitchesPagePresenter::createUpdatePage(const SwitchConfigurationItem &item)
-{
- auto tokens = utils::stringSplitByDelimiter(item.switchId, '_');
- if (!tokens.empty()) {
- if (tokens[0] == ACCESSIBILITY_UNIVERSAL_SWITCH_SCREEN_SWITCH_PROVIDER) {
- Singleton<AppContext>::instance().push(std::make_unique<SelectActionPagePresenter>(item.switchId, item.userName, ChangeType::UPDATE, 0, item.activityType));
- return;
- }
- if (tokens[0] == ACCESSIBILITY_UNIVERSAL_SWITCH_ACCESSORIES_SWITCH_PROVIDER) {
- Singleton<AppContext>::instance().push(std::make_unique<UpdateAccessoriesSwitchPagePresenter>(item.switchId));
- return;
- }
- if (tokens[0] == ACCESSIBILITY_UNIVERSAL_SWITCH_CAMERA_SWITCH_PROVIDER) {
- Singleton<AppContext>::instance().push(std::make_unique<SelectActionPagePresenter>(item.switchId, item.userName, ChangeType::UPDATE, 0, item.activityType));
- return;
- }
- }
-}
-
-void SwitchesPagePresenter::updateSwitchDeleteAction()
-{
- if (model_.getAllSwitchConfigurationItems().size() == 0)
- deleteSwitchesAction_->enabled_ = false;
- else
- deleteSwitchesAction_->enabled_ = true;
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SWITCHES_PAGE_PRESENTER_HPP
-#define SWITCHES_PAGE_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "SwitchesPageModel.hpp"
-
-class SwitchesPagePresenter : public ListPresenter
-{
- public:
- SwitchesPagePresenter();
-
- private:
- void addItemsToList();
- void createUpdatePage(const SwitchConfigurationItem &item);
- void updateSwitchDeleteAction();
- SwitchesPageModel model_;
- Action *deleteSwitchesAction_ = nullptr;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#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_;
-}
-
-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
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#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;
- std::string getLabel() override;
- std::string getFormat() override;
-
- private:
- TapDurationModel model_;
-};
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UniversalSwitchPagePresenter.hpp"
-
-#include "AppContext.hpp"
-#include "NoSwitchesModalPresenter.hpp"
-#include "UniversalSwitchSettingsPagePresenter.hpp"
-
-UniversalSwitchPagePresenter::UniversalSwitchPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH");
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
- items.push_back(std::make_unique<ListItem>(
- model_.sentinel_->interactionServiceState_.value() ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF",
- std::string{},
- [this](auto item) {
- if (!item->widgetState_.value())
- model_.sentinel_->setInteractionServiceState(false);
- else if (model_.atLeastOneSwitchConfigured())
- model_.sentinel_->setInteractionServiceState(true);
- else {
- item->widgetState_ = false;
- DEBUG("No switch configured");
- Singleton<AppContext>::instance().pushModal(std::make_unique<NoSwitchesModalPresenter>());
- }
- },
- ListItem::WidgetType::toggle,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.sentinel_->interactionServiceState_.value()));
- items.back()->enabled_ = model_.sentinel_->configurationServiceState_.value();
-
- items.push_back(std::make_unique<ListItem>(
- std::string{},
- "IDS_ACCS_UNIVERSAL_SWITCH_COMMENT"));
- items.back()->enabled_ = false;
-
- addAction(std::make_unique<Action>("titleRightAction", "IDS_ACCS_SETTINGS_CAPS", [this](auto action) {
- Singleton<AppContext>::instance().push(std::make_unique<UniversalSwitchSettingsPagePresenter>());
- },
- model_.sentinel_->configurationServiceState_.value()));
-
- model_.sentinel_->configurationServiceState_.attach([this, &items](auto value) {
- this->getAction("titleRightAction")->enabled_ = value;
- items.front()->enabled_ = value;
- });
-
- model_.sentinel_->interactionServiceState_.attach([this, &items](auto value) {
- items.front()->title_ = value ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF";
- items.front()->widgetState_ = value;
- });
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_PAGE_PRESENTER_HPP
-#define UNIVERSAL_SWITCH_PAGE_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "UniversalSwitchPageModel.hpp"
-
-class UniversalSwitchPagePresenter : public ListPresenter
-{
- public:
- UniversalSwitchPagePresenter();
-
- private:
- UniversalSwitchPageModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UniversalSwitchSettingsPagePresenter.hpp"
-
-#include "AppContext.hpp"
-#include "AutoMoveIntervalPresenter.hpp"
-#include "AutoScanIntervalPresenter.hpp"
-#include "AutoTapPresenter.hpp"
-#include "CursorColorPagePresenter.hpp"
-#include "ManageMenuOptionsPagePresenter.hpp"
-#include "NumberOfAutoScanLoopsPresenter.hpp"
-#include "PauseOnFirstPresenter.hpp"
-#include "PointScanSpeedPresenter.hpp"
-#include "ScanDirectionPresenter.hpp"
-#include "ScanMethodPresenter.hpp"
-#include "SingleInteractionIntervalPresenter.hpp"
-#include "SoundPresenter.hpp"
-#include "SwitchesPagePresenter.hpp"
-#include "TapDurationPresenter.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VoicePresenter.hpp"
-
-UniversalSwitchSettingsPagePresenter::UniversalSwitchSettingsPagePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS");
- createSwitchesGroup();
- createScanningGropu();
- createAdditionalSettingsGroup();
- createFeedbackGroup();
-}
-
-void UniversalSwitchSettingsPagePresenter::createSwitchesGroup()
-{
- groups_.emplace_back("");
- groups_.back().items_.push_back(std::make_unique<ListItem>(std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES"},
- TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES", model_.configuredSwitchesCount_.value()).str(),
- [this](auto item) {
- Singleton<AppContext>::instance().push(std::make_unique<SwitchesPagePresenter>());
- DEBUG("Switches page");
- }));
- auto item = groups_.back().items_.back().get();
- model_.configuredSwitchesCount_.attach([item](auto value) {
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES", value).str();
- });
- model_.sentinel_->configurationServiceState_.attach([this, item](auto value) {
- item->enabled_ = value;
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES", model_.configuredSwitchesCount_.value()).str();
- });
- item->enabled_ = model_.sentinel_->configurationServiceState_.value();
-}
-
-void UniversalSwitchSettingsPagePresenter::createScanningGropu()
-{
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING");
-
- auto &items = groups_.back().items_;
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_AUTO_SCAN"},
- std::string{},
- [this](auto item) {
- DEBUG("Auto scan");
- },
- ListItem::WidgetType::toggle,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- autoScanModel_.enabled_.value()));
- auto item = items.back().get();
- autoScanModel_.enabled_.attach([item](auto value) {
- item->widgetState_ = value;
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_AUTO_SCAN_INT"},
- TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", autoScanModel_.interval_.value()).str(),
- [this](auto item) {
- DEBUG("Auto scan interval");
- Singleton<AppContext>::instance().push(std::make_unique<AutoScanIntervalPresenter>());
- }));
- item = items.back().get();
- autoScanModel_.interval_.attach([item](auto value) {
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", value).str();
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_NUM_OF_SCANS"},
- std::to_string(autoScanLoopsModel_.value_.value()),
- [this](auto item) {
- DEBUG("Scan num");
- Singleton<AppContext>::instance().push(std::make_unique<NumberOfAutoScanLoopsPresenter>());
- }));
- item = items.back().get();
- autoScanLoopsModel_.value_.attach([item](auto value) {
- item->description_ = std::to_string(value);
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_METHOD"},
- ScanMethodPresenter::scanMethodToString(scanMethodModel_.method_.value()),
- [this](auto item) {
- DEBUG("Scan method");
- Singleton<AppContext>::instance().push(std::make_unique<ScanMethodPresenter>());
- }));
- item = items.back().get();
- scanMethodModel_.method_.attach([item, this](auto value) {
- item->description_ = ScanMethodPresenter::scanMethodToString(value);
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_SCAN_DIR"},
- ScanDirectionPresenter::scanDirectionToString(scanDirectionModel_.direction_.value()),
- [this](auto item) {
- DEBUG("Scan dir");
- Singleton<AppContext>::instance().push(std::make_unique<ScanDirectionPresenter>());
- }));
- item = items.back().get();
- scanDirectionModel_.direction_.attach([item, this](auto value) {
- item->description_ = ScanDirectionPresenter::scanDirectionToString(value);
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_PT_SPEED"},
- std::to_string(pointScanSpeedModel_.value_.value()),
- [this](auto item) {
- DEBUG("Scan point speed");
- Singleton<AppContext>::instance().push(std::make_unique<PointScanSpeedPresenter>());
- }));
- item = items.back().get();
- pointScanSpeedModel_.value_.attach([item](auto value) {
- item->description_ = std::to_string(value);
- });
-}
-
-void UniversalSwitchSettingsPagePresenter::createAdditionalSettingsGroup()
-{
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS");
- auto &items = groups_.back().items_;
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_PAUSE_ON_FIRST"},
- pauseOnFirstModel_.state_.value() ? TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", pauseOnFirstModel_.value_.value()).str()
- : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"},
- [this](auto item) {
- DEBUG("Pause on first");
- Singleton<AppContext>::instance().push(std::make_unique<PauseOnFirstPresenter>());
- },
- ListItem::WidgetType::toggle,
- [this](auto item) {
- pauseOnFirstModel_.state_ = item->widgetState_.value();
- },
- std::function<void(ListItem * item)>{},
- pauseOnFirstModel_.state_.value()));
- auto item = items.back().get();
- auto pauseOnFirstCb = [this, item](auto value) {
- item->widgetState_ = pauseOnFirstModel_.state_.value();
- if (pauseOnFirstModel_.state_.value())
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", pauseOnFirstModel_.value_.value()).str();
- else
- item->description_ = "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- };
- pauseOnFirstModel_.state_.attach(pauseOnFirstCb);
- pauseOnFirstModel_.value_.attach(pauseOnFirstCb);
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"},
- tapDurationModel_.state_.value() ? TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", tapDurationModel_.value_.value()).str()
- : 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) {
- DEBUG("tap duration");
- tapDurationModel_.state_ = item->widgetState_.value();
- },
- std::function<void(ListItem * item)>{},
- tapDurationModel_.state_.value()));
- item = items.back().get();
- auto tapDurationCb = [this, item](auto value) {
- item->widgetState_ = tapDurationModel_.state_.value();
- if (tapDurationModel_.state_.value())
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", tapDurationModel_.value_.value()).str();
- else
- item->description_ = "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- };
- tapDurationModel_.state_.attach(tapDurationCb);
- tapDurationModel_.value_.attach(tapDurationCb);
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_SGL_IACTION_INT"},
- singleInteractionIntervalModel_.state_.value() ? TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", singleInteractionIntervalModel_.value_.value()).str()
- : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"},
- [this](auto item) {
- DEBUG("single interaction interval widget");
- Singleton<AppContext>::instance().push(std::make_unique<SingleInteractionIntervalPresenter>());
- },
- ListItem::WidgetType::toggle,
- [this](auto item) {
- singleInteractionIntervalModel_.state_ = item->widgetState_.value();
- },
- std::function<void(ListItem * item)>{},
- singleInteractionIntervalModel_.state_.value()));
- item = items.back().get();
- auto snglIntCb = [this, item](auto value) {
- item->widgetState_ = singleInteractionIntervalModel_.state_.value();
- if (singleInteractionIntervalModel_.state_.value())
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", singleInteractionIntervalModel_.value_.value()).str();
- else
- item->description_ = "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- };
- singleInteractionIntervalModel_.state_.attach(snglIntCb);
- singleInteractionIntervalModel_.value_.attach(snglIntCb);
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP"},
- autoTapModel_.state_.value() ? TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", autoTapModel_.value_.value()).str()
- : 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) {
- autoTapModel_.state_ = item->widgetState_.value();
- DEBUG("auto tap");
- },
- std::function<void(ListItem * item)>{},
- autoTapModel_.state_.value()));
- item = items.back().get();
- auto autoTapCb = [this, item](auto value) {
- item->widgetState_ = autoTapModel_.state_.value();
- if (autoTapModel_.state_.value())
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", autoTapModel_.value_.value()).str();
- else
- item->description_ = "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- };
- autoTapModel_.state_.attach(autoTapCb);
- autoTapModel_.value_.attach(autoTapCb);
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_MOVE_INT"},
- autoMoveIntervalModel_.state_.value() ? TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", autoMoveIntervalModel_.value_.value()).str()
- : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"},
- [this](auto item) {
- DEBUG("auto move widget");
- Singleton<AppContext>::instance().push(std::make_unique<AutoMoveIntervalPresenter>());
- },
- ListItem::WidgetType::toggle,
- [this](auto item) {
- autoMoveIntervalModel_.state_ = item->widgetState_.value();
- DEBUG("auto move");
- },
- std::function<void(ListItem * item)>{},
- autoMoveIntervalModel_.state_.value()));
- item = items.back().get();
- auto autoMoveCb = [this, item](auto value) {
- item->widgetState_ = autoMoveIntervalModel_.state_.value();
- if (autoMoveIntervalModel_.state_.value())
- item->description_ = TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", autoMoveIntervalModel_.value_.value()).str();
- else
- item->description_ = "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- };
- autoMoveIntervalModel_.state_.attach(autoMoveCb);
- autoMoveIntervalModel_.value_.attach(autoMoveCb);
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP_KBD"},
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_AUTO_TAP_KBD_SUB"},
- [this](auto item) {
- model_.autoTapKeyboardState_ = item->widgetState_.value();
- },
- ListItem::WidgetType::toggle,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.autoTapKeyboardState_.value()));
- item = items.back().get();
- model_.autoTapKeyboardState_.attach([item, this](auto value) {
- item->widgetState_ = value;
- });
-}
-
-void UniversalSwitchSettingsPagePresenter::createFeedbackGroup()
-{
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK");
- auto &items = groups_.back().items_;
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL"},
- cursorColorModel_.getColorText(cursorColorModel_.cursorColor_.value()),
- [this](auto item) {
- Singleton<AppContext>::instance().push(std::make_unique<CursorColorPagePresenter>());
- }));
- auto item = items.back().get();
- cursorColorModel_.cursorColor_.attach([item, this](auto value) {
- item->description_ = this->cursorColorModel_.getColorText(value);
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND"},
- soundModel_.state_.value() ? utils::doubleToPercent(soundModel_.value_.value()) + " of media volume" : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"},
- [this](auto item) {
- DEBUG("feedback sound widget");
- Singleton<AppContext>::instance().push(std::make_unique<SoundPresenter>());
- },
- ListItem::WidgetType::toggle,
- [this](auto item) {
- DEBUG("feedback sound");
- soundModel_.state_ = item->widgetState_.value();
- },
- std::function<void(ListItem * item)>{},
- soundModel_.state_.value()));
- item = items.back().get();
- soundModel_.state_.attach([item, this](auto value) {
- item->widgetState_ = value;
- item->description_ = value ? utils::doubleToPercent(soundModel_.value_.value()) + " of media volume" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- });
- soundModel_.value_.attach([item, this](auto value) {
- item->description_ = soundModel_.state_.value() ? utils::doubleToPercent(soundModel_.value_.value()) + " of media volume" : "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF";
- });
-
- auto speechRate = "Speech rate: " + utils::doubleToString(voiceModel_.rate_.value(), 1);
- auto mediaVolume = "Speech volume: " + utils::doubleToPercent(voiceModel_.volume_.value()) + " of media volume";
- auto desc = voiceModel_.state_.value() ? speechRate + "<br>" + mediaVolume : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"};
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE"},
- desc,
- [this](auto item) {
- DEBUG("feedback sound widget");
- Singleton<AppContext>::instance().push(std::make_unique<VoicePresenter>());
- },
- ListItem::WidgetType::toggle,
- [this](auto item) {
- DEBUG("auto move");
- voiceModel_.state_ = item->widgetState_.value();
- },
- std::function<void(ListItem * item)>{},
- voiceModel_.state_.value()));
- item = items.back().get();
- voiceModel_.state_.attach([item, this](auto value) {
- item->widgetState_ = value;
- auto speechRate = "Speech rate: " + utils::doubleToPercent(voiceModel_.rate_.value());
- auto mediaVolume = "Speech volume: " + utils::doubleToPercent(voiceModel_.volume_.value()) + " of media volume";
- auto desc = voiceModel_.state_.value() ? speechRate + "<br>" + mediaVolume : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"};
- item->description_ = desc;
- });
- voiceModel_.rate_.attach([item, this](auto value) {
- auto speechRate = "Speech rate: " + utils::doubleToPercent(voiceModel_.rate_.value());
- auto mediaVolume = "Speech volume: " + utils::doubleToPercent(voiceModel_.volume_.value()) + " of media volume";
- auto desc = voiceModel_.state_.value() ? speechRate + "<br>" + mediaVolume : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"};
- item->description_ = desc;
- });
- voiceModel_.volume_.attach([item, this](auto value) {
- auto speechRate = "Speech rate: " + utils::doubleToPercent(voiceModel_.rate_.value());
- auto mediaVolume = "Speech volume: " + utils::doubleToPercent(voiceModel_.volume_.value()) + " of media volume";
- auto desc = voiceModel_.state_.value() ? speechRate + "<br>" + mediaVolume : std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_OFF"};
- item->description_ = desc;
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE"},
- std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_MANAGE_SUB"},
- [this](auto item) {
- Singleton<AppContext>::instance().push(std::make_unique<ManageMenuOptionsPagePresenter>());
- }));
-}
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_SETTINGS_PAGE_PRESENTER_HPP
-#define UNIVERSAL_SWITCH_SETTINGS_PAGE_PRESENTER_HPP
-
-#include "AutoMoveIntervalModel.hpp"
-#include "AutoScanModel.hpp"
-#include "AutoTapModel.hpp"
-#include "CursorColorModel.hpp"
-#include "ListPresenter.hpp"
-#include "NumberOfAutoScanLoopsModel.hpp"
-#include "PauseOnFirstModel.hpp"
-#include "PointScanSpeedModel.hpp"
-#include "ScanDirectionModel.hpp"
-#include "ScanMethodModel.hpp"
-#include "SingleInteractionIntervalModel.hpp"
-#include "SoundModel.hpp"
-#include "TapDurationModel.hpp"
-#include "UniversalSwitchSettingsPageModel.hpp"
-#include "UniversalSwitchTypes.hpp"
-#include "VoiceModel.hpp"
-
-class UniversalSwitchSettingsPagePresenter : public ListPresenter
-{
- public:
- UniversalSwitchSettingsPagePresenter();
-
- private:
- void createSwitchesGroup();
- void createScanningGropu();
- void createAdditionalSettingsGroup();
- void createFeedbackGroup();
-
- UniversalSwitchSettingsPageModel model_;
- AutoScanModel autoScanModel_;
- NumberOfAutoScanLoopsModel autoScanLoopsModel_;
- PointScanSpeedModel pointScanSpeedModel_;
- PauseOnFirstModel pauseOnFirstModel_;
- TapDurationModel tapDurationModel_;
- SingleInteractionIntervalModel singleInteractionIntervalModel_;
- AutoTapModel autoTapModel_;
- AutoMoveIntervalModel autoMoveIntervalModel_;
- SoundModel soundModel_;
- VoiceModel voiceModel_;
- CursorColorModel cursorColorModel_;
- ScanMethodModel scanMethodModel_;
- ScanDirectionModel scanDirectionModel_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UpdateAccessoriesSwitchPagePresenter.hpp"
-
-#include "AppContext.hpp"
-#include "SelectActionPagePresenter.hpp"
-
-UpdateAccessoriesSwitchPagePresenter::UpdateAccessoriesSwitchPagePresenter(std::string switchId) : switchId_(std::move(switchId))
-{
- cancelAction_ = addAction(std::make_unique<Action>("cancelAction",
- "IDS_ACCS_UNIVERSAL_SWITCH_CANCEL",
- [this](auto action) {
- Singleton<AppContext>::instance().pop();
- }));
- saveAction_ = addAction(std::make_unique<Action>("saveAction",
- "IDS_ACCS_UNIVERSAL_SWITCH_SAVE",
- [this](auto action) {
- model_.updateSwitch(SwitchConfigurationItem{switchId_, entryItem_->entryText_.value(), activityId_});
- Singleton<AppContext>::instance().pop();
- }));
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
-
- items.push_back(std::make_unique<ListItem>(
- "IDS_ACCS_UNIVERSAL_SWITCH_NAME",
- std::string{},
- std::function<void(ListItem *)>{},
- ListItem::WidgetType::entry,
- std::function<void(ListItem *)>{},
- [this](auto item) {
- if (item->entryText_.value().empty())
- saveAction_->enabled_ = false;
- else
- saveAction_->enabled_ = true;
- }));
-
- entryItem_ = items.back().get();
- auto switchInfo = model_.getDetailsForSwitchConfigurationItem(switchId_);
- entryItem_->entryText_ = switchInfo.userName;
- activityId_ = switchInfo.activityType;
-
- items.push_back(std::make_unique<ListItem>(
- "IDS_ACCS_UNIVERSAL_SWITCH_ACTION",
- model_.getActivityDetails(switchInfo.activityType).name,
- [this](auto item) {
- Singleton<AppContext>::instance().push(std::make_unique<SelectActionPagePresenter>(switchId_, entryItem_->entryText_.value(), ChangeType::UPDATE, 0, activityId_, true));
- },
- ListItem::WidgetType::none,
- std::function<void(ListItem *)>{},
- std::function<void(ListItem *)>{},
- false));
- actionItem_ = items.back().get();
-}
-
-void UpdateAccessoriesSwitchPagePresenter::onTop()
-{
- auto &sharedPreferences = Singleton<AppContext>::instance().sharedPreferences;
- auto val = sharedPreferences.find(switchId_);
- if (val != sharedPreferences.end()) {
- activityId_ = val->second;
- actionItem_->description_ = model_.getActivityDetails(activityId_).name;
- }
-}
-
-UpdateAccessoriesSwitchPagePresenter::~UpdateAccessoriesSwitchPagePresenter()
-{
- Singleton<AppContext>::instance().sharedPreferences.erase(switchId_);
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UPDATE_ACCESSORIES_SWITCH_PAGE_PRESENTER
-#define UPDATE_ACCESSORIES_SWITCH_PAGE_PRESENTER
-
-#include "ListPresenter.hpp"
-#include "UpdateAccessoriesSwitchPageModel.hpp"
-
-class UpdateAccessoriesSwitchPagePresenter : public ListPresenter
-{
- public:
- UpdateAccessoriesSwitchPagePresenter(std::string switchId);
- ~UpdateAccessoriesSwitchPagePresenter();
-
- private:
- void onTop() override;
- std::string switchId_;
- std::string activityId_;
- Action *saveAction_ = nullptr;
- Action *cancelAction_ = nullptr;
- ListItem *entryItem_ = nullptr;
- ListItem *actionItem_ = nullptr;
- UpdateAccessoriesSwitchPageModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "VoicePresenter.hpp"
-
-VoicePresenter::VoicePresenter()
-{
- setTitle("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE");
-
- groups_.emplace_back("");
- auto &items = groups_.back().items_;
-
- items.push_back(std::make_unique<ListItem>(
- model_.state_.value() ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF",
- std::string{},
- [this](auto item) {
- this->model_.state_ = item->widgetState_.value();
- },
- ListItem::WidgetType::toggle,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.state_.value()));
- model_.state_.attach([this](auto val) {
- groups_[0].items_[0]->title_ = val ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF";
- });
-
- items.push_back(std::make_unique<ListItem>(
- std::string{},
- "IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_FEEDBACK_VOICE"));
-
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_RATE");
- auto speechRateItem = std::make_unique<ListItem>(
- std::string{},
- std::string{},
- std::function<void(ListItem * item)>{},
- ListItem::WidgetType::slider,
- std::function<void(ListItem * item)>{},
- [this](auto item) {
- this->model_.rate_ = item->value_;
- });
- speechRateItem->value_ = model_.rate_.value();
- speechRateItem->range_ = {model_.range_.begin, model_.range_.end};
- speechRateItem->step_ = model_.step_;
-
- groups_.back().items_.push_back(std::move(speechRateItem));
-
- groups_.emplace_back("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_VOICE_SPEECH_VOLUME");
- auto &radioItems = groups_.back().items_;
-
- radioItems.push_back(std::make_unique<ListItem>(
- "Match media volume",
- std::string{},
- [this](auto item) {
- this->model_.volume_ = 1.0;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.volume_.value() == 1.0));
-
- radioItems.push_back(std::make_unique<ListItem>(
- "75% of media volume",
- std::string{},
- [this](auto item) {
- this->model_.volume_ = 0.75;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.volume_.value() == 0.75));
-
- radioItems.push_back(std::make_unique<ListItem>(
- "50% of media volume",
- std::string{},
- [this](auto item) {
- this->model_.volume_ = 0.50;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.volume_.value() == 0.50));
-
- radioItems.push_back(std::make_unique<ListItem>(
- "25% of media volume",
- std::string{},
- [this](auto item) {
- this->model_.volume_ = 0.25;
- this->updateRadioItems();
- },
- ListItem::WidgetType::radio,
- std::function<void(ListItem * item)>{},
- std::function<void(ListItem * item)>{},
- model_.volume_.value() == 0.25));
-}
-
-void VoicePresenter::updateRadioItems()
-{
- for (auto i = 1; i <= 4; ++i) {
- auto idx = 4 - i;
- groups_[2].items_[idx]->widgetState_ = model_.volume_.value() == 0.25 * i;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef VOICE_PRESENTER_HPP
-#define VOICE_PRESENTER_HPP
-
-#include "ListPresenter.hpp"
-#include "VoiceModel.hpp"
-
-class VoicePresenter : public ListPresenter
-{
- public:
- VoicePresenter();
-
- private:
- void updateRadioItems();
-
- VoiceModel model_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "UniversalSwitchSentinel.hpp"
-
-#include "UniversalSwitchConstants.hpp"
-
-UniversalSwitchState::UniversalSwitchState()
-{
- interactionServiceStateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE, false, [this](auto state) {
- this->vconfInteractionState_ = state;
- this->syncInteractionServiceState();
- });
-
- configurationServiceStateHandle_ = Singleton<VConfInterface>::instance().registerAndGet<bool>(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_CONFIGURATION_SERVICE, false, [this](auto state) {
- this->vconfConfigurationState_ = state;
- this->syncConfigurationServiceState();
- });
-
- connectionPtr_ = DBus::getDBusConnectionByType(DBus::ConnectionType::SESSION);
- ownerNameCallbackHandle_ = DBus::registerNameOwnerChangedCallback(connectionPtr_, BUS, [this](std::string oldID, std::string newID) {
- dbusConfigurationServiceState_ = true;
- syncInteractionServiceState();
- syncConfigurationServiceState();
- });
-}
-
-UniversalSwitchState::~UniversalSwitchState()
-{
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_CONFIGURATION_SERVICE, false);
-}
-
-void UniversalSwitchState::syncInteractionServiceState()
-{
- auto v = vconfInteractionState_ && dbusConfigurationServiceState_;
- if (this->interactionServiceState_.value_ != v) {
- this->interactionServiceState_.value_ = v;
- this->interactionServiceState_.notify(v);
- }
-}
-
-void UniversalSwitchState::syncConfigurationServiceState()
-{
- auto v = vconfConfigurationState_ && dbusConfigurationServiceState_;
- if (this->configurationServiceState_.value_ != v) {
- this->configurationServiceState_.value_ = v;
- this->configurationServiceState_.notify(v);
- }
-}
-
-void UniversalSwitchState::setInteractionServiceState(bool state)
-{
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE, state);
-}
-
-void UniversalSwitchState::setConfigurationServiceState(bool state)
-{
- Singleton<VConfInterface>::instance().set(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_CONFIGURATION_SERVICE, state);
-}
-
-UniversalSwitchSentinel UniversalSwitchSentinelService::getSentinel()
-{
- if (auto s = sentinel_.lock()) {
- return s;
- } else {
- auto x = std::make_shared<UniversalSwitchState>();
- sentinel_ = x;
- return x;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_SENTINEL_HPP
-#define UNIVERSAL_SWITCH_SENTINEL_HPP
-
-#include "DBus.hpp"
-#include "ObservableProperty.hpp"
-#include "VConf.hpp"
-
-#include <memory>
-
-class UniversalSwitchState
-{
- public:
- class ReadOnlyProperty : public Observable<bool>
- {
- friend class UniversalSwitchState;
-
- public:
- ReadOnlyProperty() = default;
- ReadOnlyProperty(bool val)
- : value_(val)
- {}
-
- bool value() const
- {
- return value_;
- }
-
- private:
- bool value_ = false;
- };
-
- UniversalSwitchState();
- ~UniversalSwitchState();
- ReadOnlyProperty interactionServiceState_;
- ReadOnlyProperty configurationServiceState_;
-
- void setInteractionServiceState(bool state);
- void setConfigurationServiceState(bool state);
-
- private:
- void syncInteractionServiceState();
- void syncConfigurationServiceState();
-
- VConfInterface::CallbackHandle interactionServiceStateHandle_;
- VConfInterface::CallbackHandle configurationServiceStateHandle_;
- DBus::OwnerNameCallbackHandle ownerNameCallbackHandle_;
- DBus::DBusWrapper::ConnectionPtr connectionPtr_;
- bool dbusConfigurationServiceState_ = false;
- bool vconfConfigurationState_ = false;
- bool vconfInteractionState_ = false;
-};
-
-using UniversalSwitchSentinel = std::shared_ptr<UniversalSwitchState>;
-
-class UniversalSwitchSentinelService
-{
- public:
- UniversalSwitchSentinel getSentinel();
-
- private:
- std::weak_ptr<UniversalSwitchState> sentinel_;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_CONSTANTS_HPP
-#define UNIVERSAL_SWITCH_CONSTANTS_HPP
-
-#define VCONF_MEMORY_TYPE "db/"
-#define VCONF_PROJECT_NAME "setting/accessibility/universal-switch/"
-#define VCONF_PROJECT_PREFIX VCONF_MEMORY_TYPE VCONF_PROJECT_NAME
-
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_ENABLED VCONF_PROJECT_PREFIX "AUTO_SCAN_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCAN_INT VCONF_PROJECT_PREFIX "AUTO_SCAN_INTERVAL"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_NUM_OF_SCANS VCONF_PROJECT_PREFIX "LOOP_LIMIT_TO_INACTION"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_METHOD VCONF_PROJECT_PREFIX "SCAN_METHOD"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_DIR_VERTICAL VCONF_PROJECT_PREFIX "SCAN_DIRECTION_VERTICAL"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_DIR_HORIZONTA VCONF_PROJECT_PREFIX "SCAN_DIRECTION_HORIZONTAL"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_PT_SPEED VCONF_PROJECT_PREFIX "SCAN_PT_SPEED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_PAUSE_ON_FIRST_STATE VCONF_PROJECT_PREFIX "PAUSE_ON_FIRST_ELEMENT_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_PAUSE_ON_FIRST_VALUE VCONF_PROJECT_PREFIX "PAUSE_ON_FIRST_ELEMENT_TIME"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_STATE VCONF_PROJECT_PREFIX "TAP_DURATION_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_TAP_DURATION_VALUE VCONF_PROJECT_PREFIX "TAP_DURATION_VALUE"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_STATE VCONF_PROJECT_PREFIX "SGL_INACTION_INT_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SGL_IACTION_INT_VALUE VCONF_PROJECT_PREFIX "SGL_INACTION_INT_VALUE"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_STATE VCONF_PROJECT_PREFIX "AUTO_TAP_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_VALUE VCONF_PROJECT_PREFIX "AUTO_TAP_WAITING_TIME"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_STATE VCONF_PROJECT_PREFIX "AUTO_MOVE_INT_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_MOVE_INT_VALUE VCONF_PROJECT_PREFIX "AUTO_MOVE_INT_VALUE"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_TAP_KBD_STATE VCONF_PROJECT_PREFIX "AUTO_TAP_KBD_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_CURSOR_COLOR VCONF_PROJECT_PREFIX "FEEDBACK_CURSOR_COLOR"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_SOUND_STATE VCONF_PROJECT_PREFIX "FEEDBACK_SOUND_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_SOUND_VOLUME VCONF_PROJECT_PREFIX "FEEDBACK_SOUND_VOLUME"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_STATE VCONF_PROJECT_PREFIX "FEEDBACK_VOICE_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_SPEECH_RATE VCONF_PROJECT_PREFIX "FEEDBACK_VOICE_SPEECH_RATE"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE_SPEECH_VOLUME VCONF_PROJECT_PREFIX "FEEDBACK_VOICE_SPEECH_VOLUME"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCROLL_ENABLED VCONF_PROJECT_PREFIX "AUTO_SCROLL_ENABLED"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_GRANULARITY_UNIT VCONF_PROJECT_PREFIX "GRANULARITY_UNIT"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_ACTIONS VCONF_PROJECT_PREFIX "SHOW_ACTIONS_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_SETTINGS VCONF_PROJECT_PREFIX "SHOW_SETTINGS_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_HOMESCREEN VCONF_PROJECT_PREFIX "SHOW_HOME_SCREEN_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_KEYS VCONF_PROJECT_PREFIX "SHOW_BUTTONS_AND_KEYS_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_CONTEXTUAL_MENU VCONF_PROJECT_PREFIX "SHOW_CONTEXTUAL_MENU"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_GESTURES VCONF_PROJECT_PREFIX "SHOW_GESTURES_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_RECENT_APPS VCONF_PROJECT_PREFIX "SHOW_RECENT_APPS_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_MANAGE_BACK VCONF_PROJECT_PREFIX "SHOW_BACK_MENU_ITEM"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_CONFIGURATION_SERVICE VCONF_PROJECT_PREFIX "configuration-service"
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE VCONF_PROJECT_PREFIX "interaction-service"
-
-#define DEFAULT_AUTO_SCAN_STATE true
-#define DEFAULT_AUTO_SCAN_INTERVAL 2.0
-#define DEFAULT_AUTO_SCAN_NUMBER 5
-#define DEFAULT_SCAN_METHOD ScanMethod::POINT
-#define DEFAULT_SCAN_DIR ScanDirection::TO_BOTTOM
-#define DEFAULT_SCAN_PT_SPEED 10
-#define DEFAULT_PAUSE_ON_FIRST_STATE false
-#define DEFAULT_PAUSE_ON_FIRST_VALUE 1.0
-#define DEFAULT_TAP_DURATION_STATE false
-#define DEFAULT_TAP_DURATION_VALUE 0.5
-#define DEFAULT_SGL_IACTION_INT_STATE false
-#define DEFAULT_SGL_IACTION_INT_VALUE 0.5
-#define DEFAULT_AUTO_TAP_STATE false
-#define DEFAULT_AUTO_TAP_VALUE 1.0
-#define DEFAULT_AUTO_MOVE_INT_STATE false
-#define DEFAULT_AUTO_MOVE_INT_VALUE 1.0
-#define DEFAULT_AUTO_TAP_KEYBOARD_STATE false
-#define DEFAULT_FEEDBACK_CURSOR_COLOR 0xffff0000
-#define DEFAULT_FEEDBACK_SOUND_STATE true
-#define DEFAULT_FEEDBACK_SOUND_VOLUME 0.5
-#define DEFAULT_FEEDBACK_VOICE_STATE false
-#define DEFAULT_FEEDBACK_VOICE_SPEECH_RATE 0.5
-#define DEFAULT_FEEDBACK_VOICE_SPEECH_VOLUME 0.5
-
-#define RANGE_MIN_SCANS_NUM 1
-#define RANGE_MAX_SCANS_NUM 10
-#define RANGE_MIN_SCAN_SPEED 1
-#define RANGE_MAX_SCAN_SPEED 30
-
-#define STEP_SCANS_NUM 1
-#define STEP_SCAN_SPEED 1
-
-#define BUS "org.tizen.UniversalSwitch"
-#define PATH "/org/tizen/UniversalSwitch"
-#define IFACE "org.tizen.UniversalSwitch"
-
-#define ACCESSIBILITY_UNIVERSAL_SWITCH_PLUS_ICON RESDIR "/icons/plus.png"
-
-#define ACCESSIBILITY_UNIVERSAL_SWITCH_SCREEN_SWITCH_PROVIDER "ScreenSwitchProvider"
-#define ACCESSIBILITY_UNIVERSAL_SWITCH_ACCESSORIES_SWITCH_PROVIDER "AccessoriesSwitchProvider"
-#define ACCESSIBILITY_UNIVERSAL_SWITCH_CAMERA_SWITCH_PROVIDER "CameraSwitchProvider"
-#define ACCESSIBILITY_UNIVERSAL_SWITCH_SCREEN "Screen"
-
-#endif
+++ /dev/null
-/*
- * Copyright 2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef UNIVERSAL_SWITCH_TYPES_HPP
-#define UNIVERSAL_SWITCH_TYPES_HPP
-
-#include <string>
-
-enum class ChangeType : int32_t
-{
- ADD,
- UPDATE,
- REMOVE,
- NONE
-};
-
-enum class ScanMethod
-{
- POINT = 1,
- ROW
-};
-
-enum class ScanDirection
-{
- TO_BOTTOM = 1,
- TO_TOP
-};
-
-struct SwitchConfigurationItem
-{
- std::string switchId;
- std::string userName;
- std::string activityType;
-};
-
-struct InfoType
-{
- std::string id;
- std::string name;
- std::string description;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "EntryNameModalPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(EntryNameModalPresenter, testConstructor)
-{
- auto enmp = std::make_unique<EntryNameModalPresenter>("testSwitchID");
- EXPECT_STRCASEEQ("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH", enmp->getTitle().c_str());
-}
-
-TEST(EntryNameModalPresenter, testAction)
-{
- auto enmp = std::make_unique<EntryNameModalPresenter>("testSwitchID");
-
- auto modal_action = enmp->getAction("modalEntry");
- ASSERT_NE(modal_action, nullptr);
- EXPECT_EQ(modal_action->actionId_, std::string("modalEntry"));
- EXPECT_EQ(modal_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_NAME"));
- EXPECT_TRUE(modal_action->enabled_.value());
- EXPECT_FALSE(modal_action->state_.value());
-
- auto cancel_action = enmp->getAction("cancelAction");
-
- ASSERT_NE(cancel_action, nullptr);
- EXPECT_EQ(cancel_action->actionId_, std::string("cancelAction"));
- EXPECT_EQ(cancel_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_CANCEL"));
- EXPECT_TRUE(cancel_action->enabled_.value());
- EXPECT_FALSE(cancel_action->state_.value());
-
- auto save_action = enmp->getAction("doneAction");
-
- ASSERT_NE(save_action, nullptr);
- EXPECT_EQ(save_action->actionId_, std::string("doneAction"));
- EXPECT_EQ(save_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SAVE"));
- EXPECT_FALSE(save_action->enabled_.value());
- EXPECT_FALSE(save_action->state_.value());
- if (modal_action->onInvoke_)
- modal_action->onInvoke_(modal_action);
- EXPECT_TRUE(save_action->enabled_.value());
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "NoSwitchesModalPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(NoSwitchesModalPresenter, testConstructor)
-{
- auto nsmp = new NoSwitchesModalPresenter();
- EXPECT_STRCASEEQ("IDS_ACCS_UNIVERSAL_SWITCH_NO_SWITCHES_TEXT", nsmp->getText().c_str());
-}
-
-TEST(NoSwitchesModalPresenter, testAction)
-{
- auto nsmp = new NoSwitchesModalPresenter();
-
- auto cancel_action = nsmp->getAction("cancelAction");
-
- ASSERT_NE(cancel_action, nullptr);
- EXPECT_EQ(cancel_action->actionId_, std::string("cancelAction"));
- EXPECT_EQ(cancel_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_CANCEL"));
- EXPECT_TRUE(cancel_action->enabled_.value());
- EXPECT_FALSE(cancel_action->state_.value());
-
- auto done_action = nsmp->getAction("doneAction");
-
- ASSERT_NE(done_action, nullptr);
- EXPECT_EQ(done_action->actionId_, std::string("doneAction"));
- EXPECT_EQ(done_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_POPUP_ADD"));
- EXPECT_TRUE(done_action->enabled_.value());
- EXPECT_FALSE(done_action->state_.value());
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "presenter/NumberOfAutoScanLoopsPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(NumberOfAutoScanLoopsPresenter, testConstructor)
-{
- NumberOfAutoScanLoopsPresenter presenter;
-
- EXPECT_EQ(presenter.getTitle().str(), TranslatedString("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_NUM_OF_SCANS").str());
-}
-
-TEST(NumberOfAutoScanLoopsPresenter, testGetFormat)
-{
- NumberOfAutoScanLoopsPresenter presenter;
-
- EXPECT_EQ(presenter.getFormat(), std::string("%d times"));
-}
-
-TEST(NumberOfAutoScanLoopsPresenter, testGetLabel)
-{
- NumberOfAutoScanLoopsPresenter presenter;
-
- EXPECT_EQ(presenter.getLabel(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_NUM_OF_SCANS"));
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "presenter/PauseOnFirstPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(PauseOnFirstPresenter, testConstructor)
-{
- PauseOnFirstPresenter presenter;
-
- EXPECT_EQ(presenter.getTitle().str(), TranslatedString("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_PAUSE_ON_FIRST").str());
-}
-
-TEST(PauseOnFirstPresenter, testGetFormat)
-{
- PauseOnFirstPresenter presenter;
-
- EXPECT_EQ(presenter.getFormat(), std::string("%1.1f seconds"));
-}
-
-TEST(PauseOnFirstPresenter, testGetLabel)
-{
- PauseOnFirstPresenter presenter;
-
- EXPECT_EQ(presenter.getLabel(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_PAUSE_ON_FIRST"));
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "presenter/PointScanSpeedPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(PointScanSpeedPresenter, testConstructor)
-{
- PointScanSpeedPresenter presenter;
- EXPECT_EQ(presenter.getTitle().str(), TranslatedString("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SCANNING_PT_SPEED").str());
-}
-
-TEST(PointScanSpeedPresenter, testGetFormat)
-{
- PointScanSpeedPresenter presenter;
-
- EXPECT_EQ(presenter.getFormat(), std::string("%d"));
-}
-
-TEST(PointScanSpeedPresenter, testGetLabel)
-{
- PointScanSpeedPresenter presenter;
-
- EXPECT_EQ(presenter.getLabel(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SET_VALUE_DESC_SCAN_SPEED"));
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "presenter/RemoveSwitchesModalPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-static bool isUniversalSwitchActive_state = false;
-
-//RemoveSwitchesModel Mock implementation
-RemoveSwitchesModel::RemoveSwitchesModel()
-{
- isUniversalSwitchActive_ = isUniversalSwitchActive_state;
-}
-
-void RemoveSwitchesModel::removeSwitches(std::vector<std::string> &switchesIds)
-{}
-
-TEST(RemoveSwitchesModalPresenter, testConstructor)
-{
- std::vector<SwitchConfigurationItem> switches;
- std::vector<std::string> switchesToRemove;
- isUniversalSwitchActive_state = true;
-
- {
- RemoveSwitchesModalPresenter presenter(switches, switchesToRemove);
- EXPECT_EQ(presenter.getTitle().str(), TranslatedString("IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES").str());
- EXPECT_EQ(presenter.getText(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_DELETE_ALL_SWITCHES_DESC"));
- }
-
- switches.push_back(SwitchConfigurationItem());
-
- {
- RemoveSwitchesModalPresenter presenter(switches, switchesToRemove);
- EXPECT_EQ(presenter.getText(), std::string("0 ") + TranslatedString{"IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES_DESC"}.str());
- }
-
- switchesToRemove.push_back("Switch1");
-
- {
- RemoveSwitchesModalPresenter presenter(switches, switchesToRemove);
- EXPECT_EQ(presenter.getText(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_DELETE_ALL_SWITCHES_DESC"));
- }
-
- switchesToRemove.push_back("Switch2");
-
- {
- RemoveSwitchesModalPresenter presenter(switches, switchesToRemove);
- EXPECT_EQ(presenter.getText(), std::string("2 ") + TranslatedString{"IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES_DESC"}.str());
- }
-
- switches.clear();
- switchesToRemove.clear();
- isUniversalSwitchActive_state = false;
-
- {
- RemoveSwitchesModalPresenter presenter(switches, switchesToRemove);
- EXPECT_EQ(presenter.getText(), std::string("0 ") + TranslatedString{"IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES_DESC"}.str());
- }
-
- switches.push_back(SwitchConfigurationItem());
- switchesToRemove.push_back("Switch1");
-
- {
- RemoveSwitchesModalPresenter presenter(switches, switchesToRemove);
- EXPECT_EQ(presenter.getText(), std::string("1 ") + TranslatedString{"IDS_ACCS_UNIVERSAL_SWITCH_DELETE_SWITCHES_DESC"}.str());
- }
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "presenter/SingleInteractionIntervalPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(SingleInteractionIntervalPresenter, testConstructor)
-{
- SingleInteractionIntervalPresenter presenter;
-
- EXPECT_EQ(presenter.getTitle().str(), TranslatedString("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_SGL_IACTION_INT").str());
-}
-
-TEST(SingleInteractionIntervalPresenter, testGetFormat)
-{
- SingleInteractionIntervalPresenter presenter;
-
- EXPECT_EQ(presenter.getFormat(), std::string("%1.1f seconds"));
-}
-
-TEST(SingleInteractionIntervalPresenter, testGetLabel)
-{
- SingleInteractionIntervalPresenter presenter;
-
- EXPECT_EQ(presenter.getLabel(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_SGL_IACTION_INT"));
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "presenter/TapDurationPresenter.hpp"
-
-#include <gtest/gtest.h>
-
-TEST(TapDurationPresenter, testConstructor)
-{
- TapDurationPresenter presenter;
-
- EXPECT_EQ(presenter.getTitle().str(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"));
-}
-
-TEST(TapDurationPresenter, testGetFormat)
-{
- TapDurationPresenter presenter;
-
- EXPECT_EQ(presenter.getFormat(), std::string("%1.1f seconds"));
-}
-
-TEST(TapDurationPresenter, testGetLabel)
-{
- TapDurationPresenter presenter;
-
- EXPECT_EQ(presenter.getLabel(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_ADD_SETTINGS_TAP_DURATION"));
-}
-
-int main(int argc, char *argv[])
-{
- try {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- } catch (...) {
- return 1;
- }
-}
EXPECT_EQ(TranslatedString{"IDS_ACCESSIBILITY_TEST_KEY"}.str(), std::string{"IDS_ACCESSIBILITY_TEST_KEY"});
}
-TEST(TranslatedString, createFormatedStringDouble)
-{
- EXPECT_TRUE(setlocale(LC_ALL, "C"));
- EXPECT_EQ(TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", 0.11).str(), std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS"});
- EXPECT_TRUE(setlocale(LC_ALL, "en_GB.UTF-8"));
- EXPECT_EQ(TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SECONDS", 0.11).str(), std::string{"0.1 seconds"});
-}
-
-TEST(TranslatedString, createFormatedStringInt)
-{
- EXPECT_TRUE(setlocale(LC_ALL, "C"));
- EXPECT_EQ(TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES", 5).str(), std::string{"IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES"});
- EXPECT_TRUE(setlocale(LC_ALL, "en_GB.UTF-8"));
- EXPECT_EQ(TranslatedString::create("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_SWITCHES", 5).str(), std::string{"5 Switches"});
-}
-
TEST(TranslatedString, addTranslatedString)
{
EXPECT_TRUE(setlocale(LC_ALL, "C"));