Even though we have a working application, there are some things that might be missing. These things are worth considering, if not in this application, then perhaps in real world applications.
If the model supported some kind of alarm function, Screen2 would have to send the updated time to the Model every time the clock was updated.
- Hint: Screen2View::handleTickEvent().
- Hint: Only update notify the Model if the hour/minute has actually changed, and not on every tick.
Similarly, the clock could be changed in the model by some other background job or hardware in your application.
- Hint: Read minute/hour from the model in the tick handler before updating the values, and write them back to the model immediately.
- Hint: Consider adding a locking mechanism to make sure no other process is changing the clock values in the model
If the clock is running for a long time, the arc start and arc end might overflow, as the arc is stored as an integer with an upper value.
- Hint: If the getArcStart() > 360 it is safe to subtract 360 from both the arc start and arc end.
Change the application to start on the clock screen instead of the configuration screen.
- Hint: Simply click button "Set as Startup Screen" when Screen2 is selected.
Make the clock run as soon as Screen2 is entered (instead of after the animation has ended).
- Hint: Move "tickCounter++;" outside the "if (!textClock.isMoveAnimationRunning())".
Screen1 and Screen2 are acceptable names for this small example. Consider changing the names of the screens to something better.
- Hint: e.g. ClockConfigScreen and RunningClockScreen.
- Hint: Maybe even ClockConfig and RunningClock.
Updating the wildcard buffers in the views involves two calls to snprintf(). Consider moving these lines to a separate function to reduce the amount of duplicate code in the application.
- Hint: Add function "void updateClockText();" in Screen1View.hpp and add the implementation in Screen1View.cpp. Do the same for Screen2View.hpp and Screen2View.cpp.
Change the screen transition effects.
- Hint: If the transition is "North" to go to one screen, the transition for going back should be the opposite direction ("South") to give the impression that the two screens are placed next to each other.