Skip to content

Commit 7032045

Browse files
committed
added screen to change launcher in Menu
1 parent c062552 commit 7032045

File tree

2 files changed

+36
-40
lines changed

2 files changed

+36
-40
lines changed

src/funkeymenu.cpp

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,19 @@ void FunkeyMenu::add_menu_zone(ENUM_MENU_TYPE menu_type){
348348
text_pos.y = surface->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2;
349349
SDL_BlitSurface(text_surface, NULL, surface, &text_pos);*/
350350
break;
351-
/*case MENU_TYPE_THEME:
352-
MENU_DEBUG_PRINTF("Init MENU_TYPE_THEME\n");
351+
case MENU_TYPE_LAUNCHER:
352+
MENU_DEBUG_PRINTF("Init MENU_TYPE_LAUNCHER\n");
353353
/// ------ Text ------
354-
text_surface = TTF_RenderText_Blended(menu_title_font, "SET THEME", text_color);
354+
text_surface = TTF_RenderText_Blended(menu_title_font, "SET LAUNCHER", text_color);
355355
text_pos.x = (surface->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
356356
text_pos.y = surface->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 - padding_y_from_center_menu_zone*2;
357357
SDL_BlitSurface(text_surface, NULL, surface, &text_pos);
358-
break;*/
358+
/// ------ Text ------
359+
text_surface = TTF_RenderText_Blended(menu_title_font, "RETROFE", text_color);
360+
text_pos.x = (surface->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
361+
text_pos.y = surface->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2;
362+
SDL_BlitSurface(text_surface, NULL, surface, &text_pos);
363+
break;
359364
case MENU_TYPE_POWERDOWN:
360365
MENU_DEBUG_PRINTF("Init MENU_TYPE_POWERDOWN\n");
361366
/// ------ Text ------
@@ -388,8 +393,8 @@ void FunkeyMenu::init_menu_zones(){
388393
//add_menu_zone(MENU_TYPE_EXIT);
389394
/// Init USB Menu
390395
add_menu_zone(MENU_TYPE_USB);
391-
/*/// Init Theme Menu
392-
add_menu_zone(MENU_TYPE_THEME);*/
396+
/// Init Launcher Menu
397+
add_menu_zone(MENU_TYPE_LAUNCHER);
393398
/// Init Powerdown Menu
394399
add_menu_zone(MENU_TYPE_POWERDOWN);
395400
}
@@ -611,22 +616,7 @@ void FunkeyMenu::menu_screen_refresh(int menuItem, int prevItem, int scroll, uin
611616
}
612617
break;
613618

614-
/*case MENU_TYPE_THEME:
615-
/// ---- Write current chosen theme -----
616-
curLayoutName = (char*)getFileName(config->layouts_.at(indexChooseLayout)).c_str();
617-
618-
// no more than max_chars chars in name to fit screen
619-
if(strlen(curLayoutName) > max_chars){
620-
curLayoutName[max_chars-2] = 0;
621-
dots = true;
622-
}
623-
sprintf(text_tmp, "< %s%s >", curLayoutName, dots?"...":"" );
624-
625-
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
626-
text_pos.x = (draw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
627-
text_pos.y = draw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2;
628-
SDL_BlitSurface(text_surface, NULL, draw_screen, &text_pos);
629-
619+
case MENU_TYPE_LAUNCHER:
630620
if(menu_action){
631621
sprintf(text_tmp, "In progress...");
632622
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
@@ -641,7 +631,7 @@ void FunkeyMenu::menu_screen_refresh(int menuItem, int prevItem, int scroll, uin
641631
text_pos.y = draw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
642632
SDL_BlitSurface(text_surface, NULL, draw_screen, &text_pos);
643633
}
644-
break;*/
634+
break;
645635

646636
case MENU_TYPE_EXIT:
647637
case MENU_TYPE_POWERDOWN:
@@ -877,7 +867,7 @@ int FunkeyMenu::launch( )
877867
/// ------ Refresh screen ------
878868
screen_refresh = 1;
879869
}
880-
/*else if(idx_menus[menuItem] == MENU_TYPE_THEME){
870+
/*else if(idx_menus[menuItem] == MENU_TYPE_LAUNCHER){
881871
MENU_DEBUG_PRINTF("Theme previous\n");
882872
883873
/// ------ Refresh screen ------
@@ -937,7 +927,7 @@ int FunkeyMenu::launch( )
937927
/// ------ Refresh screen ------
938928
screen_refresh = 1;
939929
}
940-
/*else if(idx_menus[menuItem] == MENU_TYPE_THEME){
930+
/*else if(idx_menus[menuItem] == MENU_TYPE_LAUNCHER){
941931
MENU_DEBUG_PRINTF("Theme previous\n");
942932
943933
/// ------ Refresh screen ------
@@ -1013,23 +1003,27 @@ int FunkeyMenu::launch( )
10131003
screen_refresh = 1;
10141004
}
10151005
}
1016-
/*else if(idx_menus[menuItem] == MENU_TYPE_THEME){
1006+
else if(idx_menus[menuItem] == MENU_TYPE_LAUNCHER){
10171007
if(menu_confirmation){
1018-
MENU_DEBUG_PRINTF("Theme change - confirmed\n");
1008+
MENU_DEBUG_PRINTF("Lancher change - confirmed\n");
10191009

10201010
/// ------ Refresh Screen -------
10211011
menu_screen_refresh(menuItem, prevItem, scroll, menu_confirmation, 1);
10221012

1013+
/// ----- Shell cmd ----
1014+
MENU_DEBUG_PRINTF("Running command: %s\n", SHELL_CMD_SET_LAUNCHER_RETROFE);
1015+
executeRawPath(SHELL_CMD_SET_LAUNCHER_RETROFE);
1016+
10231017
stop_menu_loop = 1;
10241018
returnCode = MENU_RETURN_EXIT;
10251019
}
10261020
else{
1027-
MENU_DEBUG_PRINTF("Theme change - asking confirmation\n");
1021+
MENU_DEBUG_PRINTF("Launcher change - asking confirmation\n");
10281022
menu_confirmation = 1;
10291023
/// ------ Refresh screen ------
10301024
screen_refresh = 1;
10311025
}
1032-
}*/
1026+
}
10331027
else if(idx_menus[menuItem] == MENU_TYPE_EXIT){
10341028
MENU_DEBUG_PRINTF("Exit game\n");
10351029
if(menu_confirmation){

src/funkeymenu.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typedef enum{
1212
MENU_TYPE_LOAD,
1313
MENU_TYPE_ASPECT_RATIO,
1414
MENU_TYPE_USB,
15-
MENU_TYPE_THEME,
15+
MENU_TYPE_LAUNCHER,
1616
MENU_TYPE_EXIT,
1717
MENU_TYPE_POWERDOWN,
1818
NB_MENU_TYPES,
@@ -43,16 +43,18 @@ typedef enum {ASPECT_RATIOS} ENUM_ASPECT_RATIOS_TYPES;
4343
#define STEP_CHANGE_BRIGHTNESS 10
4444

4545
////------ Menu commands -------
46-
#define SHELL_CMD_VOLUME_GET "volume_get"
47-
#define SHELL_CMD_VOLUME_SET "volume_set"
48-
#define SHELL_CMD_BRIGHTNESS_GET "brightness_get"
49-
#define SHELL_CMD_BRIGHTNESS_SET "brightness_set"
50-
#define SHELL_CMD_USB_DATA_CONNECTED "is_usb_data_connected"
51-
#define SHELL_CMD_USB_MOUNT "share start"
52-
#define SHELL_CMD_USB_UNMOUNT "share stop"
53-
#define SHELL_CMD_USB_CHECK_IS_SHARING "share is_sharing"
54-
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
55-
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
46+
#define SHELL_CMD_VOLUME_GET "volume_get"
47+
#define SHELL_CMD_VOLUME_SET "volume_set"
48+
#define SHELL_CMD_BRIGHTNESS_GET "brightness_get"
49+
#define SHELL_CMD_BRIGHTNESS_SET "brightness_set"
50+
#define SHELL_CMD_USB_DATA_CONNECTED "is_usb_data_connected"
51+
#define SHELL_CMD_USB_MOUNT "share start"
52+
#define SHELL_CMD_USB_UNMOUNT "share stop"
53+
#define SHELL_CMD_USB_CHECK_IS_SHARING "share is_sharing"
54+
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
55+
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
56+
#define SHELL_CMD_SET_LAUNCHER_GMENU2X "set_launcher gmenu2x"
57+
#define SHELL_CMD_SET_LAUNCHER_RETROFE "set_launcher retrofe"
5658

5759
class FunkeyMenu
5860
{

0 commit comments

Comments
 (0)