Example #1
0
void CAdZapMenu::ShowMenu()
{
	bool show_monitor = monitorLifeTime.tv_sec;

	CMenuWidget *menu = new CMenuWidget(LOCALE_ADZAP, NEUTRINO_ICON_SETTINGS, width);
	//menu->addKey(CRCInput::RC_red, this, "disable");
	menu->addKey(CRCInput::RC_green, this, "enable");
	menu->addKey(CRCInput::RC_blue, this, "monitor");
	menu->addIntroItems();

	CMenuOptionChooser *oc = new CMenuOptionChooser(LOCALE_ADZAP_WRITEDATA, &g_settings.adzap_writeData, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
	oc->setHint(NEUTRINO_ICON_HINT_ADZAP, LOCALE_MENU_HINT_ADZAP_WRITEDATA);
	menu->addItem(oc);

	menu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_ADZAP_SWITCHBACK));

	neutrino_locale_t minute = LOCALE_ADZAP_MINUTE;
	for (int shortcut = 1; shortcut < 10; shortcut++) {
		char actionKey[2];
		actionKey[0] = '0' + shortcut;
		actionKey[1] = 0;
		bool selected = g_settings.adzap_zapBackPeriod == 60 * shortcut;
		forwarders[shortcut - 1] = new CMenuForwarder(minute, true, NULL, this, actionKey, CRCInput::convertDigitToKey(shortcut));
		forwarders[shortcut - 1]->setMarked(selected);
		forwarders[shortcut - 1]->iconName_Info_right = selected ? NEUTRINO_ICON_CHECKMARK : NULL;
		forwarders[shortcut - 1]->setHint(NEUTRINO_ICON_HINT_ADZAP, "");
		menu->addItem(forwarders[shortcut - 1], selected);
		minute = LOCALE_ADZAP_MINUTES;
	}

	menu->addItem(GenericMenuSeparator);

	int zapBackPeriod = g_settings.adzap_zapBackPeriod / 60;
	nc = new CMenuOptionNumberChooser(minute, &zapBackPeriod, true, 10, 120, this, CRCInput::RC_0);
	nc->setMarked(g_settings.adzap_zapBackPeriod / 60 > 9);
	nc->setHint(NEUTRINO_ICON_HINT_ADZAP, "");
	menu->addItem(nc);

	menu->setFooter(CAdZapMenuFooterButtons, CAdZapMenuFooterButtonCount - (show_monitor ? 0 : 1));
	menu->exec(NULL, "");
	menu->hide();
	delete menu;
	Update();
}
void CKernelOptions::Settings()
{
	CMenuWidget *menu = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS);
	menu->addKey(CRCInput::RC_red, this, "reset");
	menu->addKey(CRCInput::RC_green, this, "apply");
	menu->setFooter(KernelOptionsButtons, KernelOptionsButtonCount);
	menu->addIntroItems(LOCALE_KERNELOPTIONS_HEAD, LOCALE_KERNELOPTIONS_MODULES);

	load();

	for (unsigned int i = 0; i < modules.size(); i++) {
		modules[i].mc = new CMenuOptionChooser(modules[i].comment.c_str(), &modules[i].active,
				ONOFF_OPTIONS, ONOFF_OPTION_COUNT, true, this);
		menu->addItem(modules[i].mc);
	}

	updateStatus();

	menu->exec(NULL, "");
	menu->hide();
	delete menu;
}