--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __AIR_SETTINGS_LAYOUT_VOICE_H__
+#define __AIR_SETTINGS_LAYOUT_VOICE_H__
+
+/* group */
+#define GRP_LAYOUT_VOICE "grp.layout.voice"
+
+/* part */
+#define PART_VOICE "part.voice"
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+group {
+ name, GRP_LAYOUT_VOICE;
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ }
+
+ part {
+ name, "padding.top";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 65 134;
+ rel1 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, "padding.bottom";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 65 148;
+ rel1 {
+ to, "area";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 1.0 1.0;
+ }
+ align, 1.0 1.0;
+ fixed, 0 1;
+ }
+ }
+ part {
+ name, PART_VOICE;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.top";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "padding.bottom";
+ relative, 0.0 0.0;
+ }
+ fixed, 1 1;
+ align, 0.0 0.0;
+ }
+ }
+ }
+}
#include <Elementary.h>
#include <layoutmgr.h>
+#include <inputmgr.h>
+#include <app_debug.h>
#include "define.h"
#include "layout.h"
+#include "utils.h"
+#include "menumgr.h"
+
+#define PADDING_X 26
+#define PADDING_Y 26
+
+struct _priv {
+ Evas_Object *base;
+ Evas_Object *ly;
+ Evas_Object *table;
+ layoutmgr *lmgr;
+ struct menumgr *menu;
+};
+
+enum {
+ MENU_VOICE_CONTROL,
+ MENU_VOICE_LANGUAGE,
+ MENU_TTS_SPEED,
+ MENU_TTS_LANGUAGE
+};
+
+static void _selected(void *data, int id);
+static char *_get_status(void *data, int id);
+
+static struct menumgr_info menu_info[] = {
+ {
+ .id = MENU_VOICE_CONTROL,
+ .title = "Voice control",
+ .style = STYLE_STATUS_BTN,
+ .disabled = EINA_TRUE,
+ .status = _get_status,
+ .selected = _selected,
+ },
+ {
+ .id = MENU_VOICE_LANGUAGE,
+ .title = "Voice language",
+ .style = STYLE_STATUS_BTN,
+ .disabled = EINA_TRUE,
+ .status = _get_status,
+ .selected = _selected,
+ },
+ {
+ .id = MENU_TTS_SPEED,
+ .title = "TTS speed",
+ .style = STYLE_STATUS_BTN,
+ .disabled = EINA_TRUE,
+ .status = _get_status,
+ .selected = _selected,
+ },
+ {
+ .id = MENU_TTS_LANGUAGE,
+ .title = "TTS language",
+ .style = STYLE_STATUS_BTN,
+ .disabled = EINA_TRUE,
+ .status = _get_status,
+ .selected = _selected,
+ },
+};
+
+static char *_get_status(void *data, int id)
+{
+ return NULL;
+}
+
+static void _selected(void *data, int id)
+{
+}
+
+static bool _add_layout_contents(struct _priv *priv)
+{
+ Evas_Object *table;
+ struct menumgr *menu;
+
+ table = utils_add_table(priv->ly, PADDING_X, PADDING_Y);
+ if (!table) {
+ _ERR("failed to add table");
+ return false;
+ }
+
+ priv->table = table;
+
+ elm_object_part_content_set(priv->ly, PART_VOICE, table);
+
+ menu = menumgr_create(table, menu_info, ARRAY_SIZE(menu_info), priv);
+ if (!menu) {
+ _ERR("failed to create menu manager");
+ evas_object_del(table);
+ return false;
+ }
+
+ priv->menu = menu;
+
+ return true;
+}
static bool _create(layoutmgr *lmgr, void *data)
{
- /* It will be implemented later */
+ struct _priv *priv;
+ Evas_Object *base, *ly;
+
+ if (!lmgr) {
+ _ERR("Invalid argument.");
+ return false;
+ }
+
+ base = layoutmgr_get_base(lmgr);
+ if (!base) {
+ _ERR("Get base layout failed.");
+ return false;
+ }
+
+ ly = utils_add_layout(base, GRP_LAYOUT_VOICE, EINA_FALSE);
+ if (!ly) {
+ _ERR("Add layout failed.");
+ return false;
+ }
+
+ priv = calloc(1, sizeof(*priv));
+ if (!priv) {
+ _ERR("Calloc failed.");
+ evas_object_del(ly);
+ return false;
+ }
+
+ priv->lmgr = lmgr;
+ priv->base = base;
+ priv->ly = ly;
+
+ if (!_add_layout_contents(priv)) {
+ _ERR("Add layout contents failed.");
+ evas_object_del(ly);
+ free(priv);
+ return false;
+ }
+
+ layoutmgr_set_layout_data(lmgr, LAYOUT_ID_VOICE, priv);
+
return true;
}
static void _show(void *layout_data)
{
- /* It will be implemented later */
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ priv = layout_data;
+
+ if (priv->ly) {
+ menumgr_update(priv->menu);
+
+ evas_object_show(priv->ly);
+ elm_object_part_content_set(priv->base, PART_CONTENT, priv->ly);
+ }
}
static void _hide(void *layout_data)
{
- /* It will be implemented later */
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ priv = layout_data;
+
+ if (priv->ly) {
+ evas_object_hide(priv->ly);
+ elm_object_part_content_unset(priv->base, PART_CONTENT);
+ }
}
static void _destroy(void *layout_data)
{
- /* It will be implemented later */
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ priv = layout_data;
+
+ menumgr_destroy(priv->menu);
+
+ evas_object_del(priv->ly);
+
+ free(priv);
}
static layout_class _lclass = {