From 835daa7778171256a02d8695776d0b8262b7b637 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 2 Feb 2014 15:28:52 -0600 Subject: copyediting: don't use camelCaseFunctionNames() in timezones-file --- include/datetime/timezone-file.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/datetime/timezone-file.h b/include/datetime/timezone-file.h index d77aaae..a67c01a 100644 --- a/include/datetime/timezone-file.h +++ b/include/datetime/timezone-file.h @@ -42,8 +42,8 @@ public: ~FileTimezone(); private: - void setFilename(const std::string& filename); - static void onFileChanged(gpointer gself); + void set_filename(const std::string& filename); + static void on_file_changed(gpointer gself); void clear(); void reload(); -- cgit v1.2.3 From fcc1ab27cbc36983be51589800d269b055356b2b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 2 Feb 2014 22:37:22 -0600 Subject: from alarm dev branch: add the alarm watcher and its unit tests --- include/datetime/clock-watcher.h | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 include/datetime/clock-watcher.h (limited to 'include') diff --git a/include/datetime/clock-watcher.h b/include/datetime/clock-watcher.h new file mode 100644 index 0000000..e93b468 --- /dev/null +++ b/include/datetime/clock-watcher.h @@ -0,0 +1,72 @@ +/* + * Copyright 2014 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + * Authors: + * Charles Kerr + */ + +#ifndef INDICATOR_DATETIME_CLOCK_WATCHER_H +#define INDICATOR_DATETIME_CLOCK_WATCHER_H + +#include +#include + +#include + +#include +#include +#include + +namespace unity { +namespace indicator { +namespace datetime { + + +/** + * \brief Watches the clock and appointments to notify when an + * appointment's time is reached. + */ +class ClockWatcher +{ +public: + ClockWatcher() =default; + virtual ~ClockWatcher() =default; + virtual core::Signal& alarm_reached() = 0; +}; + + +/** + * \brief A #ClockWatcher implementation + */ +class ClockWatcherImpl: public ClockWatcher +{ +public: + ClockWatcherImpl(const std::shared_ptr& state); + ~ClockWatcherImpl() =default; + core::Signal& alarm_reached(); + +private: + void pulse(); + std::set m_triggered; + std::shared_ptr m_state; + core::Signal m_alarm_reached; +}; + + +} // namespace datetime +} // namespace indicator +} // namespace unity + +#endif // INDICATOR_DATETIME_CLOCK_WATCHER_H -- cgit v1.2.3 From 8365f5e3a35254b7234ac6f6edc43278cea11279 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 3 Feb 2014 00:42:57 -0600 Subject: add header file which should have been bzr add'ed last commit --- include/datetime/snap.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 include/datetime/snap.h (limited to 'include') diff --git a/include/datetime/snap.h b/include/datetime/snap.h new file mode 100644 index 0000000..d6f5aad --- /dev/null +++ b/include/datetime/snap.h @@ -0,0 +1,51 @@ +/* + * Copyright 2014 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + * Authors: + * Charles Kerr + */ + +#ifndef INDICATOR_DATETIME_SNAP_H +#define INDICATOR_DATETIME_SNAP_H + +#include +#include +#include + +#include + +namespace unity { +namespace indicator { +namespace datetime { + +/** + * \brief Pops up Snap Decisions for appointments + */ +class Snap +{ +public: + Snap(const std::shared_ptr&); + virtual ~Snap() =default; + void operator()(const Appointment&); + +private: + PhoneFormatter m_formatter; +}; + +} // namespace datetime +} // namespace indicator +} // namespace unity + +#endif // INDICATOR_DATETIME_SNAP_H -- cgit v1.2.3 From 894c0c625ff1e2f2d031f48f157a3008302cb5a7 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 4 Feb 2014 00:10:17 -0600 Subject: pin the planner's upcoming appointments to the live clock time, rather than the calendar's time, so that they always update correctly in real-time --- include/datetime/planner-eds.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/datetime/planner-eds.h b/include/datetime/planner-eds.h index f3abce0..a99f611 100644 --- a/include/datetime/planner-eds.h +++ b/include/datetime/planner-eds.h @@ -20,9 +20,10 @@ #ifndef INDICATOR_DATETIME_PLANNER_EDS_H #define INDICATOR_DATETIME_PLANNER_EDS_H +#include #include -#include // unique_ptr +#include // shared_ptr, unique_ptr namespace unity { namespace indicator { @@ -34,7 +35,7 @@ namespace datetime { class PlannerEds: public Planner { public: - PlannerEds(); + PlannerEds(const std::shared_ptr& clock); virtual ~PlannerEds(); private: -- cgit v1.2.3 From 61accb9ce497e1f1cbe8038ac495d66d6a4505ff Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 4 Feb 2014 09:57:51 -0600 Subject: use the appointment's beginning time in the title of the alarm Snap Decision --- include/datetime/snap.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/datetime/snap.h b/include/datetime/snap.h index d6f5aad..584d895 100644 --- a/include/datetime/snap.h +++ b/include/datetime/snap.h @@ -21,8 +21,6 @@ #define INDICATOR_DATETIME_SNAP_H #include -#include -#include #include @@ -36,12 +34,9 @@ namespace datetime { class Snap { public: - Snap(const std::shared_ptr&); - virtual ~Snap() =default; + Snap(); + virtual ~Snap(); void operator()(const Appointment&); - -private: - PhoneFormatter m_formatter; }; } // namespace datetime -- cgit v1.2.3 From 61581201f13509fbce9eb05fc90a5da17307c6a3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 4 Feb 2014 13:00:22 -0600 Subject: Add audio notitication when the alarm is triggered. Add a manual test to tests/ to trigger a snap decision. --- include/datetime/snap.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/datetime/snap.h b/include/datetime/snap.h index 584d895..a493772 100644 --- a/include/datetime/snap.h +++ b/include/datetime/snap.h @@ -23,6 +23,7 @@ #include #include +#include namespace unity { namespace indicator { @@ -36,7 +37,11 @@ class Snap public: Snap(); virtual ~Snap(); - void operator()(const Appointment&); + + typedef std::function appointment_func; + void operator()(const Appointment& appointment, + appointment_func show, + appointment_func dismiss); }; } // namespace datetime -- cgit v1.2.3 From 613cbb1d468fe99767a5541956266191511ec9ef Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 5 Feb 2014 16:26:34 -0600 Subject: remove alarms from the menu once they've been shown in a snap decision. --- include/datetime/planner-eds.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/datetime/planner-eds.h b/include/datetime/planner-eds.h index a99f611..4110ba5 100644 --- a/include/datetime/planner-eds.h +++ b/include/datetime/planner-eds.h @@ -20,6 +20,7 @@ #ifndef INDICATOR_DATETIME_PLANNER_EDS_H #define INDICATOR_DATETIME_PLANNER_EDS_H +#include #include #include @@ -37,6 +38,7 @@ class PlannerEds: public Planner public: PlannerEds(const std::shared_ptr& clock); virtual ~PlannerEds(); + void block_appointment(const Appointment& appointment); private: class Impl; -- cgit v1.2.3 From 4f27e42b0a517fac386042c67efc721463115bb9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 5 Feb 2014 16:52:57 -0600 Subject: revert r400; we can't block alarms by UID because that would hide recurring alarms --- include/datetime/planner-eds.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/datetime/planner-eds.h b/include/datetime/planner-eds.h index 4110ba5..a99f611 100644 --- a/include/datetime/planner-eds.h +++ b/include/datetime/planner-eds.h @@ -20,7 +20,6 @@ #ifndef INDICATOR_DATETIME_PLANNER_EDS_H #define INDICATOR_DATETIME_PLANNER_EDS_H -#include #include #include @@ -38,7 +37,6 @@ class PlannerEds: public Planner public: PlannerEds(const std::shared_ptr& clock); virtual ~PlannerEds(); - void block_appointment(const Appointment& appointment); private: class Impl; -- cgit v1.2.3 From bf68bbe34cf8a8769345d1f36cc09cdc5d0ae07c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 5 Feb 2014 18:09:49 -0600 Subject: another pass at removing alarms from the menu once they're no longer upcoming. This version fixes the header's icon as well. --- include/datetime/date-time.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/datetime/date-time.h b/include/datetime/date-time.h index 2ad7856..b054a1f 100644 --- a/include/datetime/date-time.h +++ b/include/datetime/date-time.h @@ -41,6 +41,7 @@ public: DateTime& operator=(GDateTime* in); DateTime& operator=(const DateTime& in); DateTime to_timezone(const std::string& zone) const; + DateTime add_full(int years, int months, int days, int hours, int minutes, double seconds) const; void reset(GDateTime* in=nullptr); GDateTime* get() const; @@ -48,9 +49,11 @@ public: std::string format(const std::string& fmt) const; int day_of_month() const; + double seconds() const; int64_t to_unix() const; bool operator<(const DateTime& that) const; + bool operator<=(const DateTime& that) const; bool operator!=(const DateTime& that) const; bool operator==(const DateTime& that) const; -- cgit v1.2.3