2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <ui-gadget.h>
18 #include "common_defs.h"
19 #include <AppCommon.h>
20 #include "settingviewmgr.h"
22 #include "json_marco.h"
23 #include "settings_provider.h"
27 #define PARAM_SETTINGS_ITEM "settings-item"
28 #define MAIN_CATALOG "maincatalog"
31 SET_TAG("org.tizen.settings-tv-ref");
33 Evas_Object *_add_win(const char *name)
37 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
39 _ERR("failed to create window!");
43 elm_win_title_set(win, name);
44 elm_win_alpha_set(win, EINA_TRUE);
46 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
47 elm_win_focus_highlight_style_set(win, DEFAULT_FOCUS_INVISIBLE);
49 evas_object_show(win);
54 class CApp : public CBaseApp {
61 unsigned int app_control;
65 virtual bool OnCreate(void)
70 elm_theme_overlay_add(NULL, EDJ_THEME);
72 win = _add_win(ad.name);
76 r = UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE);
78 _ERR("ug init efl failed.");
85 _ERR("Fail to init provider module");
94 /* Set Default value by vconf */
97 if(vconf_set_int(VCONF_PROXY_METHOD, 0)) _DBG("Fail to set vconf");
98 if(vconf_set_str(VCONF_PROXY_IP, "0.0.0.0")) _DBG("Fail to set vconf");
99 if(vconf_set_str(VCONF_PROXY_URL, "")) _DBG("Fail to set vconf");
102 if(vconf_set_str(WIRED_DNS_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
103 if(vconf_set_str(WIRED_GATEWAY_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
104 if(vconf_set_str(WIRED_IP_LAST_MODE, "Obtain automatically")) _DBG("Fail to set vconf");
105 if(vconf_set_str(WIRED_DNS_LAST_MODE, "Obtain automatically")) _DBG("Fail to set vconf");
106 if(vconf_set_str(WIRED_IP_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
107 if(vconf_set_str(WIRED_SUBMASK_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
109 if(vconf_set_str(WIRELESS_DNS_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
110 if(vconf_set_str(WIRELESS_GATEWAY_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
111 if(vconf_set_str(WIRELESS_IP_LAST_MODE, "Obtain automatically")) _DBG("Fail to set vconf");
112 if(vconf_set_str(WIRELESS_DNS_LAST_MODE, "Obtain automatically")) _DBG("Fail to set vconf");
113 if(vconf_set_str(WIRELESS_IP_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
114 if(vconf_set_str(WIRELESS_SUBMASK_KEY, "0.0.0.0")) _DBG("Fail to set vconf");
117 if(vconf_set_int(KEY_SYSTEM_CLOCK_MODE, 0)) _DBG("Fail to set vconf");
118 if(vconf_set_int(KEY_SLEEPTIMER, 0)) _DBG("Fail to set vconf");
119 if(vconf_set_int(KEY_SLEEPTIMER_TIMERID, 0)) _DBG("Fail to set vconf");
120 if(vconf_set_str(KEY_WAKEUP_TIMER_SETUP, "OFF")) _DBG("Fail to set vconf");
122 if(vconf_set_int(VCONF_KEY_24HOUR_MODE, 0)) _DBG("Fail to set vconf");
123 if(vconf_set_str(KEY_CHANGE_PASSCODE, "0000")) _DBG("Fail to set vconf");
124 if(vconf_set_int(KEY_SUBTITLE_LANGUAGE, 0)) _DBG("Fail to set vconf");
127 if(vconf_set_bool(KEY_CHANNEL_LOCK, false)) _DBG("Fail to set vconf");
129 /* Lang and Region */
130 if(vconf_set_str(KEY_SYSTEM_LANGUAGE, "en_US.UTF-8")) _DBG("Fail to set vconf");
131 if(vconf_set_str(KEY_SYSTEM_COUNTRY, "en_US.UTF-8")) _DBG("Fail to set vconf");
136 virtual void OnTerminate(void)
138 CSettingMgr::Finalize();
144 evas_object_del(ad.win);
149 virtual void OnAppControl(app_control_h app_control)
151 _DBG(" ******************* OnAppControl *********************");
155 unsigned int relaunch, refresh;
159 if (ad.app_control) {
160 app_control_get_extra_data(app_control, PARAM_SETTINGS_ITEM, ¶m);
161 if ((!param && !ad.item) ||
163 !strcmp(ad.item, param))) {
172 CSettingMgr::Finalize();
179 ad.mgr->ViewRefresh();
184 if (!CSettingMgr::Initialize(ad.win))
186 mgr = CSettingMgr::GetInstance();
188 r = app_control_get_extra_data(app_control, PARAM_SETTINGS_ITEM, ¶m);
189 if (r == APP_CONTROL_ERROR_NONE && param) {
190 if (!mgr->LaunchItem(param)) {
191 _ERR("the item is not exist.");
195 mgr->ViewPush(MAIN_CATALOG, NULL);
207 virtual int Run(int argc, char **argv) {
208 memset(&ad, 0x00, sizeof(_appdata));
211 return CBaseApp::Run(argc, argv);
215 int main(int argc, char **argv)