* CTestMenu: Add widget id's

- Return menu result, to close all menus
This commit is contained in:
Michael Liebmann
2013-05-21 17:12:32 +02:00
parent 476b896972
commit 2244e418b7
3 changed files with 13 additions and 14 deletions

View File

@@ -34,6 +34,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include <neutrino_menue.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <system/debug.h> #include <system/debug.h>
@@ -61,7 +62,6 @@ extern int cs_test_card(int unit, char * str);
CTestMenu::CTestMenu() CTestMenu::CTestMenu()
{ {
width = w_max (50, 10); width = w_max (50, 10);
selected = -1;
circle = NULL; circle = NULL;
sq = NULL; sq = NULL;
pic= NULL; pic= NULL;
@@ -529,24 +529,22 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
} }
showTestMenu(); return showTestMenu();
return res;
} }
/* shows entries for proxy settings */ /* shows entries for proxy settings */
void CTestMenu::showTestMenu() int CTestMenu::showTestMenu()
{ {
unsigned int system_rev = cs_get_revision(); unsigned int system_rev = cs_get_revision();
//init //init
char rev[255]; char rev[255];
sprintf(rev, "Test menu, System revision %d %s", system_rev, system_rev == 0 ? "WARNING - INVALID" : ""); sprintf(rev, "Test menu, System revision %d %s", system_rev, system_rev == 0 ? "WARNING - INVALID" : "");
CMenuWidget w_test(rev /*"Test menu"*/, NEUTRINO_ICON_INFO, width); CMenuWidget w_test(rev /*"Test menu"*/, NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU);
w_test.addIntroItems(); w_test.addIntroItems();
//hardware //hardware
CMenuWidget * w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width); CMenuWidget * w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_HARDWARE);
w_test.addItem(new CMenuForwarderNonLocalized(w_hw->getName().c_str(), true, NULL, w_hw)); w_test.addItem(new CMenuForwarderNonLocalized(w_hw->getName().c_str(), true, NULL, w_hw));
showHWTests(w_hw); showHWTests(w_hw);
@@ -554,18 +552,16 @@ void CTestMenu::showTestMenu()
w_test.addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons")); w_test.addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons"));
//components //components
CMenuWidget * w_cc = new CMenuWidget("OSD-Components Demo", NEUTRINO_ICON_INFO, width); CMenuWidget * w_cc = new CMenuWidget("OSD-Components Demo", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_COMPONENTS);
w_test.addItem(new CMenuForwarderNonLocalized(w_cc->getName().c_str(), true, NULL, w_cc)); w_test.addItem(new CMenuForwarderNonLocalized(w_cc->getName().c_str(), true, NULL, w_cc));
showCCTests(w_cc); showCCTests(w_cc);
//exit //exit
w_test.exec(NULL, ""); return w_test.exec(NULL, "");;
selected = w_test.getSelected();
} }
void CTestMenu::showCCTests(CMenuWidget *widget) void CTestMenu::showCCTests(CMenuWidget *widget)
{ {
widget->setSelected(selected);
widget->addIntroItems(); widget->addIntroItems();
widget->addItem(new CMenuForwarderNonLocalized("Button", true, NULL, this, "button")); widget->addItem(new CMenuForwarderNonLocalized("Button", true, NULL, this, "button"));
widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle"));
@@ -580,7 +576,6 @@ void CTestMenu::showCCTests(CMenuWidget *widget)
void CTestMenu::showHWTests(CMenuWidget *widget) void CTestMenu::showHWTests(CMenuWidget *widget)
{ {
widget->setSelected(selected);
widget->addIntroItems(); widget->addIntroItems();
widget->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, this, "vfd")); widget->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, this, "vfd"));
widget->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, this, "network")); widget->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, this, "network"));

View File

@@ -52,7 +52,7 @@ class CTestMenu : public CMenuTarget
CComponentsButton *button; CComponentsButton *button;
int width, selected; int width, selected;
void showTestMenu(); int showTestMenu();
void showHWTests(CMenuWidget *widget); void showHWTests(CMenuWidget *widget);
void showCCTests(CMenuWidget *widget); void showCCTests(CMenuWidget *widget);

View File

@@ -171,7 +171,11 @@ enum MN_WIDGET_ID
MN_WIDGET_ID_SCAN_MANUAL_SCAN, MN_WIDGET_ID_SCAN_MANUAL_SCAN,
MN_WIDGET_ID_SCAN_FAST_SCAN, MN_WIDGET_ID_SCAN_FAST_SCAN,
MN_WIDGET_ID_SCAN_CABLE_SCAN, MN_WIDGET_ID_SCAN_CABLE_SCAN,
MN_WIDGET_ID_TESTMENU,
MN_WIDGET_ID_TESTMENU_HARDWARE,
MN_WIDGET_ID_TESTMENU_COMPONENTS,
MN_WIDGET_ID_MAX MN_WIDGET_ID_MAX
}; };