volatile char factoryReset(char key, char first)
{
	if(first)
	{
		lcd.cls();
		lcd.writeString(14, 12, TEXT("Reset all"));
		lcd.writeString(14, 22, TEXT("settings?"));
		menu.setTitle(TEXT("Reset"));
		menu.setBar(TEXT("CANCEL"), TEXT("RESET"));
		lcd.update();
	}

	switch(key)
	{
	   case FL_KEY:
		    return FN_CANCEL;

	   case FR_KEY:
	   		settings_default();
	   		menu.message(TEXT("Factory Reset"));
		    return FN_CANCEL;
	}

	return FN_CONTINUE;
}
Exemplo n.º 2
0
void settings_init()
{
    settings_load();
    uint8_t need_save = 0;
    if(conf.shutterVersion != SHUTTER_VERSION)
    {
        timer.setDefault();
        conf.shutterVersion = SHUTTER_VERSION;
        need_save = 1;
    }
    if(conf.settingsVersion != SETTINGS_VERSION)
    {
        settings_default();
        need_save = 0;
        settings_reset = 1;
        // This is where we'd put a setup wizard
    }
    if(need_save) settings_save();
}
Exemplo n.º 3
0
/*
 * start parsed action by name.
 */
int tc_local_action(const string tcommand, unsigned int tlen)
{
	letter       ntcommand[1024]; /* null terminated command string */

	/* we'll need a null terminated string */

	if(!tlen)return 0;
	if(tlen > 1024)return 0;
	
	str_mcpy(ntcommand, tcommand, tlen);
	ntcommand[tlen] = 0;

	/* action! */

	if(tcommand[0] != uni('-')) /* not an option, it's a file */
	{
		audio_playlist_add(ntcommand, 0, 0);

		if(audio_playlist_getcount() == 1)
		{
			audio_playlist_switch(0);
			audio_play();
		}
	}else{ /* option */

		switch(tcommand[1])
		{

		case uni('0'): /* zero volume */
			audio_setvolume(0.0f, 0.0f);
			break;
		
		case uni('1'): /* full volume */
			audio_setvolume(1.0f, 1.0f);
			break;

		case uni('i'):
		case uni('I'):
			
			if(MessageBox(0, uni("Set file association settings?"), uni("Fennec Player - Installation"), MB_ICONQUESTION | MB_YESNO) == IDYES)
			{
				letter         icopath[1024];
				letter         fennecpath[1024];
				letter         ext[260];
				letter         dsc[260];
				unsigned int   i = 0;

				memset(fennecpath, 0, sizeof(fennecpath));

				GetModuleFileName(instance_fennec, fennecpath, sizeof(fennecpath));
					
				while(audio_input_getextensionsinfo(i, ext, dsc))
				{
					str_cpy(icopath, fennec_get_path(0, 0));
					str_cat(icopath, uni("\\"));
					str_cat(icopath, icon_library);
				
					fileassociation_set(ext, uni("Play"), uni("&Play in Fennec Player"), icopath, fennecpath, dsc, -1);

					memset(ext, 0, sizeof(ext));
					memset(dsc, 0, sizeof(dsc));

					i++;
				}

				SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, 0, 0);
				
				
			}

			if((ntcommand[2] != uni('S')) && (ntcommand[2] != uni('s')))
			{
				settings_save();
				fennec_power_exit();
			}
			break;

		case uni('u'):
		case uni('U'):
			if(str_incmp(ntcommand, uni("-uninstall"), str_len(uni("-uninstall"))) == 0)
			{
				unsigned long i = 0;
				letter        ext[255], dsc[255];

				while(audio_input_getextensionsinfo(i, ext, dsc))
				{
					fileassociation_restore(ext);
					i++;
				}

#				ifdef system_microsoft_windows
					SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, 0, 0);
#				endif

				fennec_register_contextmenu(0); /* unregister context menu */
				fennec_power_exit();
			}
			break;

		case uni('d'):
			settings_default();
			settings_save();
			break;

		}
	}

	return 1;
}