aboutsummaryrefslogtreecommitdiff
path: root/include/datetime
diff options
context:
space:
mode:
Diffstat (limited to 'include/datetime')
-rw-r--r--include/datetime/planner-aggregate.h52
-rw-r--r--include/datetime/planner-snooze.h56
-rw-r--r--include/datetime/planner.h5
-rw-r--r--include/datetime/settings-live.h1
-rw-r--r--include/datetime/settings-shared.h1
-rw-r--r--include/datetime/settings.h1
-rw-r--r--include/datetime/snap.h4
7 files changed, 116 insertions, 4 deletions
diff --git a/include/datetime/planner-aggregate.h b/include/datetime/planner-aggregate.h
new file mode 100644
index 0000000..892e71a
--- /dev/null
+++ b/include/datetime/planner-aggregate.h
@@ -0,0 +1,52 @@
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Charles Kerr <charles.kerr@canonical.com>
+ */
+
+#ifndef INDICATOR_DATETIME_PLANNER_AGGREGATE_H
+#define INDICATOR_DATETIME_PLANNER_AGGREGATE_H
+
+#include <datetime/planner.h>
+
+#include <memory>
+
+namespace unity {
+namespace indicator {
+namespace datetime {
+
+/**
+ * \brief Aggregates one or more Planners
+ */
+class AggregatePlanner: public Planner
+{
+public:
+ AggregatePlanner();
+ virtual ~AggregatePlanner();
+ void add(const std::shared_ptr<Planner>&);
+
+ core::Property<std::vector<Appointment>>& appointments() override;
+
+protected:
+ class Impl;
+ std::unique_ptr<Impl> impl;
+};
+
+} // namespace datetime
+} // namespace indicator
+} // namespace unity
+
+#endif // INDICATOR_DATETIME_PLANNER_AGGREGATE_H
diff --git a/include/datetime/planner-snooze.h b/include/datetime/planner-snooze.h
new file mode 100644
index 0000000..e2619fa
--- /dev/null
+++ b/include/datetime/planner-snooze.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 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 <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Charles Kerr <charles.kerr@canonical.com>
+ */
+
+#ifndef INDICATOR_DATETIME_PLANNER_SNOOZE_H
+#define INDICATOR_DATETIME_PLANNER_SNOOZE_H
+
+#include <datetime/clock.h>
+#include <datetime/planner.h>
+#include <datetime/settings.h>
+
+#include <memory>
+
+namespace unity {
+namespace indicator {
+namespace datetime {
+
+/**
+ * A planner to hold 'Snooze' copies of other appointments
+ */
+class SnoozePlanner: public Planner
+{
+public:
+ SnoozePlanner(const std::shared_ptr<Settings>&,
+ const std::shared_ptr<Clock>&);
+ ~SnoozePlanner();
+ void add(const Appointment&);
+
+ core::Property<std::vector<Appointment>>& appointments() override;
+
+protected:
+ class Impl;
+ friend class Impl;
+ std::unique_ptr<Impl> impl;
+};
+
+} // namespace datetime
+} // namespace indicator
+} // namespace unity
+
+#endif // INDICATOR_DATETIME_PLANNER_H
diff --git a/include/datetime/planner.h b/include/datetime/planner.h
index e6ef927..22b6381 100644
--- a/include/datetime/planner.h
+++ b/include/datetime/planner.h
@@ -37,11 +37,12 @@ namespace datetime {
class Planner
{
public:
- virtual ~Planner() =default;
+ virtual ~Planner();
virtual core::Property<std::vector<Appointment>>& appointments() =0;
protected:
- Planner() =default;
+ Planner();
+ static void sort(std::vector<Appointment>&);
};
} // namespace datetime
diff --git a/include/datetime/settings-live.h b/include/datetime/settings-live.h
index 4850e69..bb4cd8d 100644
--- a/include/datetime/settings-live.h
+++ b/include/datetime/settings-live.h
@@ -59,6 +59,7 @@ private:
void update_alarm_volume();
void update_alarm_duration();
void update_alarm_haptic();
+ void update_snooze_duration();
GSettings* m_settings;
diff --git a/include/datetime/settings-shared.h b/include/datetime/settings-shared.h
index a211821..c18cfaf 100644
--- a/include/datetime/settings-shared.h
+++ b/include/datetime/settings-shared.h
@@ -49,5 +49,6 @@ TimeFormatMode;
#define SETTINGS_ALARM_VOLUME_S "alarm-default-volume"
#define SETTINGS_ALARM_DURATION_S "alarm-duration-minutes"
#define SETTINGS_ALARM_HAPTIC_S "alarm-haptic-feedback"
+#define SETTINGS_SNOOZE_DURATION_S "snooze-duration-minutes"
#endif // INDICATOR_DATETIME_SETTINGS_SHARED
diff --git a/include/datetime/settings.h b/include/datetime/settings.h
index c6fe13b..0294f60 100644
--- a/include/datetime/settings.h
+++ b/include/datetime/settings.h
@@ -60,6 +60,7 @@ public:
core::Property<std::string> alarm_haptic;
core::Property<unsigned int> alarm_volume;
core::Property<unsigned int> alarm_duration;
+ core::Property<unsigned int> snooze_duration;
};
} // namespace datetime
diff --git a/include/datetime/snap.h b/include/datetime/snap.h
index ef5c868..572158d 100644
--- a/include/datetime/snap.h
+++ b/include/datetime/snap.h
@@ -44,8 +44,8 @@ public:
typedef std::function<void(const Appointment&)> appointment_func;
void operator()(const Appointment& appointment,
- appointment_func show,
- appointment_func dismiss);
+ appointment_func snooze,
+ appointment_func ok);
private:
class Impl;