namespace common {
+ /**
+ * @brief Counter's animator
+ *
+ * This class creates animator for any view that has counter in its content.
+ * Animator is responsible for refreshing the related counter's view by requesting
+ * view update every frametime.
+ *
+ * After the CounterAnimator object is created there must be registered callback
+ * to be called on every animator's tick. Animator starts running on Start() and stops
+ * whenever Stop() or Remove() method is called. The animator stops by default
+ * during object's destruction.
+ */
class CounterAnimator {
public:
CounterAnimator();
~CounterAnimator();
+ /**
+ * @brief Creates and runs ecore animator
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Remove()
+ */
bool Start(void);
+
+ /**
+ * @brief Freezes ecore animator
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Start()
+ */
bool Stop(void);
+
+ /**
+ * @brief Resumes ecore animator
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Stop()
+ */
bool Resume(void);
+
+ /**
+ * @brief Removes ecore animator
+ *
+ * @see Start()
+ */
void Remove(void);
+ /**
+ * @brief Sets frametime for ecore animator
+ *
+ * @param[in] time The frametime
+ */
void SetFrametime(double time);
+ /**
+ * @brief Registers animators callback
+ *
+ * This function registers callback to be called on
+ * every animator tick.
+ *
+ * @param[in] func Callback function to be registered
+ */
void RegisterSignal(std::function<void(void)>func);
private:
namespace controller {
- struct RingStackItem {
- model::Ring *model;
- view::RingView *view;
- presenter::RingPresenter *presenter;
-
- model::Alarm *alarm;
- };
-
+ /**
+ * @brief Ring controller
+ *
+ * This class provides Ring Controller singleton that handles incomming
+ * ring alarm, displays them, snoozes or destroys depending on user's
+ * choice. It is related with Ring's model that stores incoming alarm data
+ * and view for user interaction.
+ *
+ * Ring handles alarm depending on operation value in app control request.
+ * HandleAlarm() handles simple alarm with ID found in Clock's database file.
+ * HandleTimeout() handles alarm from Clock's Timer.
+ */
class RingController {
public:
+ /**
+ * @brief RingController constructor
+ *
+ * @param[in] provider AlarmProvider object
+ */
RingController(model::AlarmProvider *provider);
~RingController();
+ /**
+ * @brief Returns the reference to RingController instance
+ *
+ * @return Reference to RingController singleton instance
+ */
+ static RingController &GetInstance(void);
+
+ /**
+ * @brief Operator = is deleted
+ */
void operator=(RingController const&) = delete;
+
+ /**
+ * @brief Copy contstuctor is deleted
+ */
RingController(RingController const&) = delete;
+ /**
+ * @brief Handles alarm
+ *
+ * Handles incoming alarm with id
+ *
+ * @param[in] alarmID ID of the alarm
+ */
void HandleAlarm(int alarmID);
+
+ /**
+ * @brief Handles timeout alarm
+ *
+ * Handles timeout alarm that incomes when timer's time is up
+ */
void HandleTimeout(void);
private:
using namespace std::chrono;
+ /**
+ * @brief Checks whether template type is std::chrono::duration
+ *
+ * Counter works only with std::chrono::duration values. This structure
+ * is used by assert to warn about type collision during compilation
+ */
template <typename Type>
struct isDuration {
+
+ /**
+ * @brief Is duration flag
+ *
+ * This value will be returned if the type during compilation
+ * in Counter template is different than std::chrono::duration
+ */
static constexpr bool value = false;
};
+ /**
+ * @brief Checks whether template type is std::chrono::duration
+ *
+ * Counter works only with std::chrono::duration values. This structure
+ * is used by assert to warn about type collision during compilation
+ */
template <typename Rep, typename Period>
struct isDuration <duration<Rep, Period>>{
+
+ /**
+ * @brief Is duration flag
+ *
+ * This value will be returned if the type during compilation
+ * in Counter template is std::chrono::duration
+ */
static constexpr bool value = true;
};
+ /**
+ * @brief Counter's template
+ *
+ * This template provides Counter's model depending on template's type.
+ * The type must be one of the std::chrono::duration (hours, seconds and etc.),
+ * any other will be asserted during compilation as fault. Counter stores
+ * time elapsed from its start to any other time during Get...() access.
+ *
+ * Counter starts on Run() call and stops on Stop(). Stopped Counter can be
+ * resumed with Resume(). At any time Counter might be reseted with Reset().
+ * Reseting counter resets the measured time. Every stop is recorded,
+ * and time in total is equal to the sum of every running period.
+ */
template <typename Duration = milliseconds> class Counter {
public:
+ /**
+ * @brief Counter's constructor
+ *
+ */
Counter() {
start_time_ = Duration::zero();
pause_time_ = Duration::zero();
}
+ /**
+ * @brief Runs counter
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Stop()
+ */
bool Run()
{
start_time_ = GetTimeSinceEpoch();
return true;
}
+ /**
+ * @brief Resets current counter's time
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Stop()
+ */
bool Reset()
{
pause_time_ = Duration::zero();
return true;
}
+ /**
+ * @brief Resumes counter
+ *
+ * If counter is stopped, this method resumes it.
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Stop()
+ */
bool Resume()
{
if (!Run()) {
return true;
}
+ /**
+ * @brief Stops counter
+ *
+ * @return true on success, otherwise false
+ *
+ * @see Run()
+ */
bool Stop()
{
pause_time_ += GetTimeSinceEpoch() - start_time_;
return true;
}
+ /**
+ * @brief Gets current counter's count time
+ *
+ * Returns counter's total running time. Every reset zeroes this value.
+ *
+ * @return Duration time
+ */
Duration GetTime() const
{
return GetTimeSinceEpoch() - start_time_ + pause_time_;
}
+ /**
+ * @brief Gets time since epoch
+ *
+ * @return Duration time since epoch
+ */
Duration GetTimeSinceEpoch() const
{
return duration_cast<Duration>(system_clock::now().time_since_epoch());
}
+ /**
+ * @brief Gets counter's start time
+ *
+ * @return Duration time
+ */
Duration GetStartTime() const
{
return start_time_;
}
+ /**
+ * @brief Gets counter's count time hours
+ *
+ * @return Amount of hours
+ */
unsigned GetHour() const
{
return (unsigned)(duration_cast<hours>(GetTime()).count() % 99);
}
+ /**
+ * @brief Gets counter's count time minutes.
+ *
+ * This method returns remaining time in minutes to the entire hour.
+ *
+ * @return Amount of minutes
+ */
unsigned GetMinute() const
{
return (unsigned)(duration_cast<minutes>(GetTime()).count() % 60);
}
+ /**
+ * @brief Gets counter's count time seconds.
+ *
+ * This method returns remaining time in minutes to the entire minute.
+ *
+ * @return Amount of seconds
+ */
unsigned GetSecond() const
{
return (unsigned)(duration_cast<seconds>(GetTime()).count() % 60);
namespace model {
+ /**
+ * @brief The enum of the ring alarm type
+ */
enum class RingType {
- RING_TYPE_NONE,
+ RING_TYPE_NONE, //ring's type is undefined
- RING_TYPE_ALARM,
- RING_TYPE_TIMER
+ RING_TYPE_ALARM, //ring is called on alarm
+ RING_TYPE_TIMER //ring is called on timer's time out
};
+ /**
+ * @brief Ring model
+ *
+ * This class provides every functionality related with data stored in alarm
+ * to be accessed during its call. Ring object is responsible for dismissing
+ * and snoozing alarm depending on user's choice and running its vibration
+ * or ringtone.
+ *
+ * Ring object is created during app control request and stores alarm's data passed
+ * in AlarmAdd() call. Any other already running ring call is dismissed or snoozed,
+ * depending on alarm's snooze status.
+ */
class Ring{
public:
Ring();
*/
RingType GetType() const;
+ /**
+ * @brief Gets ring's counter
+ *
+ * Ring uses Counter class object to measure the time left
+ * to ring's call. This method returns such a counter that
+ * belongs to current Ring object.
+ *
+ * @return Reference to the Counter object
+ */
const Counter<std::chrono::seconds> &GetCounter() const { return (counter_); };
private:
namespace model {
+ /**
+ * @brief Ring dismiss event class
+ *
+ * This class provides event info created during alarm's dismiss.
+ */
class RingDismissEvent : public utils::Event {
};
+ /**
+ * @brief Ring timeout event class
+ *
+ * This class provides event info created during alarm's timeout.
+ */
class RingTimeoutEvent : public utils::Event {
};
+ /**
+ * @brief Ring new alarm event class
+ *
+ * This class provides event info created during new alarm's call and
+ * stores its pointer for later access.
+ */
class RingNewAlarmEvent : public utils::Event {
public:
+ /**
+ * @brief RingNewAlarmEvent constuctor
+ *
+ * @param[in] alarm The alarm passed with event
+ */
RingNewAlarmEvent(Alarm &alarm);
+
+ /**
+ * @Gets event's alarm
+ *
+ * This method returns event's alarm.
+ *
+ * @return The handled alarm
+ */
Alarm *GetAlarm(void) const { return alarm_; };
private:
Alarm *alarm_;
namespace model {
+ /**
+ * @brief Lap's model class
+ *
+ * This class provides StopWatch lap's information. It stores its number,
+ * split time and lap time from the laps list.
+ */
class Lap {
public:
+ /**
+ * @brief Gets lap time in milliseconds
+ *
+ * @return Lap time in milliseconds
+ */
inline std::chrono::milliseconds GetTime(void) const { return lap_time_; };
+
+ /**
+ * @brief Gets lap's split time in milliseconds
+ *
+ * @return Lap's split time in milliseconds
+ */
inline std::chrono::milliseconds GetSplitTime(void) const { return split_time_; };
+
+ /**
+ * @brief Gets number of the lap in lap list
+ *
+ * @return The number of the lap
+ */
inline unsigned GetNo(void) const { return No_; };
+ /**
+ * @brief Sets lap's time in milliseconds
+ *
+ * @param[in] time The time to be set
+ */
inline void SetTime(std::chrono::milliseconds time) { lap_time_ = time; };
+
+ /**
+ * @brief Sets lap's split time in milliseconds
+ *
+ * @param[in] time The time to be set
+ */
inline void SetSplitTime(std::chrono::milliseconds time) { split_time_ = time; };
+
+ /**
+ * @brief Sets lap's list number
+ *
+ * @param[in] num The number of the lap in list
+ */
inline void SetNo(unsigned num) { No_ = num; };
private:
unsigned No_;
std::chrono::milliseconds lap_time_;
};
+ /**
+ * @brief Stopwatch model class
+ *
+ * This class stores the laps list information and related functionalities such as
+ * 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> {
public:
+ /**
+ * @brief Clears list of stored laps and their times
+ */
void ClearList(void);
+
+ /**
+ * @brief Creates new lap
+ *
+ * This method creates new lap with the start time and split time
+ * from the moment of its call.
+ */
void AddLap(void);
+
+ /**
+ * @brief Gets the total number of laps in the laps list
+ *
+ * @return Number of laps
+ */
unsigned GetLapsCount(void);
+ /**
+ * @brief Gets the last lap in the laps list
+ *
+ * @return Last lap in the laps list.
+ */
const Lap *GetLastLap(void);
private:
std::vector<Lap *> laps_;
using namespace std::chrono;
namespace model {
+
+ /**
+ * @brief Counter's model class
+ *
+ * This class is a backend for timer, stores its current time values
+ * such as hour, minute, second and registers or unregisters alarm with
+ * external API.
+ *
+ * Running Timer by user provide setting time in this object and register
+ * alarm in database. Stopping timer unregister alarm.
+ */
class Timer : public Counter<seconds> {
public:
Timer();
~Timer();
+ /**
+ * @brief Sets timer's amount of hours
+ *
+ * This value is added to the whole timer's countdown time.
+ * After it reaches 0, the timer's ring alarm is called.
+ *
+ * @param[in] hour The hour to be set
+ */
void SetHour(int hour);
+
+ /**
+ * @brief Sets timer's amount of minutes
+ *
+ * This value is added to the whole timer's countdown time.
+ * After it reaches 0, the timer's ring alarm is called.
+ *
+ * @param[in] minute The minute to be set
+ */
void SetMinute(int minute);
+
+ /**
+ * @brief Sets timer's amount of seconds
+ *
+ * This value is added to the whole timer's countdown time.
+ * After it reaches 0, the timer's ring alarm is called.
+ *
+ * @param[in] second The second to be set
+ */
void SetSecond(int second);
+ /**
+ * @brief Gets timer's hour
+ *
+ * @return Number of timer's hours
+ */
unsigned GetHour(void) const;
+
+ /**
+ * @brief Gets timer's minutes
+ *
+ * @return Number of timer's minutes
+ */
unsigned GetMinute(void) const;
+
+ /**
+ * @brief Gets timer's seconds
+ *
+ * @return Number of timer's seconds
+ */
unsigned GetSecond(void) const;
+ /**
+ * @brief Sets total timer's countdown time
+ *
+ * @param[in] hour The timer's hour
+ * @param[in] minute The timer's minute
+ * @param[in] second The timer's second
+ */
void SetTime(int hour, int minute, int second);
+
+ /**
+ * @brief Activates alarm after delay.
+ *
+ * This method uses external API to register alarm to be called
+ * on specified time. In this case the alarm's call begins after
+ * a@ delay time.
+ *
+ * @param[in] delay Alarm's ring call delay time
+ *
+ * @return true on success, otherwise false
+ */
bool ActivateAlarm(int delay);
+
+ /**
+ * @brief Deactivates alarm
+ *
+ * This method deactives currently running timer's alarm.
+ *
+ * @return true on success, otherwise false
+ */
bool DeactivateAlarm(void);
+ /**
+ * @brief Gets timers remaining time
+ *
+ * Returns time left to the timer's ring call.
+ *
+ * @return Remaining time in std::chrono::seconds
+ */
seconds GetRemainingTime(void);
private:
unsigned hour_;
namespace presenter {
+ /**
+ * @brief Ring presenter class
+ *
+ * This class creates presenter that stores incoming information from view in
+ * model and reacts on its change. Also refreshes view on backend data change.
+ */
class RingPresenter {
public:
+ /**
+ * @brief RingPresenter constructor
+ *
+ * @param[in] view The view object
+ * @param[in] model The model object
+ */
RingPresenter(view::RingView *view, model::Ring *model);
~RingPresenter();
namespace presenter {
+ /**
+ * @brief Stopwatch presenter class
+ *
+ * This class creates presenter that stores incoming information from view in
+ * model and reacts on its change. Also refreshes view on stored data change.
+ */
class StopWatchPresenter {
public:
+ /**
+ * @brief StopWatchPresenter constructor
+ *
+ * @param[in] ui The view object
+ * @param[in] model The model object
+ */
StopWatchPresenter(view::StopWatchView *ui, model::StopWatch *model);
~StopWatchPresenter();
namespace presenter {
+ /**
+ * @brief Timer's presenter class
+ *
+ * This class creates presenter that stores incoming information from view in
+ * model and reacts on its change. Also refreshes view on backend data change.
+ */
class TimerPresenter {
public:
+ /**
+ * @brief TimerPresenter constructor
+ *
+ * param[in] view The timer's view
+ * param[in] model The timer's model
+ */
TimerPresenter(view::TimerView *view, model::Timer *model);
~TimerPresenter();
namespace utils {
+ /**
+ * @brief Feedback manager singleton class
+ *
+ * This object provides all features related with device fibration.
+ */
class FeedbackManager {
public:
namespace utils {
+ /**
+ * @brief Notifier singleton class
+ *
+ * This object notifies indicator about set alarm's. Notifier is responsible
+ * for displaying indicator's clock icon.
+ */
class Notifier {
public:
virtual ~Notifier ();
+
+ /**
+ * @brief Gets instance of the Notifier
+ *
+ * @return Notifier singleton's reference
+ */
static Notifier &GetInstance();
+ /**
+ * @brief Deletes singleton's operator=
+ */
Notifier &operator=(const Notifier&) = delete;
+
+ /**
+ * @brief Deletes singleton's copy constructor
+ */
Notifier(const Notifier &) = delete;
- /*
+ /**
* @brief Posts alarm notification for indicator
*
* Posting notification for indicator to display alarm
*/
bool AlarmNotiPost();
- /*
+ /**
* @brief Removes alarm notification from indicator
*
* Removes alarm icon from indicator bar.
namespace utils {
+ /**
+ * @brief Popup menager static class
+ *
+ * This is a static class that displays simple popup with requested content.
+ */
class PopupManager {
public:
- /*
+ /**
* @brief Creates new toast popup.
*
* @param[in] parent The parent view of the popup
*/
static void CreatePopup(ui::IView &parent, const std::string &text, double timeout = 2.0);
- /*
+ /**
* @brief Destroys currently visible toast popup.
*
* @note Destroys before timeout elapses.
PopupManager() {};
- /*
+ /**
* @brief Callback function to be called on popup dismiss.
*
*/
namespace utils {
+ /**
+ * @brief Sound manager static class
+ *
+ * Class managing sound during alarm's ring call.
+ */
class SoundManager {
public:
/**
- * @brief Creates sound stream and plays music with the passed uri
- * path and relative to system volume value.
+ * @brief Creates sound stream
+ *
+ * Creates Sound stream and plays music with the passed uri
+ * path and relative to system volume value.
+ *
+ * @param[in] uri The uri of sound to be played
+ * @param[in] volume The volume of the sound
+ *
+ * @return true on success, otherwise false
*/
static bool SoundPlay(const std::string &uri, double volume = 1.0);
/**
- * @brief Stops the currently playing music and destroys created with SoundPlay
- * sound stream. After music is stopped, to play it againg it is necessary
- * to call SoundPlay method.
+ * @brief Stops the currently playing sound
+ *
+ * Stops the currently playing sound and destroys created with SoundPlay
+ * sound stream. After music is stopped, to play it againg it is necessary
+ * to call SoundPlay method.
+ *
+ * @return true on success, otherwise false
*/
static bool SoundStop(void);
/**
* @brief Pauses the currently playing music without destroying sound stream.
+ *
+ * @return true on success, otherwise false
*/
static bool SoundPause(void);
/**
* @brief Resumes paused music.
+ *
+ * @return true on success, otherwise false
*/
static bool SoundResume(void);
namespace utils {
-class ThemeExtension {
-public:
-
- /**
- * @brief Adds theme to the list of extensions.
- *
- * @param[in] path The path to the edje file
- */
- static void AddTheme(const std::string &path);
-
/**
- * @brief Removes theme from the list of extensions.
+ * @brief Theme extension static class
*
- * @param[in] path The path to the edje file
+ * Storage class for theme extensions. It prevents from duplicating
+ * themes in application.
*/
- static void DelTheme(const std::string &path);
-
-private:
- static std::set<std::string> themes_;
- ThemeExtension() {};
-};
+ class ThemeExtension {
+ public:
+
+ /**
+ * @brief Adds theme to the list of extensions
+ *
+ * @param[in] path The path to the edje file
+ */
+ static void AddTheme(const std::string &path);
+
+ /**
+ * @brief Removes theme from the list of extensions
+ *
+ * @param[in] path The path to the edje file
+ */
+ static void DelTheme(const std::string &path);
+
+ private:
+ static std::set<std::string> themes_;
+ ThemeExtension() {};
+ };
}
#endif //_CLOCK_UTILS_THEME_MANAGER_H_
namespace utils {
-class Translate {
-public:
-
/**
- * @brief Returns string with translation dependent on local language
- * in singular form.
- *
- * Function gets message id set up in po file and returns string
- * in currently set language.
- *
- * @param[in] msgid The id of the text set up in po files.
- * @param[in] ... Arguments for the format.
+ * @brief Translate static class
*
- * @return String of the text in local language.
+ * This class provides methods handling translations.
*/
- static std::string Sprintf(const char *msgid, ...);
+ class Translate {
+ public:
- /**
- * @brief Returns string with translation dependent on local language
- * in singular or plural form.
- *
- * Function gets message id of the singular set up in po file and
- * returns string in currently set language with variadic number
- * of arguments and form dependent on count number.
- *
- * @param[in] count Value the form depends on.
- * @param[in] singularForm The id of the singular form.
- * @param[in] pluralForm The id of the plural form.
- * @param[in] ... Arguments for the format.
- *
- * @return String of the text in local language..
- */
- static std::string Sprintf(int count, const char *singularForm, const char *pluralForm, ...);
+ /**
+ * @brief Returns string with translation dependent on local language
+ * in singular form.
+ *
+ * Function gets message id set up in po file and returns string
+ * in currently set language.
+ *
+ * @param[in] msgid The id of the text set up in po files.
+ * @param[in] ... Arguments for the format.
+ *
+ * @return String of the text in local language.
+ */
+ static std::string Sprintf(const char *msgid, ...);
+
+ /**
+ * @brief Returns string with translation dependent on local language
+ * in singular or plural form.
+ *
+ * Function gets message id of the singular set up in po file and
+ * returns string in currently set language with variadic number
+ * of arguments and form dependent on count number.
+ *
+ * @param[in] count Value the form depends on.
+ * @param[in] singularForm The id of the singular form.
+ * @param[in] pluralForm The id of the plural form.
+ * @param[in] ... Arguments for the format.
+ *
+ * @return String of the text in local language..
+ */
+ static std::string Sprintf(int count, const char *singularForm, const char *pluralForm, ...);
-private:
- Translate() {};
-};
+ private:
+ Translate() {};
+ };
}
#endif //_CLOCK_UTILS_TRANSLATOR_H_
namespace view {
+ /**
+ * @brief Counter's type enum
+ */
enum class CounterType {
COUNTER_TYPE_STOPWATCH,
COUNTER_TYPE_STOPWATCH_EXPANDED,
COUNTER_TYPE_HIDDEN
};
+ /**
+ * @brief Counter's view class
+ *
+ * Class displays ui view of the counter, changes its values during running state,
+ * and responds on user's activities.
+ */
class CounterView : public ui::IView {
public:
CounterView(ui::IView &parent, CounterType type = CounterType::COUNTER_TYPE_STOPWATCH);
~CounterView();
+ /**
+ * @brief Gets Evas_Object of the CounterView
+ *
+ * @return Counter's view Evas_Object
+ */
Evas_Object *GetEvasObject(void);
+ /**
+ * @brief Sets counters time to be displayed
+ *
+ * @param[in] hour The hour to be set
+ * @param[in] min The minute to be set
+ * @param[in] sec The second to be set
+ * @param[in] msec The millisecond to be set, 0 by default
+ */
void DisplayTime(int hour, int min, int sec, int msec = 0);
+ /**
+ * @brief Shows counter's view
+ */
void Show(void);
+
+ /**
+ * @brief Hides counter's view
+ */
void Hide(void);
+ /**
+ * @brief Expands counter's view
+ *
+ * Whenever counter reaches time above 59 minutes 59 seconds and 59 milliseconds,
+ * the counter's view is expanded to show the hours.
+ */
void Expand(void);
+
+ /**
+ * @brief Contracts counter's view
+ *
+ * Whenever counter reaches time below 1 hour, the counter's view is contracted
+ * and hours are not displayed anymore.
+ */
void Contract(void);
+
+ /**
+ * @brief Resets counter's time value
+ *
+ * This method sets counter's view time value to 00:00:00.
+ */
void Reset(void);
+ /**
+ * @brief Gets counter's visibility status
+ *
+ * @return true if counter's view is visible, otherwise false
+ */
bool IsVisible(void);
private:
Evas_Object *layout_;
namespace view {
+ /**
+ * @brief Ring view signal type
+ */
enum class RingSignal {
BUTTON_DISMISS_CLICKED,
BUTTON_SNOOZE_CLICKED,
MAX,
};
+ /**
+ * @brief Ring's view class
+ *
+ * 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 {
public:
/**
void PlayMusic(const char *uri, double volume);
/**
- * @brief Stops the currently playing music and destroys created with PlayMusic
- * sound stream. After music is stopped, to play it againg it is necessary
- * to call PlayMusic method.
+ * @brief Stops currently playing music
+ *
+ * Stops the currently playing music and destroys created with PlayMusic
+ * sound stream. After music is stopped, to play it againg it is necessary
+ * to call PlayMusic method.
*/
void StopMusic(void);
/**
- * @brief Pauses the currently playing music without destroying sound stream.
+ * @brief Pauses the currently playing music without destroying sound stream
*/
void PauseMusic(void);
/**
- * @brief Resumes paused music.
+ * @brief Resumes paused music
*/
void ResumeMusic(void);
/**
- * @brief Starts device vibration.
+ * @brief Starts device vibration
*/
void StartVibration(void);
/**
- * @brief Stops device vibration.
+ * @brief Stops device vibration
*/
void StopVibration(void);
/**
- * @brief Destroys and zeroes player handler.
+ * @brief Destroys and zeroes player handler
*/
void DestroyPlayer(void);
/**
- * @brief Destroys and zeroes stream info handler.
+ * @brief Destroys and zeroes stream info handler
*/
void DestroyStreamInfo(void);
/**
- * @brief Returns the Evas_Object of the view.
+ * @brief Returns the Evas_Object of the view
+ *
+ * @return View's Evas_Object
*/
Evas_Object *GetEvasObject();
namespace view {
+ /**
+ * @brief StopWatch signal type
+ */
enum class Signal {
BUTTON_START_CLICKED,
BUTTON_STOP_CLICKED,
MAX
};
+ /**
+ * @brief Lap class
+ *
+ * Class helper for StopWatch view that stores displayed information
+ * about laps (list number, split time and lap time).
+ */
class Lap {
public:
+ /**
+ * @brief Lap constructor
+ *
+ * @param[in] no The number of the lap in the list
+ * @param[in] splitTime The lap's split time
+ * @param[in] lapTime The lap's time
+ */
Lap(const char *no, const char *splitTime, const char *lapTime);
+
+ /**
+ * @brief Lap destructor
+ */
~Lap();
+ /**
+ * @brief Gets lap's list number
+ *
+ * @return Lap's list number string
+ */
char *GetNo(void) {return No_; };
+
+ /**
+ * @brief Gets lap's split time
+ *
+ * @return Lap's split time string
+ */
char *GetSplitTime(void) {return split_time_; };
+
+ /**
+ * @brief Gets lap's time
+ *
+ * @return Lap's time string
+ */
char *GetLapTime(void) {return lap_time_; };
private:
char *lap_time_;
};
+ /**
+ * @brief Stopwatch view class
+ *
+ * Class displays Stopwatch view for user interaction. Allows to run, stop,
+ * resume and record lap in its lap list.
+ */
class StopWatchView : public ui::IView {
public:
+ /**
+ * @brief StopWatchView constructor
+ *
+ * @param[in] main The parent's view
+ */
StopWatchView(ui::IView &main);
+
+ /**
+ * @brief StopWatchView desctructor
+ */
~StopWatchView();
+ /**
+ * @brief Gets StopWatchView Evas_Object
+ *
+ * @return Evas_Object of the view
+ */
Evas_Object *GetEvasObject(void);
+ /**
+ * @brief Registers StopWatchView callbacks
+ *
+ * @param[in] func The callback
+ * @param[in] type The type of the signal
+ */
void RegisterSignal(std::function<void(void)>func, Signal type);
+ /**
+ * @brief Shows running menu
+ *
+ * This method shows running menu with buttons
+ * Stop and Lap.
+ */
void ShowRunningMenu(void);
+
+ /**
+ * @brief Shows stopped menu
+ *
+ * This method shows stopped menu with buttons
+ * Resume and Reset.
+ */
void ShowStoppedMenu(void);
+
+ /**
+ * @brief Shows startup menu
+ *
+ * This method shows startup menu with button Start
+ */
void ShowStartupMenu(void);
+ /**
+ * @brief Adds lap into the lap list
+ *
+ * @param[in] no The number of lap in the list
+ * @param[in] splitTime The split time of the lap
+ * @param[in] lapTime The lap's time
+ */
void AddLap(const char *no, const char *splitTime, const char *lapTime);
+
+ /**
+ * @brief Hides lap list
+ */
void HideList(void);
+
+ /**
+ * @brief Shows lap list
+ */
void ShowList(void);
+ /**
+ * @brief Displays time
+ *
+ * This method displays time in the main counter view.
+ *
+ * @param[in] hour The hour to be displayed
+ * @param[in] minute The minute to be displayed
+ * @param[in] second The second to be displayed
+ * @param[in] millisecond The millisecond to be displayed
+ */
void DisplayTime(unsigned hour, unsigned minute, unsigned second, unsigned millisecond);
+
+ /**
+ * @brief Displays current lap time
+ *
+ * This method displays time in the lap time counter view.
+ *
+ * @param[in] hour The hour to be displayed
+ * @param[in] minute The minute to be displayed
+ * @param[in] second The second to be displayed
+ * @param[in] millisecond The millisecond to be displayed
+ */
void DisplayLapTime(unsigned hour, unsigned minute, unsigned second, unsigned millisecond);
+
+ /**
+ * @brief Shows max records reached popup
+ *
+ * Shows popup warning about maximum number of records
+ * in lap list have been reached.
+ */
void ShowMaxRecordsReachedPopup();
+ /**
+ * @brief The maximum lap list records count
+ */
static const unsigned MAX_LAPS_RECORDS = 999;
private:
namespace view {
+ /**
+ * @brief Timer's signal type
+ */
enum class TimerSignal {
BUTTON_HOUR_INCREASE_CLICKED,
BUTTON_MINUTE_INCREASE_CLICKED,
MAX,
};
+ /**
+ * @brief Timer's view class
+ *
+ * Class displays timer's view for user interaction with backend.
+ * Provides features such as setting timer's time, running, stopping and
+ * resuming timer.
+ */
class TimerView : public ui::IView {
public:
+ /**
+ * @brief TimerView constructor
+ *
+ * @param[in] main The parent's view
+ */
TimerView(ui::IView &main);
~TimerView();
+ /**
+ * @brief Gets TimerView Evas_Object
+ *
+ * @return Evas_Object of the view
+ */
Evas_Object *GetEvasObject();
+ /**
+ * @brief Registers TimerView callback
+ *
+ * @param[in] func The function to be called
+ * @param[in] type The type of the signal on which callback is called
+ */
void RegisterSignal(std::function<void(void)>func, TimerSignal type);
+ /**
+ * @brief Enables Start button
+ *
+ * When time selector's time is set to 00:00:00 which is default value,
+ * the Start button is disabled. This might be changed whenever this
+ * value changes.
+ *
+ * @param[in] enable The enable flag
+ */
void SetEnabledStartButton(bool enable);
+
+ /**
+ * @brief Displays time in counter's view
+ *
+ * @param[in] hour The hour to be set
+ * @param[in] min The minute to be set
+ * @param[in] sec The second to be set
+ */
void DisplayTime(int hour, int min, int sec);
+ /**
+ * @brief Gets currently set time
+ *
+ * @param[in] hour The hour to be set
+ * @param[in] minute The minute to be set
+ * @param[in] second The second to be set
+ */
void GetTime(int *hour, int *minute, int *second);
+ /**
+ * @brief Shows startup menu
+ *
+ * This method shows startup menu with Start and Reset button.
+ */
void ShowStartupMenu(void);
+
+ /**
+ * @brief Shows running menu
+ *
+ * This method shows running menu with Pause and Cancel button.
+ */
void ShowRunningMenu(void);
+
+ /**
+ * @brief Shows paused menu
+ *
+ * This method shows paused menu with Resume and Cancel button.
+ */
void ShowPausedMenu(void);
+
+ /**
+ * @brief Shows editing menu
+ *
+ * This method shows editing menu with Start and Reset button.
+ */
void ShowEditingMenu(void);
+ /**
+ * @brief Shows time selector
+ *
+ * During time editing the time selector is shown and timer's counter
+ * hidden.
+ */
void ShowSelector();
+
+ /**
+ * @brief Shows time counter
+ *
+ * Whenever timer is running it's counter should be shown and time
+ * selector hidden.
+ */
void ShowCounter();
private:
namespace view {
-class WorldClockMap : public ui::IView {
-public:
-
- Evas_Object *GetEvasObject();
- WorldClockMap(ui::IView &parent);
- ~WorldClockMap();
-
-private:
-
- Evas_Object *map_;
- Evas_Object *scroller_;
- Evas_Object *line_scroller_;
- Evas_Object *shadow_;
- Evas_Object *line_;
- Ecore_Timer *timer_;
-
- cairo_t *line_cairo_;
- cairo_surface_t *line_surface_;
-
- cairo_t *shadow_cairo_;
- cairo_surface_t *shadow_surface_;
-
- int mapX = -1, mapY = -1, mapW = -1, mapH = -1;
- int currentYDay = -1;
-
- static const int LATITUDE_RESOLUTION_ = 181;
- std::vector<int> day_times_ = std::vector<int>(LATITUDE_RESOLUTION_, 0);
-
- /**
- * @brief Returns today's sun declination angle.
- *
- * During the Earth movement, sun's position on the horizon
- * changes from -23.44 to +23.44 degree. This value stores the
- * angle for current day.
- *
- * @param now Current time structure.
- *
- * @return Sun declination angle in degrees.
- *
- * @note Returned value is double so for example 21o15' is
- * 21.25 in floating point value.
- */
- double SunDeclination(std::tm now);
-
/**
- * @brief Returns angle of the time where currently is day.
+ * @brief Worldclock map view class
*
- * @param latitude The latitude
- * @param declination The sun declination of current day.
- *
- * @return Angle in degrees.
- *
- * @see GetSunDeclination()
- */
- double TimeAngle(int latitude, double declination);
-
- /**
- * @brief Requests for map update.
- *
- */
- void MapUpdate();
-
- /**
- * @brief Draws night shadow with day/night line.
- *
- * @param now The current time structure
- * @param declination The declination of the current day
- *
- * @return True on success, false on failure.
- */
- bool ShadowCreate(std::tm now, double declination);
-
- /**
- * @brief Creates night shadow.
+ * Class creates map view and responds on local time or current time change.
+ * It displays map with day and night line and colors underlying map into
+ * light and shadow color depending on time of the day.
*/
- void ShadowDraw();
-
- /**
- * @brief Creates day/night line.
- */
- void LineDraw();
-
- /**
- * @brief Creates scroller for night shadow.
- */
- void ShadowScrollerCreate();
-
- /**
- * @brief Creates scroller for day/night line.
- */
- void LineScrollerCreate();
-
- /**
- * @brief Creates scroller.
- *
- * @param part The parent's swallow part.
- *
- * @return The Evas_Object of created scroller.
- */
- Evas_Object *ScrollerCreate();
-
- /**
- * @brief Changes scroller's visible area position.
- *
- * @param minutes The move offset
- */
- void ShadowMove(int minutes);
-
- /**
- * @brief Task to be done on particular time update request.
- */
- static Eina_Bool TimerCb(void *data);
-
- /**
- * @brief Callback called on properly shown map image.
- */
- static void ScrollerResizeCb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-
- /**
- * @brief Callback called on time or timezone change.
- */
- static void TimeChangedCb(system_settings_key_e key, void *user_data);
-
-};
+ class WorldClockMap : public ui::IView {
+ public:
+
+ /**
+ * @brief Gets view's Evas_Object
+ *
+ * @return Evas_Object of the view
+ */
+ Evas_Object *GetEvasObject();
+
+ /**
+ * @brief WorldClockMap constructor
+ *
+ * @parm[in] parent The parent of the map
+ */
+ WorldClockMap(ui::IView &parent);
+ ~WorldClockMap();
+
+ private:
+
+ Evas_Object *map_;
+ Evas_Object *scroller_;
+ Evas_Object *line_scroller_;
+ Evas_Object *shadow_;
+ Evas_Object *line_;
+ Ecore_Timer *timer_;
+
+ cairo_t *line_cairo_;
+ cairo_surface_t *line_surface_;
+
+ cairo_t *shadow_cairo_;
+ cairo_surface_t *shadow_surface_;
+
+ int mapX = -1, mapY = -1, mapW = -1, mapH = -1;
+ int currentYDay = -1;
+
+ static const int LATITUDE_RESOLUTION_ = 181;
+ std::vector<int> day_times_ = std::vector<int>(LATITUDE_RESOLUTION_, 0);
+
+ /**
+ * @brief Returns today's sun declination angle.
+ *
+ * During the Earth movement, sun's position on the horizon
+ * changes from -23.44 to +23.44 degree. This value stores the
+ * angle for current day.
+ *
+ * @param now Current time structure.
+ *
+ * @return Sun declination angle in degrees.
+ *
+ * @note Returned value is double so for example 21 degrees and 15 minutes is
+ * 21.25 in floating point value.
+ */
+ double SunDeclination(std::tm now);
+
+ /**
+ * @brief Returns angle of the time where currently is day.
+ *
+ * @param latitude The latitude
+ * @param declination The sun declination of current day.
+ *
+ * @return Angle in degrees.
+ *
+ * @see GetSunDeclination()
+ */
+ double TimeAngle(int latitude, double declination);
+
+ /**
+ * @brief Requests for map update.
+ *
+ */
+ void MapUpdate();
+
+ /**
+ * @brief Draws night shadow with day/night line.
+ *
+ * @param now The current time structure
+ * @param declination The declination of the current day
+ *
+ * @return True on success, false on failure.
+ */
+ bool ShadowCreate(std::tm now, double declination);
+
+ /**
+ * @brief Creates night shadow.
+ */
+ void ShadowDraw();
+
+ /**
+ * @brief Creates day/night line.
+ */
+ void LineDraw();
+
+ /**
+ * @brief Creates scroller for night shadow.
+ */
+ void ShadowScrollerCreate();
+
+ /**
+ * @brief Creates scroller for day/night line.
+ */
+ void LineScrollerCreate();
+
+ /**
+ * @brief Creates scroller.
+ *
+ * @param part The parent's swallow part.
+ *
+ * @return The Evas_Object of created scroller.
+ */
+ Evas_Object *ScrollerCreate();
+
+ /**
+ * @brief Changes scroller's visible area position.
+ *
+ * @param minutes The move offset
+ */
+ void ShadowMove(int minutes);
+
+ /**
+ * @brief Task to be done on particular time update request.
+ */
+ static Eina_Bool TimerCb(void *data);
+
+ /**
+ * @brief Callback called on properly shown map image.
+ */
+ static void ScrollerResizeCb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+ /**
+ * @brief Callback called on time or timezone change.
+ */
+ static void TimeChangedCb(system_settings_key_e key, void *user_data);
+
+ };
}