aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-04-03 13:11:39 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-04-03 13:11:39 -0500
commit8c7daeeb87abd0be1b96169da18baf018c4859c9 (patch)
treedbcceb67a1cda0ef293394948f358f2b06063dd4 /include
parent6e4367c088eb9026f29295c650f8639e09423212 (diff)
downloadayatana-indicator-datetime-8c7daeeb87abd0be1b96169da18baf018c4859c9.tar.gz
ayatana-indicator-datetime-8c7daeeb87abd0be1b96169da18baf018c4859c9.tar.bz2
ayatana-indicator-datetime-8c7daeeb87abd0be1b96169da18baf018c4859c9.zip
add the new Alarm class as an argument to the alarm queue class
Diffstat (limited to 'include')
-rw-r--r--include/datetime/alarm-queue-simple.h18
-rw-r--r--include/datetime/alarm-queue.h2
-rw-r--r--include/datetime/date-time.h3
-rw-r--r--include/datetime/planner-snooze.h3
4 files changed, 11 insertions, 15 deletions
diff --git a/include/datetime/alarm-queue-simple.h b/include/datetime/alarm-queue-simple.h
index d191aec..838d28a 100644
--- a/include/datetime/alarm-queue-simple.h
+++ b/include/datetime/alarm-queue-simple.h
@@ -20,6 +20,8 @@
#ifndef INDICATOR_DATETIME_ALARM_QUEUE_SIMPLE_H
#define INDICATOR_DATETIME_ALARM_QUEUE_SIMPLE_H
+#include <memory> // std::shared_ptr
+
#include <datetime/alarm-queue.h>
#include <datetime/clock.h>
#include <datetime/planner.h>
@@ -39,20 +41,12 @@ public:
const std::shared_ptr<Planner>& upcoming_planner,
const std::shared_ptr<WakeupTimer>& timer);
~SimpleAlarmQueue();
- core::Signal<const Appointment&>& alarm_reached();
+ core::Signal<const Appointment&, const Alarm&>& alarm_reached() override;
private:
- void requeue();
- bool find_next_alarm(Appointment& setme) const;
- std::vector<Appointment> find_current_alarms() const;
- void check_alarms();
-
- std::set<std::pair<std::string,DateTime>> m_triggered;
- const std::shared_ptr<Clock> m_clock;
- const std::shared_ptr<Planner> m_planner;
- const std::shared_ptr<WakeupTimer> m_timer;
- core::Signal<const Appointment&> m_alarm_reached;
- DateTime m_datetime;
+ class Impl;
+ friend class Impl;
+ std::unique_ptr<Impl> impl;
};
diff --git a/include/datetime/alarm-queue.h b/include/datetime/alarm-queue.h
index ea51957..98abd7a 100644
--- a/include/datetime/alarm-queue.h
+++ b/include/datetime/alarm-queue.h
@@ -45,7 +45,7 @@ class AlarmQueue
public:
AlarmQueue() =default;
virtual ~AlarmQueue() =default;
- virtual core::Signal<const Appointment&>& alarm_reached() = 0;
+ virtual core::Signal<const Appointment&, const Alarm&>& alarm_reached() =0;
};
/***
diff --git a/include/datetime/date-time.h b/include/datetime/date-time.h
index 7dfc207..7e19a9d 100644
--- a/include/datetime/date-time.h
+++ b/include/datetime/date-time.h
@@ -22,6 +22,7 @@
#include <glib.h> // GDateTime
+#include <chrono>
#include <ctime> // time_t
#include <memory> // std::shared_ptr
@@ -43,6 +44,8 @@ public:
DateTime(GTimeZone* tz, GDateTime* dt);
DateTime(GTimeZone* tz, int year, int month, int day, int hour, int minute, double seconds);
DateTime& operator=(const DateTime& in);
+ DateTime& operator+=(const std::chrono::minutes&);
+ DateTime& operator+=(const std::chrono::seconds&);
DateTime to_timezone(const std::string& zone) const;
DateTime start_of_month() const;
DateTime start_of_day() const;
diff --git a/include/datetime/planner-snooze.h b/include/datetime/planner-snooze.h
index e2619fa..fc08d27 100644
--- a/include/datetime/planner-snooze.h
+++ b/include/datetime/planner-snooze.h
@@ -39,9 +39,8 @@ public:
SnoozePlanner(const std::shared_ptr<Settings>&,
const std::shared_ptr<Clock>&);
~SnoozePlanner();
- void add(const Appointment&);
-
core::Property<std::vector<Appointment>>& appointments() override;
+ void add(const Appointment&, const Alarm&);
protected:
class Impl;