summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-08-27 14:24:58 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-08-27 14:24:58 +0000
commit443f609be62b812878c7c9a832d8014ab56bbf6f (patch)
treea6fcc58959babc1b94881c6e2a2235f0f7679207
parented940e883079a323b0764532a7444ad022685ae4 (diff)
downloadrockbox-443f609be62b812878c7c9a832d8014ab56bbf6f.tar.gz
rockbox-443f609be62b812878c7c9a832d8014ab56bbf6f.tar.bz2
rockbox-443f609be62b812878c7c9a832d8014ab56bbf6f.zip
Rearange menu of mpegplayer. Add new menu with "settings" and "quit", and remove quit item from settings menu.
The setting menu was bit wierd as it had "quit" item at it's buttom. Also, there are 2 almost same menu definitions in mpeg_menu and it doesn't looks good, imo. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22518 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c80
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.h21
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c26
3 files changed, 70 insertions, 57 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index 3868d759f6..d361cc818e 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -259,6 +259,7 @@ static const struct opt_items globaloff[2] = {
#define BACKLIGHT_OPTION_DEFAULT "Use setting"
#endif
+static void mpeg_settings(void);
static long mpeg_menu_sysevent_id;
void mpeg_menu_sysevent_clear(void)
@@ -831,9 +832,8 @@ static int show_start_menu(uint32_t duration)
struct hms hms;
MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_menu_sysevent_callback,
- "Play from beginning", resume_str,
- "Set start time", "Settings",
- "Quit mpegplayer");
+ "Play from beginning", resume_str, "Set start time",
+ "Settings", "Quit mpegplayer");
ts_to_hms(settings.resume_time, &hms);
hms_format(hms_str, sizeof(hms_str), &hms);
@@ -872,9 +872,9 @@ static int show_start_menu(uint32_t duration)
break;
case MPEG_START_SETTINGS:
- if (mpeg_menu(MPEG_MENU_HIDE_QUIT_ITEM) != MPEG_MENU_QUIT)
- break;
- /* Fall-through */
+ mpeg_settings();
+ break;
+
default:
result = MPEG_START_QUIT;
menu_quit = true;
@@ -916,6 +916,44 @@ int mpeg_start_menu(uint32_t duration)
}
}
+int mpeg_menu(void)
+{
+ int result;
+
+ MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_menu_sysevent_callback,
+ "Settings", "Resume playback", "Quit mpegplayer");
+
+ rb->button_clear_queue();
+
+ mpeg_menu_sysevent_clear();
+
+ result = rb->do_menu(&menu, NULL, NULL, false);
+
+ switch (result)
+ {
+ case MPEG_MENU_SETTINGS:
+ mpeg_settings();
+ break;
+
+ case MPEG_MENU_RESUME:
+ break;
+
+ case MPEG_MENU_QUIT:
+ break;
+
+ default:
+ break;
+ }
+
+ if (mpeg_menu_sysevent() != 0)
+ result = MPEG_MENU_QUIT;
+
+ rb->lcd_clear_display();
+ rb->lcd_update();
+
+ return result;
+}
+
/** MPEG Menu **/
static void display_options(void)
{
@@ -1078,25 +1116,16 @@ static void clear_resume_count(void)
configfile_update_entry(SETTINGS_FILENAME, "Resume count", 0);
}
-int mpeg_menu(unsigned flags)
+static void mpeg_settings(void)
{
int selected = 0;
int result;
bool menu_quit = false;
static char clear_str[32];
- MENUITEM_STRINGLIST(menu_with_quit, "Mpegplayer Menu",
- mpeg_menu_sysevent_callback,
- "Display Options", "Audio Options",
- "Resume Options", clear_str, "Quit mpegplayer");
- MENUITEM_STRINGLIST(menu_without_quit, "Settings",
- mpeg_menu_sysevent_callback,
+ MENUITEM_STRINGLIST(menu, "Settings", mpeg_menu_sysevent_callback,
"Display Options", "Audio Options",
"Resume Options", clear_str);
- const struct menu_item_ex *menu = &menu_with_quit;
-
- if (flags & MPEG_MENU_HIDE_QUIT_ITEM)
- menu = &menu_without_quit;
rb->button_clear_queue();
@@ -1112,39 +1141,30 @@ int mpeg_menu(unsigned flags)
switch (result)
{
- case MPEG_MENU_DISPLAY_SETTINGS:
+ case MPEG_SETTING_DISPLAY_SETTINGS:
display_options();
break;
- case MPEG_MENU_AUDIO_SETTINGS:
+ case MPEG_SETTING_AUDIO_SETTINGS:
audio_options();
break;
- case MPEG_MENU_ENABLE_START_MENU:
+ case MPEG_SETTING_ENABLE_START_MENU:
resume_options();
break;
- case MPEG_MENU_CLEAR_RESUMES:
+ case MPEG_SETTING_CLEAR_RESUMES:
clear_resume_count();
break;
- case MPEG_MENU_QUIT:
default:
menu_quit = true;
break;
}
if (mpeg_menu_sysevent() != 0)
- {
- result = MPEG_MENU_QUIT;
menu_quit = true;
- }
}
-
- rb->lcd_clear_display();
- rb->lcd_update();
-
- return result;
}
void init_settings(const char* filename)
diff --git a/apps/plugins/mpegplayer/mpeg_settings.h b/apps/plugins/mpegplayer/mpeg_settings.h
index fa50176161..95ecc29546 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.h
+++ b/apps/plugins/mpegplayer/mpeg_settings.h
@@ -56,12 +56,18 @@ enum mpeg_start_id
MPEG_START_EXIT,
};
+enum mpeg_setting_id
+{
+ MPEG_SETTING_DISPLAY_SETTINGS,
+ MPEG_SETTING_AUDIO_SETTINGS,
+ MPEG_SETTING_ENABLE_START_MENU,
+ MPEG_SETTING_CLEAR_RESUMES,
+};
+
enum mpeg_menu_id
{
- MPEG_MENU_DISPLAY_SETTINGS,
- MPEG_MENU_AUDIO_SETTINGS,
- MPEG_MENU_ENABLE_START_MENU,
- MPEG_MENU_CLEAR_RESUMES,
+ MPEG_MENU_SETTINGS,
+ MPEG_MENU_RESUME,
MPEG_MENU_QUIT,
};
@@ -91,13 +97,8 @@ struct mpeg_settings {
extern struct mpeg_settings settings;
int mpeg_start_menu(uint32_t duration);
+int mpeg_menu(void);
-enum
-{
- MPEG_MENU_HIDE_QUIT_ITEM = 0x1, /* Don't show the quit item */
-};
-
-int mpeg_menu(unsigned flags);
void mpeg_menu_sysevent_clear(void);
long mpeg_menu_sysevent(void);
int mpeg_menu_sysevent_callback(int btn, const struct menu_item_ex *menu);
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 47407cca8e..a66a588ace 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -1485,10 +1485,8 @@ static void button_loop(void)
rb->lcd_clear_display();
rb->lcd_update();
-#if defined(HAVE_LCD_MODES)
-#if (HAVE_LCD_MODES & LCD_MODE_YUV)
- rb->lcd_set_mode(LCD_MODE_YUV);
-#endif
+#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_YUV);
#endif
wvs_init();
@@ -1569,13 +1567,11 @@ static void button_loop(void)
stream_show_vo(false);
wvs_backlight_brightness_video_mode(false);
-#if defined(HAVE_LCD_MODES)
-#if (HAVE_LCD_MODES & LCD_MODE_YUV)
- rb->lcd_set_mode(LCD_MODE_RGB565);
-#endif
+#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_RGB565);
#endif
- result = mpeg_menu(0);
+ result = mpeg_menu();
/* The menu can change the font, so restore */
rb->lcd_setfont(FONT_SYSFIXED);
@@ -1587,10 +1583,8 @@ static void button_loop(void)
break;
default:
-#if defined(HAVE_LCD_MODES)
-#if (HAVE_LCD_MODES & LCD_MODE_YUV)
- rb->lcd_set_mode(LCD_MODE_YUV);
-#endif
+#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_YUV);
#endif
/* If not stopped, show video again */
if (state != STREAM_STOPPED) {
@@ -1751,10 +1745,8 @@ enum plugin_status plugin_start(const void* parameter)
}
}
-#if defined(HAVE_LCD_MODES)
-#if (HAVE_LCD_MODES & LCD_MODE_YUV)
- rb->lcd_set_mode(LCD_MODE_RGB565);
-#endif
+#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_RGB565);
#endif
stream_exit();