Pumubuntu/Pumubuntu — pull request #22 by miguelalba (2014-03-14 08:24:41+00:00)
Title: Improved timer, thread and time labels

Ok, this is a big change.

First, the CountingThread's run method is much simpler. Now it doesn't check the status as its not necessary. The thread.event ensures prevents the thread from running when the status is Stop, so there is no need to check the status again. The run method have 2 scenarios: running a pomodoro/break/pause or run out of time (mins and secs equals to 0). If the latter, it switches status and gets time. When the thread starts mins and secs are 0 (pretty important). Otherwise the run method would not work.

Secondly, I also applied the observer pattern to the timer (observable or subject) and the time label (observer), so that the time label is automatically updated and other displays could be added at any time (like a widget or sth). It's not thread-safe yet, I'll add a lock later.