This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#12101 - Option for date format
Attached to Project:
Rockbox
Opened by Matthieu Pupat (tieum) - Saturday, 07 May 2011, 02:52 GMT+2
Last edited by sideral (sideral) - Tuesday, 10 May 2011, 09:19 GMT+2
Opened by Matthieu Pupat (tieum) - Saturday, 07 May 2011, 02:52 GMT+2
Last edited by sideral (sideral) - Tuesday, 10 May 2011, 09:19 GMT+2
|
DetailsAttached is a patch that:
* adds an option to chose the date format in the system menu (choice between YMD, DMY and MDY) * adds a %cF theme tag so that theme can know in which order to display the date There are a few new strings that I only added in English. This is my very first rockbox patch so please let me know if anything should be improved. I did the patch against svn 29827 and tested it in a simulated Fuze v2 as well as a real one. |
This task depends upon
1. I'm not sure we need such configurability in the menu. The date is set once and is then just there. Where we do need configurability is in the WPS or in the status bar, but then we already have tags for specific parts of the date, so the theme authors can display it how they want. The same applies to the time format, so I'd exclude that option too.
If we'd still include this feature, I have some (pure subjective) comments on the code style.
2. I'd introduce constants (or enums) for the date formats, e.g. DATEFORMAT_DMY, ..._MDY, ..._YMD
3. I would rename the lang symbols from LANG_DATE_YMD to LANG_DATEFORMAT_YMD etc.
4. I would rename the wps token to SKIN_TOKEN_RTC_DATEFORMAT
5. I would place the menu option for the date format *before* the option for the time format
6. In the switch (global_settings.dateformat) I'd probably introduce local variable for day, month, and year, and then use them in sprintf -- to avoid code duplication. Same for the 'talk_date'.
Otherwise the code looks OK to me (I have not tried it though).
But: see 1 above.