From 8bb09ca0225886c18e351d3c6156521ed479edd1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 26 Jun 2014 22:13:13 -0500 Subject: Design prefers to have a volume slider instead of presets, so remove the AlarmVolume enum and replace it with an int range. --- tests/manual-test-snap.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'tests/manual-test-snap.cpp') diff --git a/tests/manual-test-snap.cpp b/tests/manual-test-snap.cpp index 90dbe08..cc24a67 100644 --- a/tests/manual-test-snap.cpp +++ b/tests/manual-test-snap.cpp @@ -41,10 +41,29 @@ namespace g_main_loop_quit(static_cast(gloop)); return G_SOURCE_REMOVE; }; + + int volume = 50; + + GOptionEntry entries[] = + { + { "volume", 'v', 0, G_OPTION_ARG_INT, &volume, "Volume level [1..100]", "volume" }, + { NULL } + }; } -int main() +int main(int argc, const char* argv[]) { + GError* error = nullptr; + GOptionContext* context = g_option_context_new(nullptr); + g_option_context_add_main_entries(context, entries, nullptr); + if (!g_option_context_parse(context, &argc, (gchar***)&argv, &error)) + { + g_print("option parsing failed: %s\n", error->message); + exit(1); + } + g_option_context_free(context); + volume = CLAMP(volume, 1, 100); + Appointment a; a.color = "green"; a.summary = "Alarm"; @@ -74,6 +93,7 @@ int main() g_debug("SCHEMA_DIR is %s", SCHEMA_DIR); auto settings = std::make_shared(); + settings->alarm_volume.set(volume); auto timezones = std::make_shared(settings, TIMEZONE_FILE); auto clock = std::make_shared(timezones); Snap snap (clock, settings); -- cgit v1.2.3