*/
template <typename Type>
struct isDuration {
-
/**
* @brief Is duration flag
*
*/
template <typename Rep, typename Period>
struct isDuration <duration<Rep, Period>>{
-
/**
* @brief Is duration flag
*
int alarm_id_;
static app_control_h CreateAppControl(void);
-
};
} /* model */
namespace utils {
class Accessibility {
-
public:
/**
* @brief Sets text to read of the label part in layout object
*/
class Notifier {
public:
- virtual ~Notifier ();
+ virtual ~Notifier();
/**
* @brief Gets instance of the Notifier
static Eina_Bool IdlePostCb(void *data);
static Eina_Bool IdleDeleteCb(void *data);
-
};
} /* utils */
* Class managing sound during alarm's ring call.
*/
class SoundManager {
-
public:
/**
* @brief Creates sound stream
* @brief Releases player and sound stream handler.
*/
static void PlayerRelease(void);
-
};
} //namespace utils
* @return Evas_Object of the button
*/
Evas_Object *CreateSwipeButton(const char *group);
-
};
} //namespace view
* not touch any external resources directly except utils.
*/
class WorldClockDeleteItemsView: public PageView {
-
public:
/**
* @brief Callback called on time or timezone change.
*/
static void TimeChangedCb(system_settings_key_e key, void *user_data);
-
};
}
* not touch any external resources directly except utils.
*/
class WorldClockReorderView: public PageView {
-
public:
/**
if (!strcmp(opData, APP_CONTROL_OPERATION_DEFAULT)) {
main_ctrl_->Init();
} else if (!strcmp(opData, APP_CONTROL_OPERATION_ALARM)) {
-
char *alarmID = NULL;
ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_ALARM_ID, &alarmID);
MainController::~MainController()
{
-
}
void MainController::Pause()
{
-
}
void MainController::Resume()
{
-
}
Eina_Bool MainController::IdlerCb(void *data)
void MainController::CreateNewAlarmPage(Event &e)
{
-
delete edit_presenter_;
edit_presenter_ = new EditAlarmPresenter(provider_->GetAlarms(), edit_page_);
if (!laps_.empty()) {
Lap *last = laps_.back();
lap->SetTime(lap->GetSplitTime() - last->GetSplitTime());
- } else
+ } else {
lap->SetTime(lap->GetSplitTime());
+ }
lap->SetNo(laps_.size() + 1);
laps_.push_back(lap);
int ret = preference_get_int("WORLD_CLOCK_MAP_CURRENT_TIMEZONE", ¤t_tz);
if (ret != PREFERENCE_ERROR_NONE) {
-
ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &tz);
if (ret == SYSTEM_SETTINGS_ERROR_NONE) {
int offset = utils::Time::GetTimezoneOffset(tz);
SetCurrentTimezone(GetTimezoneByOffset(offset));
DBG("Current timezone set to:%s", tz);
- }
- else
+ } else {
SetCurrentTimezone(&time_zones_.at(current_tz));
- } else
+ }
+ } else {
SetCurrentTimezone(&time_zones_.at(current_tz));
+ }
}
WorldClock::~WorldClock()
{
if (!user_locations_.empty()) {
for (auto it = user_locations_.begin(); it != user_locations_.end(); it++) {
-
if (!(*it)->name.compare(l->name) && !(*it)->country.compare(l->country)) {
DBG("Location already exists in custom list");
return false;
void WorldClock::RemoveUserLocations(const std::vector<const model::Location *> &deleted)
{
for (auto d_it: deleted) {
-
for (auto it = user_locations_.begin(); it != user_locations_.end(); ++it) {
-
if (!((*it)->name.compare(d_it->name)) && !((*it)->country.compare(d_it->country))) {
OnUserLocationRemoved(**it);
user_locations_.erase(it);
it->GetWeekFlags(),
it->IsActivated(),
it->IsSnoozed());
- alarms_.insert(std::map<int, AlarmList::Iterator>::value_type (id, it));
+ alarms_.insert(std::map<int, AlarmList::Iterator>::value_type(id, it));
object_connections_.push_back(it->OnChanged.Connect(
std::bind(&AlarmListPresenter::OnAlarmEditedEvent, this, it)));
}
auto &alarm_it = it->second;
- if (alarm_it->IsSnoozed())
+ if (alarm_it->IsSnoozed()) {
alarm_it->Dismiss();
- else {
- if (alarm_it->IsActivated())
+ } else {
+ if (alarm_it->IsActivated()) {
alarm_it->Deactivate();
- else {
+ } else {
alarm_it->Activate();
if (alarm_it->GetWeekFlags().Empty()) {
alarm_it->SetTime(Time::GetUpcoming(alarm_it->GetTime()));
{
connections_.push_back(
view->OnCancelButtonClicked.Connect(
- std::bind(&DeleteAlarmPresenter::OnCancelButtonClicked, this)
- ));
+ std::bind(&DeleteAlarmPresenter::OnCancelButtonClicked, this)));
connections_.push_back(
view->OnDeleteButtonClicked.Connect(
- std::bind(&DeleteAlarmPresenter::OnDeleteButtonClicked, this)
- ));
+ std::bind(&DeleteAlarmPresenter::OnDeleteButtonClicked, this)));
view_->PushPage();
it->GetName().c_str(),
it->GetWeekFlags(),
it->IsActivated());
- alarms_.insert(std::map<int, AlarmList::Iterator>::value_type (id, --(it.base())));
+ alarms_.insert(std::map<int, AlarmList::Iterator>::value_type(id, --(it.base())));
}
}
alarm_it->Deactivate();
model_.Remove(alarm_it);
}
-
}
view_->PopPage();
}
if (update_target != model_.End()) {
UpdateAlarm(update_target);
ShowAlarmUpdatedPopup(update_target->GetTime());
- } else
+ } else {
CreateNewAlarm();
+ }
}
view_.PopPage();
model_->SetCurrentTimezone(model_->GetTimezoneByOffset(location->gmt_offset_));
OnMapViewUpdateRequest();
-
}
void WorldClockPresenter::OnMapViewUpdateRequest()
void WorldClockPresenter::OnItemAdded()
{
if (model_->user_locations_.size() >= USER_LOCATIONS_LIMIT) {
-
std::string message = Translate::Sprintf("IDS_CLOCK_TPOP_CANT_ADD_MORE_THAN_PD_CITIES",
USER_LOCATIONS_LIMIT);
}
for (int i = 0; i < count - 1; ++i) {
-
next = va_arg(args, Evas_Object *);
elm_atspi_accessible_relationship_append(current, ELM_ATSPI_RELATION_FLOWS_TO, next);
time.GetHour(),
time.GetMinute(),
0,
- 0
- );
+ 0);
return up;
}
std::tm Time::GetTmStruct() const
{
- std::tm tmstruct = {0,};
+ std::tm tmstruct = {0, };
i18n_ucalendar_h calendar;
I18nString u_zone(timezone_);
int32_t value;
{
int ret = 0;
- ui_app_lifecycle_callback_s event_callback = {0,};
+ ui_app_lifecycle_callback_s event_callback = {0, };
app_event_handler_h handler;
event_callback.create = app_create;
if (offset_remainder > 0)
relative = Translate::Sprintf("IDS_CLOCK_BODY_PS1D_H_P2SD_M_BEHIND_ABB",
offset_integer, offset_remainder);
- else {
+ else
relative = Translate::Sprintf("IDS_CLOCK_BODY_PD_H_BEHIND_ABB", offset_integer);
- }
} else if (timezone_offset > local_timezone_offset) {
if (offset_remainder > 0)
relative = Translate::Sprintf("IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB",
{
std::stringstream formatted_time;
- if (SystemSettings::Is24HourFormatPrefered()) {
+ if (SystemSettings::Is24HourFormatPrefered())
return nullptr;
- }
- else {
+ else
formatted_time << time.Format(Time::FORMAT_TIME_AMPM);
- }
return strdup(formatted_time.str().c_str());
}
std::stringstream text;
std::stringstream subtext;
- if (type_ == CounterType::COUNTER_TYPE_TIMER && hour <= 0)
+ if (type_ == CounterType::COUNTER_TYPE_TIMER && hour <= 0) {
text << "00:";
- else if (hour > 0) {
+ } else if (hour > 0) {
text << (hour < 10 ? "0" : "") << hour << ":";
Expand();
}
{
std::stringstream formatted_time;
- if (SystemSettings::Is24HourFormatPrefered()) {
+ if (SystemSettings::Is24HourFormatPrefered())
return nullptr;
- }
- else {
+ else
formatted_time << time.Format(Time::FORMAT_TIME_AMPM);
- }
return strdup(formatted_time.str().c_str());
}
// left toolbar button
left_btn_ = elm_button_add(parent);
- elm_object_translatable_text_set(left_btn_,"IDS_COM_SK_CANCEL");
+ elm_object_translatable_text_set(left_btn_, "IDS_COM_SK_CANCEL");
elm_object_style_set(left_btn_, "naviframe/title_left");
evas_object_smart_callback_add(left_btn_, "clicked", OnCancelButtonClickedCb, this);
evas_object_show(left_btn_);
Elm_Datetime_Time edt;
if (elm_datetime_value_get(obj, &edt)) {
-
auto time = ConvertElmDatetimeTimeToTime(edt);
view->data_.time = Time(
view->data_.time.GetYear(),
time.GetHour(),
time.GetMinute(),
0,
- 0
- );
+ 0);
view->data_.time = Time::GetUpcoming(view->data_.time);
view->UpdateView();
void EditAlarmView::UpdateAlarmType(bool mute)
{
- if (mute)
- {
+ if (mute) {
if (data_.type == model::Alarm::Type::SOUND_ONLY)
data_.type = model::Alarm::Type::VIBRATION;
- }
- else
- {
+ } else {
if (data_.type == model::Alarm::Type::VIBRATION)
data_.type = model::Alarm::Type::SOUND_ONLY;
}
}
void EditAlarmView::PopupDatePickerCreateCalendar() {
-
if (!datepicker_popup_)
return;
view->data_.time.GetHour(),
view->data_.time.GetMinute(),
0,
- 0
- );
+ 0);
view->data_.flags.Clear();
void EditAlarmView::UpdateTime(Time time)
{
if (data_.flags.Empty()) {
- if (time > Time::Now())
+ if (time > Time::Now()) {
data_.time = time;
- else {
+ } else {
data_.time = Time::GetUpcoming(time);
PopupManager::CreatePopup(*this,
"Can't set alarms for time in past. Tomorrow's date set.", 3.0);
data_.time.GetHour(),
data_.time.GetMinute(),
0,
- 0
- );
+ 0);
}
}
void EditAlarmView::ShowDatePickerPopup() {
-
if (datepicker_popup_)
return;
}
void EditAlarmView::HideDatePickerPopup() {
-
if (!datepicker_popup_)
return;
itc->func.text_get = [](void *data, Evas_Object *o, const char *part) -> char * {
EditAlarmView *view = static_cast<EditAlarmView*>(data);
if (!strcmp(part, "elm.text.date")) {
-
if (view->data_.flags.Empty())
return strdup(view->GetDate().c_str());
else
EditAlarmView *view = static_cast<EditAlarmView*>(data);
if (!strcmp(part, "elm.swallow.btn")) {
-
Evas_Object *btn = elm_button_add(o);
if (!elm_object_style_set(btn, "resizable"))
itc->item_style = "full";
itc->func.text_get = nullptr;
itc->func.content_get = [](void *data, Evas_Object *o, const char *part) -> Evas_Object* {
-
EditAlarmView *view = static_cast<EditAlarmView*>(data);
Evas_Object *dt = elm_datetime_add(o);
void StopWatchView::ResumeButtonClicked(void *data, Evas_Object *obj, void *event_info)
{
-
StopWatchView *object = static_cast<StopWatchView *>(data);
object->OnResumeButtonClicked();
}
const char *part = static_cast<const char *>(data);
int val = std::atoi(text);
- if (val > (strcmp(part, "sw.entry.hour") ? 59 : 99))
+ if (val > (strcmp(part, "sw.entry.hour") ? 59 : 99)) {
elm_entry_entry_set(obj, std::to_string(59).c_str());
- else if (val < 10) {
+ } else if (val < 10) {
std::stringstream stream;
stream << "0" << val;
elm_entry_entry_set(obj, stream.str().c_str());
object->counter_->DisplayTime(
object->set_time_.Hour,
object->set_time_.Min,
- object->set_time_.Sec
- );
+ object->set_time_.Sec);
Evas_Object *entry = static_cast<Evas_Object *>(obj);
elm_atspi_accessible_relationship_append(desc->check, ELM_ATSPI_RELATION_DESCRIPTION_FOR, it);
elm_atspi_accessible_relationship_append(it, ELM_ATSPI_RELATION_DESCRIBED_BY, desc->check);
check_boxes_.push_back(desc);
-
}
const char *WeekFlagsView::GetLabelForWeekDay(WeekDay day)
/* Delete list View */
-Elm_Genlist_Item_Class WorldClockDeleteItemsView::world_clock_delete_view_itc_= {
+Elm_Genlist_Item_Class WorldClockDeleteItemsView::world_clock_delete_view_itc_ = {
0, 0, EINA_FALSE, EINA_TRUE,
"worldclock.delete/reorder.list", nullptr, nullptr,
{ WorldClockDeleteItemsView::TextGet,
"edje/WorldClockDeleteReorderList.edj"));
left_button_ = elm_button_add(parent);
- elm_object_translatable_text_set(left_button_,"IDS_COM_SK_CANCEL");
+ elm_object_translatable_text_set(left_button_, "IDS_COM_SK_CANCEL");
elm_object_style_set(left_button_, "naviframe/title_left");
evas_object_smart_callback_add(left_button_, "clicked",
WorldClockDeleteItemsView::CancelButtonClicked, this);
}
cairo_move_to(line_cairo_, (mapW - *it)/2.0,
((it - day_times_.begin())/180.0 * mapH));
- } else
+ } else {
cairo_line_to(line_cairo_, (mapW - *it)/2.0, ((it - day_times_.begin())/180.0 * mapH));
+ }
}
break;
}
cairo_move_to(line_cairo_, (mapW + *it)/2.0, (idx/180.0 * mapH));
- } else
+ } else {
cairo_line_to(line_cairo_, (mapW + *it)/2.0, (idx/180.0 * mapH));
+ }
}
cairo_stroke(line_cairo_);
/* Custom list View */
-Elm_Genlist_Item_Class WorldClockView::world_clock_itc_= {
+Elm_Genlist_Item_Class WorldClockView::world_clock_itc_ = {
0, 0, EINA_FALSE, EINA_TRUE,
"worldclock.custom.list", nullptr, nullptr,
{ WorldClockView::TextGet,
if (!strcmp(part, "gmt.offset.desc"))
return strdup(lid->gmt_offset_relative);
if (!strcmp(part, "time")) {
-
Time t = Time::Now().InTimezone(lid->location->tzpath.c_str());
std::string timezone_time;
timezone_splited = eina_str_split_full(&timezone[1], ":", 2, &elements);
- if (elements == 1)
+ if (elements == 1) {
h = atoi(timezone_splited[0]);
- else if (elements == 2) {
+ } else if (elements == 2) {
h = atoi(timezone_splited[0]);
min = atoi(timezone_splited[1]);
}
int gmt_offset = (60*h + min) * ((timezone[0] == '-') ? (-1) : (1));
model::Location *l = new model::Location{ std::string(city_name),
- std::string(country_name), gmt_offset, 0, 0, false, std::string(tzpath),};
+ std::string(country_name), gmt_offset, 0, 0, false, std::string(tzpath), };
WorldClockView *view = static_cast<WorldClockView *>(user_data);
view->SetItemToAdd(l);
msg->count = 4;
for (unsigned int i = 0; i < 8; i++) {
-
if (i >= timezone->places.size()) {
msg->val[0] = 100;
msg->val[1] = 100;
evas_object_size_hint_align_set(timezone_cities_, EVAS_HINT_FILL, 0.0);
elm_label_ellipsis_set(timezone_cities_, EINA_TRUE);
- evas_object_show (timezone_cities_);
+ evas_object_show(timezone_cities_);
elm_layout_content_set(world_clock_, TIMEZONE_DETAILS_SECOND_LINE_PART,
timezone_cities_);