aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-04-24 11:04:55 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-04-24 11:04:55 -0500
commitcff541acfef717aae4c9b696627b4817e7eac851 (patch)
tree52dae8e92864e64c2959546c316be74bcd3dad9d
parent4008e0a91ebdc1cf5c5715a122fed318124c8802 (diff)
downloadayatana-indicator-datetime-cff541acfef717aae4c9b696627b4817e7eac851.tar.gz
ayatana-indicator-datetime-cff541acfef717aae4c9b696627b4817e7eac851.tar.bz2
ayatana-indicator-datetime-cff541acfef717aae4c9b696627b4817e7eac851.zip
rename 'clock-watcher' as 'alarm-queue' because the former name isn't very informative.
-rw-r--r--include/datetime/alarm-queue.h (renamed from include/datetime/clock-watcher.h)20
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/alarm-queue.cpp (renamed from src/clock-watcher.cpp)14
-rw-r--r--src/main.cpp6
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/test-alarm-queue.cpp (renamed from tests/test-clock-watcher.cpp)18
6 files changed, 31 insertions, 31 deletions
diff --git a/include/datetime/clock-watcher.h b/include/datetime/alarm-queue.h
index 90bbb63..5db4ad8 100644
--- a/include/datetime/clock-watcher.h
+++ b/include/datetime/alarm-queue.h
@@ -17,8 +17,8 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#ifndef INDICATOR_DATETIME_CLOCK_WATCHER_H
-#define INDICATOR_DATETIME_CLOCK_WATCHER_H
+#ifndef INDICATOR_DATETIME_ALARM_QUEUE_H
+#define INDICATOR_DATETIME_ALARM_QUEUE_H
#include <datetime/appointment.h>
#include <datetime/clock.h>
@@ -39,24 +39,24 @@ namespace datetime {
* \brief Watches the clock and appointments to notify when an
* appointment's time is reached.
*/
-class ClockWatcher
+class AlarmQueue
{
public:
- ClockWatcher() =default;
- virtual ~ClockWatcher() =default;
+ AlarmQueue() =default;
+ virtual ~AlarmQueue() =default;
virtual core::Signal<const Appointment&>& alarm_reached() = 0;
};
/**
- * \brief A #ClockWatcher implementation
+ * \brief A #AlarmQueue implementation
*/
-class ClockWatcherImpl: public ClockWatcher
+class AlarmQueueImpl: public AlarmQueue
{
public:
- ClockWatcherImpl(const std::shared_ptr<Clock>& clock,
+ AlarmQueueImpl(const std::shared_ptr<Clock>& clock,
const std::shared_ptr<UpcomingPlanner>& upcoming_planner);
- ~ClockWatcherImpl() =default;
+ ~AlarmQueueImpl() =default;
core::Signal<const Appointment&>& alarm_reached();
private:
@@ -72,4 +72,4 @@ private:
} // namespace indicator
} // namespace unity
-#endif // INDICATOR_DATETIME_CLOCK_WATCHER_H
+#endif // INDICATOR_DATETIME_ALARM_QUEUE_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9bc22f2..6b65ebc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,10 +10,10 @@ add_definitions (-DTIMEZONE_FILE="/etc/timezone"
add_library (${SERVICE_LIB} STATIC
actions.cpp
actions-live.cpp
+ alarm-queue.cpp
appointment.cpp
clock.cpp
clock-live.cpp
- clock-watcher.cpp
date-time.cpp
engine-eds.cpp
exporter.cpp
diff --git a/src/clock-watcher.cpp b/src/alarm-queue.cpp
index 5da66c8..9e9da7f 100644
--- a/src/clock-watcher.cpp
+++ b/src/alarm-queue.cpp
@@ -17,7 +17,7 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#include <datetime/clock-watcher.h>
+#include <datetime/alarm-queue.h>
namespace unity {
namespace indicator {
@@ -27,36 +27,36 @@ namespace datetime {
****
***/
-ClockWatcherImpl::ClockWatcherImpl(const std::shared_ptr<Clock>& clock,
+AlarmQueueImpl::AlarmQueueImpl(const std::shared_ptr<Clock>& clock,
const std::shared_ptr<UpcomingPlanner>& upcoming_planner):
m_clock(clock),
m_upcoming_planner(upcoming_planner)
{
m_clock->date_changed.connect([this](){
const auto now = m_clock->localtime();
- g_debug("ClockWatcher %p refretching appointments due to date change: %s", this, now.format("%F %T").c_str());
+ g_debug("AlarmQueue %p refretching appointments due to date change: %s", this, now.format("%F %T").c_str());
m_upcoming_planner->date().set(now);
});
m_clock->minute_changed.connect([this](){
- g_debug("ClockWatcher %p calling pulse() due to clock minute_changed", this);
+ g_debug("AlarmQueue %p calling pulse() due to clock minute_changed", this);
pulse();
});
m_upcoming_planner->appointments().changed().connect([this](const std::vector<Appointment>&){
- g_debug("ClockWatcher %p calling pulse() due to appointments changed", this);
+ g_debug("AlarmQueue %p calling pulse() due to appointments changed", this);
pulse();
});
pulse();
}
-core::Signal<const Appointment&>& ClockWatcherImpl::alarm_reached()
+core::Signal<const Appointment&>& AlarmQueueImpl::alarm_reached()
{
return m_alarm_reached;
}
-void ClockWatcherImpl::pulse()
+void AlarmQueueImpl::pulse()
{
const auto now = m_clock->localtime();
diff --git a/src/main.cpp b/src/main.cpp
index c7b35e5..238bd02 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,8 +18,8 @@
*/
#include <datetime/actions-live.h>
+#include <datetime/alarm-queue.h>
#include <datetime/clock.h>
-#include <datetime/clock-watcher.h>
#include <datetime/engine-mock.h>
#include <datetime/engine-eds.h>
#include <datetime/exporter.h>
@@ -80,9 +80,9 @@ main(int /*argc*/, char** /*argv*/)
// snap decisions
std::shared_ptr<UpcomingPlanner> upcoming_planner(new UpcomingPlanner(std::shared_ptr<RangePlanner>(new SimpleRangePlanner(engine, file_timezone)), now));
- ClockWatcherImpl clock_watcher(live_clock, upcoming_planner);
+ AlarmQueueImpl alarm_queue(live_clock, upcoming_planner);
Snap snap;
- clock_watcher.alarm_reached().connect([&snap](const Appointment& appt){
+ alarm_queue.alarm_reached().connect([&snap](const Appointment& appt){
auto snap_show = [](const Appointment& a){
const char* url;
if(!a.url.empty())
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7d590c9..fe6d7eb 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -41,8 +41,8 @@ function(add_test_by_name name)
target_link_libraries (${TEST_NAME} indicatordatetimeservice gtest ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS})
endfunction()
add_test_by_name(test-actions)
+add_test_by_name(test-alarm-queue)
add_test_by_name(test-clock)
-add_test_by_name(test-clock-watcher)
add_test_by_name(test-exporter)
add_test_by_name(test-formatter)
add_test_by_name(test-live-actions)
diff --git a/tests/test-clock-watcher.cpp b/tests/test-alarm-queue.cpp
index 2425fe8..881a4ad 100644
--- a/tests/test-clock-watcher.cpp
+++ b/tests/test-alarm-queue.cpp
@@ -17,7 +17,7 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#include <datetime/clock-watcher.h>
+#include <datetime/alarm-queue.h>
#include <gtest/gtest.h>
@@ -25,7 +25,7 @@
using namespace unity::indicator::datetime;
-class ClockWatcherFixture: public StateFixture
+class AlarmQueueFixture: public StateFixture
{
private:
@@ -34,7 +34,7 @@ private:
protected:
std::vector<std::string> m_triggered;
- std::unique_ptr<ClockWatcher> m_watcher;
+ std::unique_ptr<AlarmQueue> m_watcher;
std::shared_ptr<RangePlanner> m_range_planner;
std::shared_ptr<UpcomingPlanner> m_upcoming;
@@ -44,7 +44,7 @@ protected:
m_range_planner.reset(new MockRangePlanner);
m_upcoming.reset(new UpcomingPlanner(m_range_planner, m_state->clock->localtime()));
- m_watcher.reset(new ClockWatcherImpl(m_state->clock, m_upcoming));
+ m_watcher.reset(new AlarmQueueImpl(m_state->clock, m_upcoming));
m_watcher->alarm_reached().connect([this](const Appointment& appt){
m_triggered.push_back(appt.uid);
});
@@ -108,7 +108,7 @@ protected:
****
***/
-TEST_F(ClockWatcherFixture, AppointmentsChanged)
+TEST_F(AlarmQueueFixture, AppointmentsChanged)
{
// Add some appointments to the planner.
// One of these matches our state's localtime, so that should get triggered.
@@ -122,7 +122,7 @@ TEST_F(ClockWatcherFixture, AppointmentsChanged)
}
-TEST_F(ClockWatcherFixture, TimeChanged)
+TEST_F(AlarmQueueFixture, TimeChanged)
{
// Add some appointments to the planner.
// Neither of these match the state's localtime, so nothing should be triggered.
@@ -138,7 +138,7 @@ TEST_F(ClockWatcherFixture, TimeChanged)
}
-TEST_F(ClockWatcherFixture, MoreThanOne)
+TEST_F(AlarmQueueFixture, MoreThanOne)
{
const auto now = m_state->clock->localtime();
std::vector<Appointment> a = build_some_appointments();
@@ -151,7 +151,7 @@ TEST_F(ClockWatcherFixture, MoreThanOne)
}
-TEST_F(ClockWatcherFixture, NoDuplicates)
+TEST_F(AlarmQueueFixture, NoDuplicates)
{
// Setup: add an appointment that gets triggered.
const auto now = m_state->clock->localtime();
@@ -164,7 +164,7 @@ TEST_F(ClockWatcherFixture, NoDuplicates)
EXPECT_EQ(a[0].uid, m_triggered[0]);
// Now change the appointment vector by adding one to it.
- // Confirm that the ClockWatcher doesn't re-trigger a[0]
+ // Confirm that the AlarmQueue doesn't re-trigger a[0]
a.push_back(appointments[1]);
m_range_planner->appointments().set(a);
EXPECT_EQ(1, m_triggered.size());