#include "Utils/Log.h"
#include "Utils/ObservableObject.h"
-namespace model {
+namespace common {
typedef int AlarmId;
/**
* @brief Alarm is a wrapper class arount platform's alarm system.
*
* @see GetTime()
*/
- WeekFlags GetWeekFlags() const;
+ common::WeekFlags GetWeekFlags() const;
/**
* @brief Set week flags of alarm.
* @param[in] flags new week flags for alarm.
*/
- void SetWeekFlags(WeekFlags flags);
+ void SetWeekFlags(common::WeekFlags flags);
/**
* @brief Serialize Alarm using writer interface
double volume;
} sound;
std::string vibration;
- WeekFlags flags;
+ common::WeekFlags flags;
bool activated = false;
bool snooze_enabled;
Type type_ = Type::VIBRATION_AND_SOUND;
#include "Utils/EventBus.h"
#include "Common/AlarmList.h"
-namespace model {
+namespace common {
/**
* @brief Global event that is broadcast request to create new
* alarm.
* @param[in] list alarm list which is a target of edition.
* @param[in] it iterator to element within list.
*/
- AlarmEditRequestEvent(model::AlarmList& list, model::AlarmList::Iterator it)
+ AlarmEditRequestEvent(common::AlarmList& list, common::AlarmList::Iterator it)
: alarm_list_(list), it_(it) {}
/**
* @brief Gets modification target
* @return List with alarm to be edited.
*/
- model::AlarmList &GetAlarmList() { return alarm_list_;}
+ common::AlarmList &GetAlarmList() { return alarm_list_;}
/**
* @brief Gets modification target iterator
* @return Alarm to be edited.
*/
- model::AlarmList::Iterator &GetIterator() { return it_;}
+ common::AlarmList::Iterator &GetIterator() { return it_;}
private:
- model::AlarmList &alarm_list_;
- model::AlarmList::Iterator it_;
- };
-
- /**
- * @brief Global event that is broadcast information that alarm
- * data has been modified.
- */
- class AlarmEditedEvent : public utils::Event {
- public:
- /**
- * @brief Creates AlarmEditedEvent instance
- * @param[in] alarm alarm which has been edited.
- */
- AlarmEditedEvent(model::Alarm& alarm) : alarm_(alarm) {}
- /**
- * @brief Gets modification target
- * @return Alarm which have been edited.
- */
- Alarm &GetAlarm() const { return alarm_;}
- private:
- Alarm &alarm_;
+ common::AlarmList &alarm_list_;
+ common::AlarmList::Iterator it_;
};
} /* model */
#include "Common/Alarm.h"
#include "Utils/Log.h"
-namespace model {
+namespace common {
/**
* @brief AlarmList is an observable list of alarms with limited size.
*/
- class AlarmList : public utils::ObservableList<model::Alarm>, utils::ISerializable
+ class AlarmList : public utils::ObservableList<common::Alarm>, utils::ISerializable
{
public:
/**
* @brief AlarmList iterator
*/
- typedef utils::ObservableList<model::Alarm>::Iterator Iterator;
+ typedef utils::ObservableList<common::Alarm>::Iterator Iterator;
/**
* @brief Default AlarmList constructor
*
* @return Iterator to last element
*/
- Iterator Add(model::Alarm &alarm)
+ Iterator Add(common::Alarm &alarm)
{
if (Size() >= max_size_)
return End();
- return utils::ObservableList<Alarm>::Add(alarm);
+ return utils::ObservableList<common::Alarm>::Add(alarm);
}
/**
#include <Ecore.h>
#include <tizen.h>
-namespace model {
+namespace common {
/**
* @brief Class providing list of currently registered alarms.
*/
/**
* @brief Returns reference to observable list of alarms
*/
- model::AlarmList& GetAlarms();
+ common::AlarmList& GetAlarms();
private:
- model::AlarmList alarms_;
+ common::AlarmList alarms_;
Ecore_Idler *idler_job_;
void Sync();
void ScheduleSync();
bool HasActiveAlarms();
static Eina_Bool IdlerCallback(void *data);
- void AlarmListChanged(model::AlarmList::Iterator it);
+ void AlarmListChanged(common::AlarmList::Iterator it);
std::vector<utils::Connection> connections_;
};
} /* model */
#include <Ecore.h>
#include "Utils/Log.h"
-namespace model {
+namespace common {
using namespace std::chrono;
#include "Common/View.h"
-namespace view {
+namespace common {
/**
* @brief Counter's type enum
* Class displays ui view of the counter, changes its values during running state,
* and responds on user's activities.
*/
- class EXPORT_API CounterView : public ui::IView {
+ class EXPORT_API CounterView : public common::IView {
public:
/**
* @brief Constructor
* @param[in] parent parent View
* @param[in] type type of counter
*/
- CounterView(ui::IView &parent, CounterType type = CounterType::COUNTER_TYPE_STOPWATCH);
+ CounterView(common::IView &parent, CounterType type = CounterType::COUNTER_TYPE_STOPWATCH);
~CounterView();
/**
#ifndef _CLOCK_COMMON_DEFINES_H_
#define _CLOCK_COMMON_DEFINES_H_
-#define PACKAGE "org.tizen.clock"
+#define PACKAGE_CLOCK "org.tizen.clock"
+#define PACKAGE_RING "org.tizen.clock-ring"
#define APP_CONTROL_OPERATION_TIMEOUT "http://tizen.org/appcontrol/operation/timeout"
#define APP_CONTROL_OPERATION_ALARM "http://tizen.org/appcontrol/operation/alarm"
#define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0])
#define DEFAULT_RINGTONE_PATH "ringtones/alarm.mp3"
-#if !defined(PACKAGE)
-#define PACKAGE "org.tizen.clock"
-#endif
-
#define EDJ_FILE "edje/clock.edj"
#define GRP_MAIN "main"
#include "Utils/EventBus.h"
#include "Common/Alarm.h"
-namespace model {
+namespace common {
/**
* @brief Ring dismiss event class
*
* @param[in] alarm The alarm passed with event
*/
- RingNewAlarmEvent(Alarm &alarm) : alarm_(&alarm) {};
+ RingNewAlarmEvent(common::Alarm &alarm) : alarm_(&alarm) {};
/**
* @brief Gets event's alarm
*
* @return The handled alarm
*/
- Alarm *GetAlarm(void) const { return alarm_; };
+ common::Alarm *GetAlarm(void) const { return alarm_; };
private:
- Alarm *alarm_;
+ common::Alarm *alarm_;
};
}
#include <Elementary.h>
-namespace ui {
+namespace common {
/**
* @brief Abstract interface representing Native UI toolkit object.
*/
#include <app_alarm.h>
-namespace model {
+namespace common {
/** @brief Week flag enumarator */
enum class EXPORT_API WeekDay : int {
MONDAY = ALARM_WEEK_FLAG_MONDAY,
* @param[in] timeout The time after popup will be destroyed
*
*/
- static void CreatePopup(ui::IView &parent, const std::string &text, double timeout = 2.0);
+ static void CreatePopup(common::IView &parent, const std::string &text, double timeout = 2.0);
/**
* @brief Destroys currently visible toast popup.
/**
* @brief Gets first day of the week for current calendar.
*/
- static model::WeekDay GetFirstDayOfWeek();
+ static common::WeekDay GetFirstDayOfWeek();
SystemSettings() = delete;
SystemSettings(const SystemSettings &) = delete;
#include "Utils/Log.h"
#include "Utils/Comparators.h"
-using namespace model;
using namespace utils;
+using namespace common;
static app_control_h AppControlCreate()
{
return NULL;
}
- err = app_control_set_app_id(ctrl, PACKAGE);
+ err = app_control_set_app_id(ctrl, PACKAGE_CLOCK);
if (err != APP_CONTROL_ERROR_NONE) {
ERR("app_control_set_app_id failed: %s", get_error_message(err));
app_control_destroy(ctrl);
return activated;
}
-void model::Serialize(IWriter &w, Alarm::Type type)
+void common::Serialize(IWriter &w, Alarm::Type type)
{
utils::Serialize(w, static_cast<int>(type));
}
-void model::Deserialize(IReader &r, Alarm::Type &type)
+void common::Deserialize(IReader &r, Alarm::Type &type)
{
int tmp;
utils::Deserialize(r, tmp);
utils::Deserialize(r, name);
utils::Deserialize(r, sound.melody);
utils::Deserialize(r, sound.volume);
- model::Deserialize(r, type_);
+ common::Deserialize(r, type_);
utils::Deserialize(r, flags);
utils::Deserialize(r, activated);
utils::Deserialize(r, snooze_enabled);
utils::Serialize(w, name);
utils::Serialize(w, sound.melody);
utils::Serialize(w, sound.volume);
- model::Serialize(w, type_);
+ common::Serialize(w, type_);
utils::Serialize(w, flags);
utils::Serialize(w, activated);
utils::Serialize(w, snooze_enabled);
const int MAX_ALARMS = 20;
-using namespace model;
using namespace utils;
+using namespace common;
using std::placeholders::_1;
AlarmProvider::AlarmProvider() : idler_job_(nullptr)
return EINA_FALSE;
}
-void AlarmProvider::AlarmListChanged(model::AlarmList::Iterator it)
+void AlarmProvider::AlarmListChanged(common::AlarmList::Iterator it)
{
ScheduleSync();
}
#define SIGNAL_SET_COUNTER_LAP "counter,lap,set"
#define SIGNAL_SET_COUNTER_HIDDEN "counter,hidden,set"
-namespace view {
+namespace common {
const char *CounterView::EDJE_FILE = "edje/Counter.edj";
const char *CounterView::GROUP = "Counter";
-CounterView::CounterView(ui::IView &parent, CounterType type)
+CounterView::CounterView(common::IView &parent, CounterType type)
{
Evas_Object *parentEo = parent.GetEvasObject();
layout_ = elm_layout_add(parentEo);
#include <Common/WeekFlags.h>
#include <Utils/Log.h>
-using namespace model;
+using namespace common;
WeekFlags::WeekFlags() {
raw_flags = 0;
{
switch (day)
{
- case model::WeekDay::SUNDAY:
- return model::WeekDay::MONDAY;
- case model::WeekDay::MONDAY:
- return model::WeekDay::TUESDAY;
- case model::WeekDay::TUESDAY:
- return model::WeekDay::WEDNESDAY;
- case model::WeekDay::WEDNESDAY:
- return model::WeekDay::THURSDAY;
- case model::WeekDay::THURSDAY:
- return model::WeekDay::FRIDAY;
- case model::WeekDay::FRIDAY:
- return model::WeekDay::SATURDAY;
- case model::WeekDay::SATURDAY:
- return model::WeekDay::SUNDAY;
+ case common::WeekDay::SUNDAY:
+ return common::WeekDay::MONDAY;
+ case common::WeekDay::MONDAY:
+ return common::WeekDay::TUESDAY;
+ case common::WeekDay::TUESDAY:
+ return common::WeekDay::WEDNESDAY;
+ case common::WeekDay::WEDNESDAY:
+ return common::WeekDay::THURSDAY;
+ case common::WeekDay::THURSDAY:
+ return common::WeekDay::FRIDAY;
+ case common::WeekDay::FRIDAY:
+ return common::WeekDay::SATURDAY;
+ case common::WeekDay::SATURDAY:
+ return common::WeekDay::SUNDAY;
default:
FAT("Invalid WeekDay");
- return model::WeekDay::MONDAY;
+ return common::WeekDay::MONDAY;
}
}
Evas_Object *PopupManager::popup_;
-void PopupManager::CreatePopup(ui::IView &parent, const std::string &text, double timeout)
+void PopupManager::CreatePopup(common::IView &parent, const std::string &text, double timeout)
{
if (popup_)
DestroyPopup();
return is_24hour_format_prefered_;
}
-static model::WeekDay ucalendar_weekday_to_clock_weekday(int32_t i18n_weekday)
+static common::WeekDay ucalendar_weekday_to_clock_weekday(int32_t i18n_weekday)
{
switch (i18n_weekday)
{
case I18N_UCALENDAR_SUNDAY:
- return model::WeekDay::SUNDAY;
+ return common::WeekDay::SUNDAY;
case I18N_UCALENDAR_MONDAY:
- return model::WeekDay::MONDAY;
+ return common::WeekDay::MONDAY;
case I18N_UCALENDAR_TUESDAY:
- return model::WeekDay::TUESDAY;
+ return common::WeekDay::TUESDAY;
case I18N_UCALENDAR_WEDNESDAY:
- return model::WeekDay::WEDNESDAY;
+ return common::WeekDay::WEDNESDAY;
case I18N_UCALENDAR_THURSDAY:
- return model::WeekDay::THURSDAY;
+ return common::WeekDay::THURSDAY;
case I18N_UCALENDAR_FRIDAY:
- return model::WeekDay::FRIDAY;
+ return common::WeekDay::FRIDAY;
case I18N_UCALENDAR_SATURDAY:
- return model::WeekDay::SATURDAY;
+ return common::WeekDay::SATURDAY;
default:
FAT("Invalid I18N weekday value: %d", i18n_weekday);
- return model::WeekDay::MONDAY;
+ return common::WeekDay::MONDAY;
}
}
-model::WeekDay SystemSettings::GetFirstDayOfWeek()
+common::WeekDay SystemSettings::GetFirstDayOfWeek()
{
i18n_ucalendar_h calendar;
int err;
if (err != I18N_ERROR_NONE)
{
ERR("i18n_ucalendar_create failed: %s", get_error_message(err));
- return model::WeekDay::MONDAY;
+ return common::WeekDay::MONDAY;
}
err = i18n_ucalendar_get_attribute(calendar, I18N_UCALENDAR_FIRST_DAY_OF_WEEK, &weekday);
{
ERR("i18n_ucalendar_get_attribute failed: %s", get_error_message(err));
i18n_ucalendar_destroy(calendar);
- return model::WeekDay::MONDAY;
+ return common::WeekDay::MONDAY;
}
i18n_ucalendar_destroy(calendar);
*
* @param[in] list AlarmList object
*/
- RingController(model::AlarmList &list);
+ RingController(common::AlarmList &list);
~RingController();
/**
presenter::RingPresenter *presenter_;
model::Ring *model_;
view::RingView *view_;
- model::AlarmList &list_;
+ common::AlarmList &list_;
utils::Connection listener_;
void RingCreate(void);
void RingDestroy(utils::Event &e);
- model::Alarm *GetAlarmWithId(int alarmID);
+ common::Alarm *GetAlarmWithId(int alarmID);
};
} //namespace model
*
* @return True on success, otherwise false.
*/
- bool AlarmAdd(Alarm *alarm, RingType type);
+ bool AlarmAdd(common::Alarm *alarm, RingType type);
/**
* @brief Snoozes alarm.
/**
* @brief Returns currently handled alarm.
*/
- Alarm *GetAlarm() const;
+ common::Alarm *GetAlarm() const;
/**
* @brief Return type of the currently handled alarm.
*
* @return Reference to the Counter object
*/
- const Counter<std::chrono::seconds> &GetCounter() const { return (counter_); };
+ const common::Counter<std::chrono::seconds> &GetCounter() const { return (counter_); };
private:
- Alarm *alarm_;
+ common::Alarm *alarm_;
RingType ring_type_;
- Counter<std::chrono::seconds> counter_;
+ common::Counter<std::chrono::seconds> counter_;
void SoundPlay();
void SoundStop();
private:
view::RingView &view_;
model::Ring &model_;
- model::Alarm *alarm_ = nullptr;
+ common::Alarm *alarm_ = nullptr;
std::vector<utils::Connection> connections_;
*/
bool OnCreate() override;
private:
- model::AlarmProvider *provider_ = nullptr;
+ common::AlarmProvider *provider_ = nullptr;
controller::RingController *ring_ctrl_ = nullptr;
};
* Class creates and displays ring alarm view that shows incoming alarm's
* major information and provides dismiss and snooze options for user.
*/
- class RingView : public ui::IView {
+ class RingView : public common::IView {
public:
/**
* @brief Creates class object and ring view.
Evas_Object *dismissButton_ = NULL;
Evas_Object *snoozeButton_ = NULL;
- view::CounterView *counter_ = NULL;
+ common::CounterView *counter_ = NULL;
static const char *GROUP;
static const char *EDJE_FILE;
namespace controller {
-RingController::RingController(model::AlarmList &list) :
+RingController::RingController(common::AlarmList &list) :
presenter_(nullptr), model_(nullptr), view_(nullptr), list_(list)
{
- listener_ = utils::EventBus::AddListener<model::RingDismissEvent>(std::bind(&RingController::RingDestroy,
+ listener_ = utils::EventBus::AddListener<common::RingDismissEvent>(std::bind(&RingController::RingDestroy,
this, std::placeholders::_1));
}
{
}
-model::Alarm *RingController::GetAlarmWithId(int alarmID)
+common::Alarm *RingController::GetAlarmWithId(int alarmID)
{
auto it = std::find(list_.Begin(), list_.End(), alarmID);
void RingController::HandleAlarm(int alarmID)
{
- model::Alarm *alarm = GetAlarmWithId(alarmID);
+ common::Alarm *alarm = GetAlarmWithId(alarmID);
if (!alarm) {
ERR("Alarm not found");
RingCreate();
- model::RingNewAlarmEvent ev(*alarm);
+ common::RingNewAlarmEvent ev(*alarm);
utils::EventBus::FireEvent(ev);
}
{
RingCreate();
- model::RingTimeoutEvent ev;
+ common::RingTimeoutEvent ev;
utils::EventBus::FireEvent(ev);
}
#define DEFAULT_SOUND_PATH "ringtones/alarm.mp3"
+using namespace common;
+
namespace model {
Ring::Ring() : alarm_(NULL), ring_type_(RingType::RING_TYPE_NONE)
connections_.push_back(view_.OnSnoozeButtonClicked.Connect(
std::bind(&RingPresenter::SnoozeButtonClicked, this)));
- connections_.push_back(utils::EventBus::AddListener<model::RingNewAlarmEvent>(
+ connections_.push_back(utils::EventBus::AddListener<common::RingNewAlarmEvent>(
std::bind(&RingPresenter::AlarmHandle,
this, std::placeholders::_1)));
- connections_.push_back(utils::EventBus::AddListener<model::RingTimeoutEvent>(
+ connections_.push_back(utils::EventBus::AddListener<common::RingTimeoutEvent>(
std::bind(&RingPresenter::TimeoutHandle,
this, std::placeholders::_1)));
}
animator_.Remove();
- model::RingDismissEvent ev;
+ common::RingDismissEvent ev;
utils::EventBus::FireEvent(ev);
}
animator_.Remove();
- model::RingDismissEvent ev;
+ common::RingDismissEvent ev;
utils::EventBus::FireEvent(ev);
}
void RingPresenter::AlarmHandle(utils::Event &e)
{
- model::RingNewAlarmEvent &event = dynamic_cast<model::RingNewAlarmEvent &>(e);
+ common::RingNewAlarmEvent &event = dynamic_cast<common::RingNewAlarmEvent &>(e);
animator_.Remove();
- model::Alarm *alarm = event.GetAlarm();
+ common::Alarm *alarm = event.GetAlarm();
model_.AlarmAdd(alarm, alarm ? model::RingType::RING_TYPE_ALARM : model::RingType::RING_TYPE_TIMER);
}
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
- provider_ = new model::AlarmProvider();
+ provider_ = new common::AlarmProvider();
ring_ctrl_ = new controller::RingController(provider_->GetAlarms());
return true;
void RingView::ShowCounter()
{
if (!counter_)
- counter_ = new view::CounterView(*this, view::CounterType::COUNTER_TYPE_TIMER);
+ counter_ = new common::CounterView(*this, common::CounterType::COUNTER_TYPE_TIMER);
SetMainContent(counter_->GetEvasObject());
<comment></comment>
<projects>
<project>clock-common</project>
+ <project>clock-ring</project>
</projects>
<buildSpec>
<buildCommand>
*/
bool OnCreate() override;
private:
- model::AlarmProvider *provider_ = nullptr;
+ common::AlarmProvider *provider_ = nullptr;
controller::MainController *main_ctrl_ = nullptr;
};
/**
* @brief Constructs MainController class object.
*/
- MainController(model::AlarmProvider*);
+ MainController(common::AlarmProvider*);
/**
* @brief Destructor.
*/
void CreateNewWorldClockReorderPage(utils::Event &e);
- model::AlarmProvider *provider_;
+ common::AlarmProvider *provider_;
model::WorldClock *world_clock_model_;
model::StopWatch *stop_watch_model_;
* adding new record into the list with AddLap(), getting total amount of laps
* in list with GetLapsCount(), receiving last stored lap with GetLastLap().
*/
- class StopWatch : public Counter<milliseconds> {
+ class StopWatch : public common::Counter<std::chrono::milliseconds> {
public:
/**
* @brief Clears list of stored laps and their times
#include "Common/Counter.h"
-using namespace std::chrono;
-
namespace model {
/**
* Running Timer by user provide setting time in this object and register
* alarm in database. Stopping timer unregister alarm.
*/
- class Timer : public Counter<seconds> {
+ class Timer : public common::Counter<std::chrono::seconds> {
public:
Timer();
~Timer();
*
* @param[in] time Time in seconds
*/
- void SetTime(seconds time);
+ void SetTime(std::chrono::seconds time);
/**
* @brief Activates alarm after delay.
*
* @return Remaining time in std::chrono::seconds
*/
- seconds GetRemainingTime(void);
+ std::chrono::seconds GetRemainingTime(void);
private:
- seconds remaining_time_ = seconds(0);
+ std::chrono::seconds remaining_time_ = std::chrono::seconds(0);
int alarm_id_ = 0;
* @param view AlarmListView instance which presenter will be managing
* @param list AlarmList instance which presenter will be managing
*/
- AlarmListPresenter(view::AlarmListView &view, model::AlarmList &list);
+ AlarmListPresenter(view::AlarmListView &view, common::AlarmList &list);
~AlarmListPresenter();
private:
view::AlarmListView &view_;
- model::AlarmList &alarm_list_;
+ common::AlarmList &alarm_list_;
void ShowAll();
void OnItemSelected(int idx);
void OnAddButtonClicked();
void OnItemActiveStatusChanged(int idx);
- void OnAlarmAddedEvent(model::AlarmList::Iterator e);
- void OnAlarmRemovedEvent(model::AlarmList::Iterator e);
- void OnAlarmEditedEvent(model::AlarmList::Iterator e);
+ void OnAlarmAddedEvent(common::AlarmList::Iterator e);
+ void OnAlarmRemovedEvent(common::AlarmList::Iterator e);
+ void OnAlarmEditedEvent(common::AlarmList::Iterator e);
void OnDeleteItemClicked();
void UpdateBackgroundLabel();
- void AddItem(model::AlarmList::Iterator iterator);
- std::map<int, model::AlarmList::Iterator> alarms_;
+ void AddItem(common::AlarmList::Iterator iterator);
+ std::map<int, common::AlarmList::Iterator> alarms_;
std::vector<utils::Connection> connections_;
std::vector<utils::Connection> object_connections_;
bool CheckModelSizeLimit();
* @param view DeleteAlarmView instance which presenter will be managing
* @param model AlarmList instance which presenter will be managing
*/
- DeleteAlarmPresenter(view::DeleteAlarmView &view, model::AlarmList &model);
+ DeleteAlarmPresenter(view::DeleteAlarmView &view, common::AlarmList &model);
~DeleteAlarmPresenter();
private:
view::DeleteAlarmView &view_;
- model::AlarmList &alarm_list_;
+ common::AlarmList &alarm_list_;
void OnDeleteButtonClicked();
void OnCancelButtonClicked();
std::vector<utils::Connection> connections_;
- std::map<int, model::AlarmList::Iterator> alarms_;
+ std::map<int, common::AlarmList::Iterator> alarms_;
};
} /* presenter */
* @param model AlarmList instance which presenter will be managing
* @param it the iterator to element in model to be edited.
*/
- EditAlarmPresenter(view::EditAlarmView &view, model::AlarmList &model, model::AlarmList::Iterator it);
+ EditAlarmPresenter(view::EditAlarmView &view, common::AlarmList &model, common::AlarmList::Iterator it);
/**
* @brief Construct new presenter for new alarm creation.
* @param view instance which presenter will be managing
* @param model AlarmList instance which presenter will be managing
*/
- EditAlarmPresenter(view::EditAlarmView &view, model::AlarmList &model);
+ EditAlarmPresenter(view::EditAlarmView &view, common::AlarmList &model);
~EditAlarmPresenter();
private:
- model::AlarmList &alarm_list_;
- model::AlarmList::Iterator iterator_;
+ common::AlarmList &alarm_list_;
+ common::AlarmList::Iterator iterator_;
view::EditAlarmView &view_;
view::EditAlarmView::AlarmViewInfo info_;
void OnEditDone();
void OnEditCancel();
view::EditAlarmView::AlarmViewInfo GetDefaultInfo() const;
- view::EditAlarmView::AlarmViewInfo GetInfoForAlarm(const model::Alarm &alarm) const;
- void SetAlarmProperties(model::Alarm &alarm, const view::EditAlarmView::AlarmViewInfo &data);
+ view::EditAlarmView::AlarmViewInfo GetInfoForAlarm(const common::Alarm &alarm) const;
+ void SetAlarmProperties(common::Alarm &alarm, const view::EditAlarmView::AlarmViewInfo &data);
void CreateNewAlarm();
- void UpdateAlarm(model::AlarmList::Iterator it);
- model::AlarmList::Iterator GetMatchingAlarm(const std::string &name, const utils::Time &time);
+ void UpdateAlarm(common::AlarmList::Iterator it);
+ common::AlarmList::Iterator GetMatchingAlarm(const std::string &name, const utils::Time &time);
void ShowAlarmUpdatedPopup(const utils::Time &time);
void OnBackButton();
void OnDiscardPopupOptionClicked(view::EditAlarmView::DiscardPopupOption option);
#include "View/StopWatchView.h"
#include "Common/CounterView.h"
-#include "View/View.h"
+#include "Common/View.h"
#include "Utils/Signal.h"
#include "Model/StopWatch.h"
#include "Common/CounterAnimator.h"
#ifndef ALARMVIEW_H_
#define ALARMVIEW_H_
-#include "View/View.h"
+#include "Common/View.h"
#include "Common/WeekFlags.h"
#include "Utils/Signal.h"
#include "Utils/Time.h"
*
* @note additionally displays "+" button and can display menu popup
*/
- class AlarmListView : public ui::IView {
+ class AlarmListView : public common::IView {
public:
typedef uintptr_t ItemId;
/**
* @param[in] main The main view object
*
*/
- AlarmListView(ui::IView &main);
+ AlarmListView(common::IView &main);
/**
* @brief Clear all items.
* @return return item identiefier.
*/
ItemId ItemPrepend(utils::Time time, const char *name,
- const model::WeekFlags flags, bool active, bool is_snoozed);
+ const common::WeekFlags flags, bool active, bool is_snoozed);
/**
* @brief Remove item from view.
* @param[in] is_snoozed item snooze status.
*/
void ItemUpdate(ItemId id, utils::Time time, const char *name,
- const model::WeekFlags flags, bool active, bool is_snoozed);
+ const common::WeekFlags flags, bool active, bool is_snoozed);
/**
* @brief Signal emitted when user clicked "delete" item on Delete popup
void CreateNoContentLayout(Evas_Object *parent);
static void SetItemCheckboxStatus(Elm_Object_Item *item, bool is_snoozed);
static void SetItemActiveStatus(Elm_Object_Item *it, bool active);
- static void SetItemVisibleDateOnly(Elm_Object_Item *it, model::WeekFlags flags);
+ static void SetItemVisibleDateOnly(Elm_Object_Item *it, common::WeekFlags flags);
static void SetCheckboxStatus(Evas_Object *check, bool is_snoozed);
static void UpdateItemData(ItemData *data);
};
* @return item identifier.
*/
int ItemAppend(utils::Time time, const char *name,
- const model::WeekFlags flags, bool active);
+ const common::WeekFlags flags, bool active);
/**
* @brief Gets identifiers of selected items.
/** @brief Time to be set on datetime widget */
utils::Time time;
/** @brief WeekFlags to be displayed on list item */
- model::WeekFlags flags;
+ common::WeekFlags flags;
/** @brief volume value to be set on slider */
double volume;
/** @brief snooze flag to set on checkbox */
/** @brief path to be displayed on list item */
std::string melody;
/** @brief type to be displayed on list item */
- model::Alarm::Type type;
+ common::Alarm::Type type;
};
/**
* @brief Possible view modes.
void RingtonePathUpdateCallback();
const char *GetTitle();
std::string GetDate();
- void SetType(model::Alarm::Type type);
+ void SetType(common::Alarm::Type type);
void UpdateType();
utils::Connection time_format_change_listener_;
#include <Evas.h>
-#include "View/View.h"
+#include "Common/View.h"
/**
* @file MainView.h
* @brief Application main view class
* @remarks This is singleton class.
*/
- class MainView : public ui::IView {
+ class MainView : public common::IView {
public:
/**
/* Content */
Evas_Object *toolbar_;
- IView *alarm_ = nullptr;
- IView *world_clock_ = nullptr;
- IView *stop_watch_ = nullptr;
- IView *timer_ = nullptr;
+ common::IView *alarm_ = nullptr;
+ common::IView *world_clock_ = nullptr;
+ common::IView *stop_watch_ = nullptr;
+ common::IView *timer_ = nullptr;
static void ToolbarItemCb(void *data, Evas_Object *obj, void *event_info);
};
#include <Elementary.h>
#include "View/MainView.h"
-#include "View/View.h"
+#include "Common/View.h"
#include "Utils/Signal.h"
#include <vector>
/**
* @brief Base class for pages (Alarm, World Clock, StopWatch and Timer)
*/
- class PageView : public ui::IView {
+ class PageView : public common::IView {
public:
/**
* @brief Constructs class object.
#include <vector>
#include "Common/CounterView.h"
-#include "View/View.h"
+#include "Common/View.h"
#include "Utils/Signal.h"
#define PART_LAP_NO "txt.lap.no"
* Class displays Stopwatch view for user interaction. Allows to run, stop,
* resume and record lap in its lap list.
*/
- class StopWatchView : public ui::IView {
+ class StopWatchView : public common::IView {
public:
/**
* @brief StopWatchView constructor
*
* @param[in] main The parent's view
*/
- StopWatchView(ui::IView &main);
+ StopWatchView(common::IView &main);
/**
* @brief Makes class non-copyable
static const unsigned MAX_LAPS_RECORDS = 999;
private:
- CounterView *main_counter_ = nullptr;
- CounterView *lap_counter_ = nullptr;
+ common::CounterView *main_counter_ = nullptr;
+ common::CounterView *lap_counter_ = nullptr;
Evas_Object *layout_ = nullptr;
void CreateButton(Evas_Object *parent, const char *name,
#include <vector>
#include <functional>
-#include "View/View.h"
+#include "Common/View.h"
#include "View/PageView.h"
#include "Common/CounterView.h"
#include "Utils/Signal.h"
* Provides features such as setting timer's time, running, stopping and
* resuming timer.
*/
- class TimerView : public ui::IView {
+ class TimerView : public common::IView {
public:
/**
*
* @param[in] main The parent's view
*/
- TimerView(ui::IView &main);
+ TimerView(common::IView &main);
/**
* @brief Makes class non-copyable
Evas_Object *layout_ = NULL;
Evas_Object *selector_ = NULL;
Evas_Object *conformant = NULL;
- view::CounterView *counter_ = NULL;
+ common::CounterView *counter_ = NULL;
enum class ButtonArrowDirection {
ARROW_UP,
+++ /dev/null
-/*
-* Copyright 2016 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.
-*/
-
-#ifndef _CLOCK_UI_VIEW_H_
-#define _CLOCK_UI_VIEW_H_
-
-#include <Elementary.h>
-
-namespace ui {
- /**
- * @brief Abstract interface representing Native UI toolkit object.
- */
- class IView {
- public:
- /**
- * @brief Get Native UI toolkit representation
- */
- virtual Evas_Object *GetEvasObject() = 0;
- virtual ~IView() {}
- };
-};
-
-#endif
* @brief Creates instance of WeekFlags view
*
* @param main parent view
- * @param flags model::WeekFlags to be edited
+ * @param flags common::WeekFlags to be edited
*/
- WeekFlagsView(view::MainView &main, model::WeekFlags &flags);
+ WeekFlagsView(view::MainView &main, common::WeekFlags &flags);
Evas_Object *GetEvasObject();
protected:
virtual void CreateContent(Evas_Object *parent);
private:
struct CheckBoxDesc {
Evas_Object *check;
- model::WeekDay day;
+ common::WeekDay day;
WeekFlagsView *context;
};
Evas_Object *list_ = nullptr;
- model::WeekFlags &flags_;
- void AppendCheckableListItem(model::WeekDay);
+ common::WeekFlags &flags_;
+ void AppendCheckableListItem(common::WeekDay);
void CheckBoxStatusUpdate();
- void Toggle(model::WeekDay);
+ void Toggle(common::WeekDay);
void CreateList();
static void ItemSelectedCallback(void *, Evas_Object *, void *);
std::list<CheckBoxDesc*> check_boxes_;
- static const char *GetLabelForWeekDay(model::WeekDay day);
+ static const char *GetLabelForWeekDay(common::WeekDay day);
void UpdateList();
utils::Connection language_change_listener_;
};
#include <vector>
#include <ctime>
-#include "View/View.h"
+#include "Common/View.h"
namespace view {
* It displays map with day and night line and colors underlying map into
* light and shadow color depending on time of the day.
*/
- class WorldClockMap : public ui::IView {
+ class WorldClockMap : public common::IView {
public:
/**
*
* @param[in] parent The parent of the map
*/
- WorldClockMap(ui::IView &parent);
+ WorldClockMap(common::IView &parent);
~WorldClockMap();
private:
#include "Model/WorldClock.h"
#include "View/PageView.h"
-#include "View/View.h"
+#include "Common/View.h"
#include "View/WorldClockMap.h"
#include "Utils/Signal.h"
* @details It communicates with external classes by sending signals and do
* not touch any external resources directly except utils.
*/
- class WorldClockView: public ui::IView {
+ class WorldClockView: public common::IView {
public:
/**
*
* @param main parent of the world clock view object
*/
- WorldClockView(ui::IView &main);
+ WorldClockView(common::IView &main);
/**
* @brief Makes class non-copyable
}
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
- provider_ = new model::AlarmProvider();
+ provider_ = new common::AlarmProvider();
main_ctrl_ = new controller::MainController(provider_);
return true;
using namespace utils;
using namespace presenter;
using namespace model;
+using namespace common;
using std::placeholders::_1;
-MainController::MainController(model::AlarmProvider *provider) :
+MainController::MainController(common::AlarmProvider *provider) :
provider_(provider)
{
}
#include "Common/Defines.h"
#include "Utils/Log.h"
+using namespace std::chrono;
+
namespace model {
Timer::Timer()
return NULL;
}
- ret = app_control_set_app_id(appControl, PACKAGE);
+ ret = app_control_set_app_id(appControl, PACKAGE_RING);
if (ret != APP_CONTROL_ERROR_NONE) {
ERR("app_control_set_app_id failed");
app_control_destroy(appControl);
using namespace presenter;
using namespace view;
-using namespace model;
using namespace utils;
+using namespace common;
using std::placeholders::_1;
#include "Presenter/DeleteAlarmPresenter.h"
-using namespace model;
using namespace view;
+using namespace common;
+
namespace presenter {
DeleteAlarmPresenter::DeleteAlarmPresenter(DeleteAlarmView &view, AlarmList &model)
: view_(view), alarm_list_(model)
using namespace presenter;
using namespace view;
-using namespace model;
using namespace utils;
+using namespace common;
+
using std::placeholders::_1;
const double time_truncate_factor = 60 * 1000; // 60 seconds
connections_.push_back(animator_.OnTick.Connect(
std::bind(&TimerPresenter::TimeUpdateRequest, this)));
- connections_.push_back(utils::EventBus::AddListener<model::RingDismissEvent>(
+ connections_.push_back(utils::EventBus::AddListener<common::RingDismissEvent>(
std::bind(&TimerPresenter::RingDismissHandle,
this, std::placeholders::_1)));
}
#include "Utils/SystemSettings.h"
using namespace view;
-using namespace model;
using namespace utils;
+using namespace common;
/**
* Genlist data
delete id;
}
-AlarmListView::AlarmListView(ui::IView &main) : popup_(nullptr), nocontent_layout_(nullptr)
+AlarmListView::AlarmListView(common::IView &main) : popup_(nullptr), nocontent_layout_(nullptr)
{
/* Base Layout */
content_ = elm_layout_add(main.GetEvasObject());
#include <sstream>
-using namespace model;
+using namespace common;
using namespace utils;
namespace view {
}
int DeleteAlarmView::ItemAppend(utils::Time time, const char *name,
- const model::WeekFlags flags, bool active)
+ const common::WeekFlags flags, bool active)
{
ItemData *data = new ItemData;
Elm_Genlist_Item_Class *itc;
using namespace view;
using namespace utils;
-using namespace model;
+using namespace common;
#define VIBRATION_ICON_PATH "images/01_volume_vibration.png"
void EditAlarmView::UpdateAlarmType(bool mute)
{
if (mute) {
- if (data_.type == model::Alarm::Type::SOUND_ONLY)
- data_.type = model::Alarm::Type::VIBRATION;
+ if (data_.type == common::Alarm::Type::SOUND_ONLY)
+ data_.type = common::Alarm::Type::VIBRATION;
} else {
- if (data_.type == model::Alarm::Type::VIBRATION)
- data_.type = model::Alarm::Type::SOUND_ONLY;
+ if (data_.type == common::Alarm::Type::VIBRATION)
+ data_.type = common::Alarm::Type::SOUND_ONLY;
}
elm_genlist_item_update(type_it_);
}
}
}
-void EditAlarmView::SetType(model::Alarm::Type type)
+void EditAlarmView::SetType(common::Alarm::Type type)
{
data_.type = type;
void EditAlarmView::PopupHide(void *data, Evas_Object *obj, void *event)
{
EditAlarmView *view = static_cast<EditAlarmView*>(data);
- model::Alarm::Type type = static_cast<Alarm::Type>(elm_radio_value_get(view->main_radio_));
+ common::Alarm::Type type = static_cast<Alarm::Type>(elm_radio_value_get(view->main_radio_));
view->SetType(type);
{
ViewType *type = static_cast<ViewType*>(data);
MainView *mainView = static_cast<MainView *>(evas_object_data_get(obj, "parent"));
- ui::IView *page = mainView->GetView(*type);
+ common::IView *page = mainView->GetView(*type);
if (!page) return;
Evas_Object *layout = elm_object_parent_widget_get(obj);
return conformant_;
}
-ui::IView *MainView::GetView(ViewType type)
+common::IView *MainView::GetView(ViewType type)
{
switch (type){
case ALARM:
#include "Utils/Log.h"
#include "Utils/Translate.h"
+using namespace common;
+
namespace view {
const char *StopWatchView::EDJE_FILE = "edje/StopWatch.edj";
}
};
-StopWatchView::StopWatchView(ui::IView &main)
+StopWatchView::StopWatchView(common::IView &main)
{
layout_ = elm_layout_add(main.GetEvasObject());
namespace view {
using namespace utils;
+using namespace common;
const char *TimerView::EDJE_FILE = "edje/Timer.edj";
const char *TimerView::GROUP = "Timer";
.max_byte_count = 0
};
-TimerView::TimerView(ui::IView &main) : set_time_()
+TimerView::TimerView(common::IView &main) : set_time_()
{
layout_ = elm_layout_add(main.GetEvasObject());
using namespace view;
using namespace utils;
-using namespace model;
+using namespace common;
WeekFlagsView::WeekFlagsView(view::MainView &main, WeekFlags &flags)
using namespace utils;
-WorldClockMap::WorldClockMap(ui::IView &parent)
+WorldClockMap::WorldClockMap(common::IView &parent)
{
map_ = elm_layout_add(parent.GetEvasObject());
if (!elm_layout_file_set(map_,
return EINA_TRUE;
}
-WorldClockView::WorldClockView(ui::IView &main)
+WorldClockView::WorldClockView(common::IView &main)
{
double time_delta;