int launcher(){; char *rom = 0; char *dir = rc_getstr("romdir"); char version_str[80]; snprintf(version_str, sizeof(version_str)-1, "gnuboy %s", VERSION); gui_begin(); launcher: dialog_begin("OhBoy http://ohboy.googlecode.com/", version_str); dialog_text("Load ROM",NULL,FIELD_SELECTABLE); dialog_text("Options",NULL,FIELD_SELECTABLE); dialog_text("Controls",NULL,FIELD_SELECTABLE); dialog_text("About",NULL,FIELD_SELECTABLE); dialog_text("Quit","",FIELD_SELECTABLE); #ifdef DINGOO_NATIVE dialog_text(NULL, NULL, 0); /* blank line */ dialog_text("Menu:", NULL, 0); dialog_text(" Slide Power", NULL, 0); #endif /* DINGOO_NATIVE */ switch(dialog_end()){ case 1: rom = menu_requestfile(NULL,"Select Rom",dir,"gb;gbc;zip"); if(!rom) goto launcher; break; case 2: if(!menu_options()) goto launcher; break; case 3: if(!menu_controls()) goto launcher; break; case 4: if(!menu_about()) goto launcher; break; case 5: SDL_QuitSubSystem(SDL_INIT_EVERYTHING); SDL_Quit(); exit(0); default: goto launcher; } gui_end(); return rom; }
PopupMenu::PopupMenu(QWidget * parent) : Inherited(parent) { QAction * a; QMenu * m; QActionGroup * g; addSeparator(); a = new QAction(tr("Lock window position"), this); a->setCheckable(true); addAction(a); lock_pos = a; a = new QAction(tr("Keep window always on top"), this); a->setCheckable(true); addAction(a); window_ontop = a; connect(a, SIGNAL(triggered()), parent, SLOT(menu_ontop())); addSeparator(); m = addMenu("Hours mode"); g = new QActionGroup(this); a = new QAction(tr("12-hours mode (from 1 to 12)"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); hours_mode_actions[0] = a; connect(a, SIGNAL(triggered()), this, SLOT(hours_mode())); a = new QAction(tr("12-hours mode and PM/AM indication"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); hours_mode_actions[1] = a; connect(a, SIGNAL(triggered()), this, SLOT(hours_mode())); a = new QAction(tr("24-hours mode (from 0 to 23)"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); hours_mode_actions[2] = a; connect(a, SIGNAL(triggered()), this, SLOT(hours_mode())); connect(this, SIGNAL(update_hours_mode()), parent, SLOT(menu_hours_mode())); m = addMenu("ToolTip"); a = new QAction(tr("Time"), this); a->setCheckable(true); m->addAction(a); tooltip_time_action = a; a = new QAction(tr("Unix time"), this); a->setCheckable(true); m->addAction(a); tooltip_unixtime_action = a; m->addSeparator(); g = new QActionGroup(this); a = new QAction(tr("Dec"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); tooltip_dec_action = a; a = new QAction(tr("Hex"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); tooltip_hex_action = a; m->addSeparator(); a = new QAction(tr("Set font"), this); m->addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_font())); a = new QAction(tr("Set text color"), this); m->addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_fg())); a = new QAction(tr("Set background color"), this); m->addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_bg())); addSeparator(); a = new QAction(tr("Color of \"0\" indicator"), this); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(color_0())); a = new QAction(tr("Color of \"1\" indicator"), this); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(color_1())); a = new QAction(tr("Restore original colors"), this); addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_oem_colors())); addSeparator(); a = new QAction(tr("Save current settings as default"), this); addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_save_setings())); addSeparator(); a = new QAction(tr("About"), this); connect(a, SIGNAL(triggered()), parent, SLOT(menu_about())); addAction(a); a = new QAction(tr("About Qt"), this); connect(a, SIGNAL(triggered()), parent, SLOT(menu_about_qt())); addAction(a); addSeparator(); a = new QAction(tr("Quit"), this); addAction(a); connect(a, SIGNAL(triggered()), parent, SIGNAL(menu_quit())); connect(this, SIGNAL(set_color(int)), parent, SLOT(menu_color(int))); }
int menu(){ char *dir; int mexit=0; static char *loadrom; int old_upscale = 0, new_upscale = 0; old_upscale = rc_getint("upscaler"); gui_begin(); while(!mexit){ dialog_begin(rom.name,"ohBoy"); dialog_text("Back to Game",NULL,FIELD_SELECTABLE); dialog_text("Load State",NULL,FIELD_SELECTABLE); dialog_text("Save State",NULL,FIELD_SELECTABLE); dialog_text("Reset Game",NULL,FIELD_SELECTABLE); dialog_text(NULL,NULL,0); dialog_text("Load ROM",NULL,FIELD_SELECTABLE); dialog_text("Options",NULL,FIELD_SELECTABLE); dialog_text("Controls",NULL,FIELD_SELECTABLE); dialog_text("About",NULL,FIELD_SELECTABLE); dialog_text("Quit","",FIELD_SELECTABLE); #ifdef DINGOO_NATIVE dialog_text(NULL, NULL, 0); /* blank line */ dialog_text("Menu:", NULL, 0); dialog_text(" Slide Power", NULL, 0); #endif /* DINGOO_NATIVE */ switch(dialog_end()){ case 2: if(menu_state(0)) mexit=1; break; case 3: if(menu_state(1)) mexit=1; break; case 4: rc_command("reset"); mexit=1; break; case 6: dir = rc_getstr("romdir"); if(loadrom = menu_requestfile(NULL,"Select Rom",dir,"gb;gbc;zip")) { loader_unload(); ohb_loadrom(loadrom); mexit=1; } break; case 7: if(menu_options()) mexit=1; break; case 8: if(menu_controls()) mexit=1; break; case 9: if(menu_about()) mexit=0; break; case 10: exit(0); break; default: mexit=1; break; } } new_upscale = rc_getint("upscaler"); if (old_upscale != new_upscale) scaler_init(new_upscale); gui_end(); return 0; }