From: Lukasz Stanislawski Date: Tue, 26 Jul 2016 09:10:10 +0000 (+0200) Subject: common: interface draft X-Git-Tag: submit/tizen/20161113.192141~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8e94f5e76ebc1b61e3d6eb47994bd544210c7d4;p=profile%2Fmobile%2Fapps%2Fnative%2Fclock.git common: interface draft --- diff --git a/common/inc/Model/Alarm.h b/common/inc/Model/Alarm.h new file mode 100644 index 0000000..9b50825 --- /dev/null +++ b/common/inc/Model/Alarm.h @@ -0,0 +1,38 @@ +#ifndef _CLOCK_ALARM_H_ +#define _CLOCK_ALARM_H_ + +#include + +#include "WeekFlags.h" + +namespace clock { + namespace model { + class Alarm { + public: + Alarm(); + ~Alarm(); + void Activate(); + void Deactivate(); + void Snooze(); + std::string GetName(); + void SetName(std::string name); + time_t GetTime(); + void SetTime(time_t time); + std::string GetMelody(); + void SetMelody(std::string path); + std::string GetVibration(); + void SetVibration(std::string pattern); + WeekFlags GetWeekFlags(); + void SetWeekFlags(WeekFlags flags); + private: + int alarm_id; + std::string name; + std::string melody; + std::string vibration; + WeekFlags flags; + bool activated; + }; + } /* model */ +} /* clock */ + +#endif diff --git a/common/inc/Model/AlarmProvider.h b/common/inc/Model/AlarmProvider.h new file mode 100644 index 0000000..2c43f02 --- /dev/null +++ b/common/inc/Model/AlarmProvider.h @@ -0,0 +1,28 @@ +#ifndef _CLOCK_ALARM_PROVIDER_H +#define _CLOCK_ALARM_PROVIDER_H + +#include "Model/Alarm.h" + +#include +#include + +namespace clock { + namespace model { + class AlarmProvider { + public: + static AlarmProvider& GetInstance(); + + void std::vector> GetAlarms(); + + void Sync(Alarm& alarm); + void SyncAll(); + void Add(Alarm& alarm); + void Remove(Alarm& alarm); + + private: + std::vector alarms; + }; + } /* model */ +} /* clock */ + +#endif diff --git a/common/inc/Model/Location.h b/common/inc/Model/Location.h new file mode 100644 index 0000000..2f5a973 --- /dev/null +++ b/common/inc/Model/Location.h @@ -0,0 +1,14 @@ +#ifndef _CLOCK_LOCATION_H_ +#define _CLOCK_LOCATION_H_ + +namespace clock { + namespace model { + struct Location { + std::string Name; + std::string Country; + std::string Timezone; + std::string TzPath; + }; + } /* model */ +} /* clock */ +#endif diff --git a/common/inc/Model/StopWatch.h b/common/inc/Model/StopWatch.h new file mode 100644 index 0000000..3c25532 --- /dev/null +++ b/common/inc/Model/StopWatch.h @@ -0,0 +1,21 @@ +#ifndef _CLOCK_STOPWATCH_H_ +#define _CLOCK_STOPWATCH_H_ + +namespace clock { + namespace model { + class StopWatch { + public: + void Start(); + void Stop(); + void EndLap(); + void Reset(); + time_t ElapsedTime(); + std::vector GetLaps(); + private: + time_t start_time; + std::vector laps; + }; + } /* model */ +} /* clock */ + +#endif diff --git a/common/inc/Model/StopWatchLap.h b/common/inc/Model/StopWatchLap.h new file mode 100644 index 0000000..3d21b6f --- /dev/null +++ b/common/inc/Model/StopWatchLap.h @@ -0,0 +1,16 @@ +#ifndef _CLOCK_STOPWATCH_LAP_H_ +#define _CLOCK_STOPWATCH_LA_H_ + +namespace clock { + namespace model { + class StopWatchLap { + public: + StopWatchLap(time_t start, time_t duration); + ~StopWatchLap(); + time_t LapDuration(); + time_t LapStartTime(); + }; + } /* model */ +} /* clock */ + +#endif diff --git a/common/inc/Model/Timer.h b/common/inc/Model/Timer.h new file mode 100644 index 0000000..945f521 --- /dev/null +++ b/common/inc/Model/Timer.h @@ -0,0 +1,15 @@ +#ifndef _CLOCK_TIMER_H_ +#define _CLOCK_TIMER_H_ + +namespace clock { + namespace model { + class Timer { + public: + Start(time_t delay); + time_t StartTime(); + time_t RemainingTime(); + }; + } /* model */ +} /* clock */ + +#endif diff --git a/common/inc/Model/WeekFlags.h b/common/inc/Model/WeekFlags.h new file mode 100644 index 0000000..8712580 --- /dev/null +++ b/common/inc/Model/WeekFlags.h @@ -0,0 +1,27 @@ +#ifndef _CLOCK_ALARM_WEEK_FLAGS_H +#define _CLOCK_ALARM_WEEK_FLAGS_H + +namespace clock { + namespace model { + enum WeekFlag { + MONDAY = (1 << 0), + TUESDAY = (1 << 1), + WENSDAY = (1 << 2), + THURSDAY = (1 << 3), + FRIDAY = (1 << 4), + SATURDAY = (1 << 5), + SUNDAY = (1 << 6), + }; + class WeekFlags { + public: + WeekFlags(); + AddDay(WeekFlag day); + RemoveDay(WeekFlag day); + bool IsOn(WeekFlag day); + private: + int raw_flags; + }; + } /* model */ +} /* clock */ + +#endif diff --git a/common/inc/Model/WordlClock.h b/common/inc/Model/WordlClock.h new file mode 100644 index 0000000..21b5ef8 --- /dev/null +++ b/common/inc/Model/WordlClock.h @@ -0,0 +1,18 @@ +#ifndef _CLOCK_WORLDCLOCK_H_ +#define _CLOCK_WORLDCLOCK_H_ + +#include + +namespace clock { + namespace model { + class WorldClock { + public: + const std::vector Locations; + const std::vector UserLocations; + + void AddUserLocation(Location loc); + void RemoveUserLocation(Location loc); + }; + } /* model */ +} /* clock */ +#endif diff --git a/common/inc/UI/View.h b/common/inc/UI/View.h new file mode 100644 index 0000000..857af53 --- /dev/null +++ b/common/inc/UI/View.h @@ -0,0 +1,15 @@ +#ifndef _CLOCK_UI_VIEW_H_ +#define _CLOCK_UI_VIEW_H_ + +#include + +namespace clock { +namespace ui { + class IView { + public: + virtual Evas_Object *GetEvasObject() = 0; + }; +}; +}; + +#endif diff --git a/common/inc/Utils/Log.h b/common/inc/Utils/Log.h new file mode 100644 index 0000000..7809d98 --- /dev/null +++ b/common/inc/Utils/Log.h @@ -0,0 +1,10 @@ +#ifndef _CLOCK_LOC +#define _CLOCK_LOC + +namespace clock { + namespace utils { + class Log { + }; + } /* utils */ +} /* clock */ +#endif