summaryrefslogtreecommitdiff
path: root/alarm-app/src/AlarmApp.cpp
blob: d668a958b19d216f8efd1c55f5c413870434c69b (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
/*
 * 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 "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)
{

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

	return nullptr;
}

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_extension_add(nullptr, App::getResourcePath(PATH_LIST_ITEM_STYLE).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_theme_extension_add(nullptr, App::getResourcePath(PATH_ADD_BUTTON_STYLE).c_str());

	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);
}