Bug 58 - TimerInterface incomplete wrt snoozing?
Status:
RESOLVED FIXED
Component:
Core
Version:
unspecified
Hardware:
PC Linux
Importance:
P3 normal
Target Milestone:
---
Assignee:
Rob Caelers
URL:
Depends on:
Blocks:
Reported:
Sep 11 2002 20:09:02 UTC
by:
Raymond Penners
Modified:
Sep 11 2002 21:31:46 UTC
WhoWhenWhatRemovedAdded
Rob CaelersSep 11 2002 20:57:06 UTCstatusNEWASSIGNED
Rob CaelersSep 11 2002 21:31:46 UTCstatusASSIGNEDRESOLVED
resolutionFIXED
Description
Raymond Penners  Sep 11 2002 20:09:02 UTC
The snooze equivalent of the following API is missing, is this intentional?:
  // Auto-resetting.
  virtual time_t get_auto_reset() const = 0;
  virtual time_t get_next_reset_time() const = 0;
  virtual bool is_auto_reset_enabled() const = 0;
Comment 1
Rob Caelers  Sep 11 2002 20:41:29 UTC
Yes, more or less....
Currently, the timer does not automatically snooze when the limit is reached and
the timer is overdue. When the client (i.e. GUI) receives a "limit reached" it
must explicitly call snooze(). This will just set the next_limit_time to
current_time + snooze_time. 

If snooze is not called, no further warnings as given until is timer is reset
and reaches its limit again..... this WILL get changed. I already forgot some
calls to snooze()....

Comment 2
Raymond Penners  Sep 11 2002 20:44:12 UTC
Sorry, I should make myself more clear next time. I didn't mean the missing
get_next...() method, I meant get_snooze(). It is needed for the preferences dialog
Comment 3
Rob Caelers  Sep 11 2002 21:08:08 UTC
Why ? Prefs calls the configurator to retrieve/set the snooze value. Control
informs the timer when the value changes. Why do you want direct communication
between prefs and controlinterface???
Comment 4
Raymond Penners  Sep 11 2002 21:21:32 UTC
In the prefsdialog I did:

 auto_reset_time_entry->set_value(mptimer->get_auto_reset());
 limit_time_entry->set_value(mptimer->get_limit());
 snoze_time_entry->set_value(mptimer->get_snooze());  // <-- LINK ERROR

Snooze was missing, so I filed a bug. 

I never thought of replacing mptimer->get() by configurator->get_key().
Probably because my coding style tends to be direct. If I can get to a piece of
data directly, I prefer to do so. Ofcourse, get_key() is less direct compared to
timer->get_auto_reset(), as a matter of fact, using get_key() is extremely
inefficient compared to get_snooze() { return snooze; }.

Also, I like consistency. If I use the get_key() method, I prefer using
get_key() throughout the _whole_ GUI code. Otherwise, it just is a bad mix of
get_key() and get_auto_reset(), and it is not clear, to me at least, when to use
what. Is it to you?

So, if you had to make a choice here (and IMHO, you have to), what will it be?
Replace all timer->get_auto_reset() and timer->get_limit() calls with a
configurator::get_key(CFG_KEY_TIMER + timer->id + CFG_KEY_AUTO_RESET/LIMIT) ?
Comment 5
Rob Caelers  Sep 11 2002 21:23:28 UTC
I leave the decision up to you. Direct calls are fine with me. I added a
get_snooze() to TimerInterface. Snoozing is now also done automatically by the
Timer. No need to explicitly call snooze().

(will commit/resolve when tested)