summaryrefslogtreecommitdiff
path: root/alarm-app/src/AlarmApp.cpp
blob: 8478f0537bd86e900d3de83bc1fe423b7b95d2cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * Copyright 2017 Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://floralicense.org/license/
 *
 * 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 "AlarmApp.h"
#include "App/Path.h"
#include "Ui/Window.h"
#include "Utils/Logger.h"

#include "AlertPath.h"
#include "AppsCommonButtons.h"
#include "AppsCommonList.h"
#include "CommonPath.h"
#include "DaySelectorPath.h"
#include "ListPath.h"

#include "OperationAddController.h"
#include "OperationAlertController.h"
#include "OperationDefaultController.h"
#include "OperationEditController.h"
#include "OperationPickController.h"

App::OperationController *AlarmApp::createController(const char *operation)
{
	bool showWindow = true;
	App::OperationController *controller = nullptr;

	if (strcmp(operation, APP_CONTROL_OPERATION_DEFAULT) == 0
	 || strcmp(operation, APP_CONTROL_OPERATION_MAIN) == 0) {
		controller = new OperationDefaultController();
	} else if (strcmp(operation, APP_CONTROL_OPERATION_ADD) == 0) {
		controller = new OperationAddController();
	} else if (strcmp(operation, APP_CONTROL_OPERATION_PICK) == 0) {
		controller = new OperationPickController();
	} else if (strcmp(operation, APP_CONTROL_OPERATION_EDIT) == 0) {
		controller = new OperationEditController();
	} else if (strcmp(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT) == 0) {
		showWindow = false;
		controller = new OperationAlertController();
	}

	if (showWindow) {
		evas_object_show(getWindow()->getEvasObject());
	}

	return controller;
}

bool AlarmApp::onCreate()
{
	bindtextdomain(TEXT_DOMAIN, App::getLocaleDir().c_str());
	textdomain(TEXT_DOMAIN);

	elm_theme_overlay_add(nullptr, App::getResourcePath(PATH_DAY_SELECTOR_LAYOUT).c_str());
	elm_theme_overlay_add(nullptr, App::getResourcePath(PATH_APPS_COMMON_LIST).c_str());
	elm_theme_overlay_add(nullptr, App::getResourcePath(PATH_APPS_COMMON_BUTTONS).c_str());

	elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALARM_CHECK_STYLE).c_str());
	elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALERT_BUTTON_STYLE).c_str());

	elm_config_focus_autoscroll_mode_set(ELM_FOCUS_AUTOSCROLL_MODE_NONE);
	Application::onCreate();
	getWindow()->setRotationEnabled(true);
	elm_atspi_accessible_translation_domain_set(getWindow()->getEvasObject(), TEXT_DOMAIN);
	elm_atspi_accessible_name_set(getWindow()->getEvasObject(), "WDS_ALM_HEADER_ALARM_ABB");

	return true;
}

int main(int argc, char *argv[])
{
	Utils::setLogTag("ALARM_APP");
	return AlarmApp().run(argc, argv);
}