A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

plugins: clock: adjust defaults, don't restore color

- Default to round border in analog mode
- Default to segmented LCD style in digital and binary mode
- Default to date format most fitting for current language
(instead of D-M-Y)
- Don't forcibly set a light background before menu is
displayed or when quitting
- Update manual

Change-Id: Ifb6a41bb99701ae8f8cbf5fa0db2a3a332085f43

+61 -90
+2 -3
apps/plugins/clock/clock.c
··· 65 65 *************************/ 66 66 static void cleanup(void) 67 67 { 68 - clock_draw_restore_colors(); 69 68 if(clock_settings.general.save_settings == 1) 70 69 save_settings(); 71 70 ··· 181 180 break; 182 181 #endif 183 182 case ACTION_MENU: 184 - clock_draw_restore_colors(); 185 183 FOR_NB_SCREENS(i) 186 184 rb->viewportmanager_theme_enable(i, true, NULL); 187 185 exit_clock=main_menu(); ··· 198 196 break; 199 197 } 200 198 201 - if(redraw){ 199 + if (redraw && !exit_clock) 200 + { 202 201 clock_draw_set_colors(); 203 202 FOR_NB_SCREENS(i) 204 203 clock_draw(rb->screens[i], &time, &counter);
-14
apps/plugins/clock/clock_draw.c
··· 64 64 white_background(display); 65 65 } 66 66 67 - static void skin_restore_background(struct screen* display, int mode, int skin){ 68 - if(skin_require_black_background(mode, skin) ) 69 - white_background(display); 70 - } 71 - 72 67 void clock_draw_set_colors(void){ 73 68 FOR_NB_SCREENS(i) 74 69 skin_set_background(rb->screens[i], 75 70 clock_settings.mode, 76 71 clock_settings.skin[clock_settings.mode]); 77 - } 78 - 79 - void clock_draw_restore_colors(void){ 80 - FOR_NB_SCREENS(i){ 81 - skin_restore_background(rb->screens[i], 82 - clock_settings.mode, 83 - clock_settings.skin[clock_settings.mode]); 84 - rb->screens[i]->update(); 85 - } 86 72 } 87 73 88 74 void clock_draw(struct screen* display, struct time* time,
+18 -4
apps/plugins/clock/clock_settings.c
··· 58 58 59 59 void clock_settings_reset(struct clock_settings* settings){ 60 60 settings->mode = ANALOG; 61 - int i; 62 - for(i=0;i<NB_CLOCK_MODES;i++){ 63 - settings->skin[i]=0; 64 - } 65 61 settings->general.date_format = EUROPEAN; 62 + settings->skin[ANALOG] = 1; /* round */ 63 + settings->skin[DIGITAL] = 1; /* LCD-style */ 64 + settings->skin[BINARY] = 2; /* LCD-style */ 65 + for (const char *ptr = rb->str(LANG_VOICED_DATE_FORMAT) ; *ptr; ptr++) 66 + { 67 + if (*ptr == 'd') 68 + break; 69 + else if (*ptr == 'Y') 70 + { 71 + settings->general.date_format = JAPANESE; 72 + break; 73 + } 74 + else if (*ptr == 'A' || *ptr == 'm') 75 + { 76 + settings->general.date_format = ENGLISH; 77 + break; 78 + } 79 + } 66 80 settings->general.save_settings = true; 67 81 settings->general.idle_poweroff=true; 68 82 settings->general.backlight = ROCKBOX_SETTING;
+41 -69
manual/plugins/clock.tex
··· 1 1 \subsection{Clock} 2 2 \screenshot{plugins/images/ss-clock}{Clock}{img:clock} 3 3 4 - This is a fully featured analogue and digital clock plugin. 4 + Clock with an analog, digital, and binary mode. 5 + Includes a handy timer and can show the current date. 5 6 6 7 \subsubsection{Key configuration} 7 8 ··· 13 14 \nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginUp{} / \PluginDown} 14 15 \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginDown} 15 16 \opt{HAVEREMOTEKEYMAP}{& \PluginRCUp{} / \PluginRCDown} 16 - & Cycle through skins \\ 17 - 18 - \nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginCancel} 19 - \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonMenu} 20 - \opt{HAVEREMOTEKEYMAP}{& \PluginRCCancel} 21 - & Main Menu \\ 17 + & Cycle through different skins in each mode \\ 22 18 23 19 \PluginSelect 24 20 \opt{HAVEREMOTEKEYMAP}{& \PluginRCSelect} 25 - & Start / Stop Counter \\ 21 + & Start or stop timer (visible in analog or digital mode) \\ 26 22 27 23 \PluginSelectRepeat 28 24 \opt{HAVEREMOTEKEYMAP}{& \PluginRCSelectRepeat} 29 - & Reset Counter \\ 25 + & Reset and hide the timer \\ 26 + 27 + \nopt{IPOD_4G_PAD,IPOD_3G_PAD}{\PluginCancel} 28 + \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonMenu} 29 + \opt{HAVEREMOTEKEYMAP}{& \PluginRCCancel} 30 + & Open Clock menu \\ 30 31 \end{btnmap} 31 32 32 33 \textbf{Clock Menu} 33 34 \begin{description} 34 - \item[View Clock] Exits the menu and returns to the current clock mode display. 35 - \item[Mode Selector] Opens a menu from which you can select a clock mode to view. 36 - \item[Counter Settings] Opens a menu from which you can adjust settings 37 - pertaining to the counter. 38 - \item[Mode Settings] Opens a menu from which you can adjust settings pertaining to 39 - the current clock mode (analog, digital, binary). 40 - \item[General Settings] 35 + \item[Mode] Select analog, digital, or binary mode. 36 + \item[Settings] 41 37 \begin{description} 42 - \item[Reset Settings] 43 - Reset all settings to their default values. 38 + \item[Analog] Adjust settings pertaining to the analog mode. 39 + \item[Digital] Adjust settings pertaining to the digital mode. 40 + \item[Date Format] 41 + Switch between formatting used in the United States (M-D-Y), Europe (D-M-Y), and Japan (Y-M-D). 42 + \item[Backlight] 43 + Keep backlight turned off, on, or have it respect the system setting. 44 + \item[Idle Poweroff] 45 + Temporarily enable or disable Idle Poweroff while the plugin is running. 46 + \item[Save On Exit] 47 + Save settings to disk when the plugin is quit (enabled by default). 44 48 \item[Save Settings] 45 49 Save all settings to disk. 46 - \item[Show Counter] 47 - Toggle Counter display. 48 - \item[Save] 49 - Choose whether to disable automatic saving, saving to disk on exit, or 50 - saving to disk every settings change. 51 - \item[Backlight] 52 - Choose whether to disable the backlight, use the user's timeout setting, 53 - or keep the backlight on. 54 - \item[Idle Poweroff] 55 - Toggle Idle Poweroff. 56 - \note{This setting is not saved to disk.} 50 + \item[Reset Settings] 51 + Reset all settings to their default values. 57 52 \end{description} 58 - \item[Help] Opens a brief help screen with key mappings and functionality. 59 - \item[Credits] Displays a credits roll. 53 + \item[Playback Control] Show the playback control menu. 54 + \item[Quit] Quit the plugin. 60 55 \end{description} 61 56 62 - \subsubsection{Analog mode} 63 - Small, round, analog clock is displayed in the middle of the LCD. 64 - Time readout, if enabled, is displayed at the upper left. 65 - If Time readout is in 12-hour (``12h'') mode, AM or PM will be displayed at the 66 - upper right. The Date readout, if enabled, is displayed at the lower left. 67 - The Counter, if enabled, is displayed at the lower right. 68 - The second hand, if enabled, is displayed along with the hour and minute hands. 69 - Digit display, if enabled, places ``12'', ``3'', ``6'', and ``9'' around the 70 - face of the clock in their respective positions. 57 + \subsubsection{Analog} 58 + In analog mode, you can switch between two skins: One is round, the other square. 59 + Both the second hand and the border can be hidden by going into Settings. 60 + You can also choose to display the current date in the lower left corner. 61 + Any running timer will appear in the lower right corner. 71 62 72 - \subsubsection{Digital mode} 73 - An imitation of an LCD, this mode shows a Clock comprised of digital ``segments''. 74 - The Date readout, if enabled, is displayed at the bottom, center. 75 - The Second readout, if in ``Text'' mode, is displayed at the top, center; if in 76 - ``Bar'' mode, is displayed as a progress bar at the top of the LCD; if in 77 - ``Invert'' mode, will invert the LCD left-to-right as the seconds pass (a 78 - fully-inverted LCD means the entire minute has passed). 79 - The Counter, if displayed, is shown at the upper left. 80 - The Blinking Colon, if enabled, blinks the colon once every second. 81 - 12-hour mode, if enabled, will display the time in a 12-hour format. 82 63 83 - \subsubsection{LCD mode} 84 - Based on the Digital Mode, the LCD mode is another imitation of an LCD. 85 - The settings available in this mode are exactly the same as Digital Mode, but 86 - they are independent of Digital Mode. For example, you can have the Date 87 - Readout enabled in Digital Mode and disabled in LCD Mode. 64 + \subsubsection{Digital} 65 + Digital mode imitates a segmented LCD by default. A plain display style is 66 + also available, by switching to a different skin. 67 + The current date is displayed on the bottom, unless it is disabled. 68 + You can hide seconds, or make the colon blink once every second. 69 + Any running timer will appear on the bottom. 88 70 89 - \subsubsection{Fullscreen} 90 - A Fullscreen clock is displayed. Show Border, if enabled, will draw a small 91 - box at every hour position (1 to 12 inclusive). 92 - Invert Seconds, if enabled, will invert the LCD as the seconds pass. 93 - Second Hand, if enabled, will draw a second hand among the hour and minute hands. 94 - 95 - \subsubsection{Binary mode} 96 - This mode shows a Binary clock. 97 - The hour is displayed on the top line, the minute is displayed on the middle 98 - line, and the seconds are on the last line. 99 - Circle mode, if enabled, draws empty and full circles, instead of zeros and ones. 71 + \subsubsection{Binary} 72 + Binary mode can either display ones and zeros, or filled and empty circles, depending 73 + on your chosen skin. The default binary skin imitates a segmented LCD. 74 + The three rows show hours on top, followed by minutes, then seconds. 100 75 For help on reading binary, please visit: 101 76 \url{http://en.wikipedia.org/wiki/Binary_numeral_system} 102 - 103 - \subsubsection{Plain mode} 104 - This mode shows a ``plain'' clock in large text that takes up nearly the whole LCD.