summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer
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 /apps/plugins/mpegplayer
parented940e883079a323b0764532a7444ad022685ae4 (diff)
downloadrockbox-443f609be62b812878c7c9a832d8014ab56bbf6f.tar.gz
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
Diffstat (limited to 'apps/plugins/mpegplayer')
-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] = {
259#define BACKLIGHT_OPTION_DEFAULT "Use setting" 259#define BACKLIGHT_OPTION_DEFAULT "Use setting"
260#endif 260#endif
261 261
262static void mpeg_settings(void);
262static long mpeg_menu_sysevent_id; 263static long mpeg_menu_sysevent_id;
263 264
264void mpeg_menu_sysevent_clear(void) 265void mpeg_menu_sysevent_clear(void)
@@ -831,9 +832,8 @@ static int show_start_menu(uint32_t duration)
831 struct hms hms; 832 struct hms hms;
832 833
833 MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_menu_sysevent_callback, 834 MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_menu_sysevent_callback,
834 "Play from beginning", resume_str, 835 "Play from beginning", resume_str, "Set start time",
835 "Set start time", "Settings", 836 "Settings", "Quit mpegplayer");
836 "Quit mpegplayer");
837 837
838 ts_to_hms(settings.resume_time, &hms); 838 ts_to_hms(settings.resume_time, &hms);
839 hms_format(hms_str, sizeof(hms_str), &hms); 839 hms_format(hms_str, sizeof(hms_str), &hms);
@@ -872,9 +872,9 @@ static int show_start_menu(uint32_t duration)
872 break; 872 break;
873 873
874 case MPEG_START_SETTINGS: 874 case MPEG_START_SETTINGS:
875 if (mpeg_menu(MPEG_MENU_HIDE_QUIT_ITEM) != MPEG_MENU_QUIT) 875 mpeg_settings();
876 break; 876 break;
877 /* Fall-through */ 877
878 default: 878 default:
879 result = MPEG_START_QUIT; 879 result = MPEG_START_QUIT;
880 menu_quit = true; 880 menu_quit = true;
@@ -916,6 +916,44 @@ int mpeg_start_menu(uint32_t duration)
916 } 916 }
917} 917}
918 918
919int mpeg_menu(void)
920{
921 int result;
922
923 MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_menu_sysevent_callback,
924 "Settings", "Resume playback", "Quit mpegplayer");
925
926 rb->button_clear_queue();
927
928 mpeg_menu_sysevent_clear();
929
930 result = rb->do_menu(&menu, NULL, NULL, false);
931
932 switch (result)
933 {
934 case MPEG_MENU_SETTINGS:
935 mpeg_settings();
936 break;
937
938 case MPEG_MENU_RESUME:
939 break;
940
941 case MPEG_MENU_QUIT:
942 break;
943
944 default:
945 break;
946 }
947
948 if (mpeg_menu_sysevent() != 0)
949 result = MPEG_MENU_QUIT;
950
951 rb->lcd_clear_display();
952 rb->lcd_update();
953
954 return result;
955}
956
919/** MPEG Menu **/ 957/** MPEG Menu **/
920static void display_options(void) 958static void display_options(void)
921{ 959{
@@ -1078,25 +1116,16 @@ static void clear_resume_count(void)
1078 configfile_update_entry(SETTINGS_FILENAME, "Resume count", 0); 1116 configfile_update_entry(SETTINGS_FILENAME, "Resume count", 0);
1079} 1117}
1080 1118
1081int mpeg_menu(unsigned flags) 1119static void mpeg_settings(void)
1082{ 1120{
1083 int selected = 0; 1121 int selected = 0;
1084 int result; 1122 int result;
1085 bool menu_quit = false; 1123 bool menu_quit = false;
1086 static char clear_str[32]; 1124 static char clear_str[32];
1087 1125
1088 MENUITEM_STRINGLIST(menu_with_quit, "Mpegplayer Menu", 1126 MENUITEM_STRINGLIST(menu, "Settings", mpeg_menu_sysevent_callback,
1089 mpeg_menu_sysevent_callback,
1090 "Display Options", "Audio Options",
1091 "Resume Options", clear_str, "Quit mpegplayer");
1092 MENUITEM_STRINGLIST(menu_without_quit, "Settings",
1093 mpeg_menu_sysevent_callback,
1094 "Display Options", "Audio Options", 1127 "Display Options", "Audio Options",
1095 "Resume Options", clear_str); 1128 "Resume Options", clear_str);
1096 const struct menu_item_ex *menu = &menu_with_quit;
1097
1098 if (flags & MPEG_MENU_HIDE_QUIT_ITEM)
1099 menu = &menu_without_quit;
1100 1129
1101 rb->button_clear_queue(); 1130 rb->button_clear_queue();
1102 1131
@@ -1112,39 +1141,30 @@ int mpeg_menu(unsigned flags)
1112 1141
1113 switch (result) 1142 switch (result)
1114 { 1143 {
1115 case MPEG_MENU_DISPLAY_SETTINGS: 1144 case MPEG_SETTING_DISPLAY_SETTINGS:
1116 display_options(); 1145 display_options();
1117 break; 1146 break;
1118 1147
1119 case MPEG_MENU_AUDIO_SETTINGS: 1148 case MPEG_SETTING_AUDIO_SETTINGS:
1120 audio_options(); 1149 audio_options();
1121 break; 1150 break;
1122 1151
1123 case MPEG_MENU_ENABLE_START_MENU: 1152 case MPEG_SETTING_ENABLE_START_MENU:
1124 resume_options(); 1153 resume_options();
1125 break; 1154 break;
1126 1155
1127 case MPEG_MENU_CLEAR_RESUMES: 1156 case MPEG_SETTING_CLEAR_RESUMES:
1128 clear_resume_count(); 1157 clear_resume_count();
1129 break; 1158 break;
1130 1159
1131 case MPEG_MENU_QUIT:
1132 default: 1160 default:
1133 menu_quit = true; 1161 menu_quit = true;
1134 break; 1162 break;
1135 } 1163 }
1136 1164
1137 if (mpeg_menu_sysevent() != 0) 1165 if (mpeg_menu_sysevent() != 0)
1138 {
1139 result = MPEG_MENU_QUIT;
1140 menu_quit = true; 1166 menu_quit = true;
1141 }
1142 } 1167 }
1143
1144 rb->lcd_clear_display();
1145 rb->lcd_update();
1146
1147 return result;
1148} 1168}
1149 1169
1150void init_settings(const char* filename) 1170void 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
56 MPEG_START_EXIT, 56 MPEG_START_EXIT,
57}; 57};
58 58
59enum mpeg_setting_id
60{
61 MPEG_SETTING_DISPLAY_SETTINGS,
62 MPEG_SETTING_AUDIO_SETTINGS,
63 MPEG_SETTING_ENABLE_START_MENU,
64 MPEG_SETTING_CLEAR_RESUMES,
65};
66
59enum mpeg_menu_id 67enum mpeg_menu_id
60{ 68{
61 MPEG_MENU_DISPLAY_SETTINGS, 69 MPEG_MENU_SETTINGS,
62 MPEG_MENU_AUDIO_SETTINGS, 70 MPEG_MENU_RESUME,
63 MPEG_MENU_ENABLE_START_MENU,
64 MPEG_MENU_CLEAR_RESUMES,
65 MPEG_MENU_QUIT, 71 MPEG_MENU_QUIT,
66}; 72};
67 73
@@ -91,13 +97,8 @@ struct mpeg_settings {
91extern struct mpeg_settings settings; 97extern struct mpeg_settings settings;
92 98
93int mpeg_start_menu(uint32_t duration); 99int mpeg_start_menu(uint32_t duration);
100int mpeg_menu(void);
94 101
95enum
96{
97 MPEG_MENU_HIDE_QUIT_ITEM = 0x1, /* Don't show the quit item */
98};
99
100int mpeg_menu(unsigned flags);
101void mpeg_menu_sysevent_clear(void); 102void mpeg_menu_sysevent_clear(void);
102long mpeg_menu_sysevent(void); 103long mpeg_menu_sysevent(void);
103int mpeg_menu_sysevent_callback(int btn, const struct menu_item_ex *menu); 104int 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)
1485 rb->lcd_clear_display(); 1485 rb->lcd_clear_display();
1486 rb->lcd_update(); 1486 rb->lcd_update();
1487 1487
1488#if defined(HAVE_LCD_MODES) 1488#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
1489#if (HAVE_LCD_MODES & LCD_MODE_YUV) 1489 rb->lcd_set_mode(LCD_MODE_YUV);
1490 rb->lcd_set_mode(LCD_MODE_YUV);
1491#endif
1492#endif 1490#endif
1493 1491
1494 wvs_init(); 1492 wvs_init();
@@ -1569,13 +1567,11 @@ static void button_loop(void)
1569 stream_show_vo(false); 1567 stream_show_vo(false);
1570 wvs_backlight_brightness_video_mode(false); 1568 wvs_backlight_brightness_video_mode(false);
1571 1569
1572#if defined(HAVE_LCD_MODES) 1570#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
1573#if (HAVE_LCD_MODES & LCD_MODE_YUV) 1571 rb->lcd_set_mode(LCD_MODE_RGB565);
1574 rb->lcd_set_mode(LCD_MODE_RGB565);
1575#endif
1576#endif 1572#endif
1577 1573
1578 result = mpeg_menu(0); 1574 result = mpeg_menu();
1579 1575
1580 /* The menu can change the font, so restore */ 1576 /* The menu can change the font, so restore */
1581 rb->lcd_setfont(FONT_SYSFIXED); 1577 rb->lcd_setfont(FONT_SYSFIXED);
@@ -1587,10 +1583,8 @@ static void button_loop(void)
1587 break; 1583 break;
1588 1584
1589 default: 1585 default:
1590#if defined(HAVE_LCD_MODES) 1586#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
1591#if (HAVE_LCD_MODES & LCD_MODE_YUV) 1587 rb->lcd_set_mode(LCD_MODE_YUV);
1592 rb->lcd_set_mode(LCD_MODE_YUV);
1593#endif
1594#endif 1588#endif
1595 /* If not stopped, show video again */ 1589 /* If not stopped, show video again */
1596 if (state != STREAM_STOPPED) { 1590 if (state != STREAM_STOPPED) {
@@ -1751,10 +1745,8 @@ enum plugin_status plugin_start(const void* parameter)
1751 } 1745 }
1752 } 1746 }
1753 1747
1754#if defined(HAVE_LCD_MODES) 1748#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV)
1755#if (HAVE_LCD_MODES & LCD_MODE_YUV) 1749 rb->lcd_set_mode(LCD_MODE_RGB565);
1756 rb->lcd_set_mode(LCD_MODE_RGB565);
1757#endif
1758#endif 1750#endif
1759 1751
1760 stream_exit(); 1752 stream_exit();