From eaa4b4025e4dcbccda0f6d60276d1ef18033fc33 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 2 Sep 2012 01:26:05 +0200 Subject: [PATCH] CTestMenu: add some demos for CComponents Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c0d4c204b2cc149a23c103ebcf9f809cc5260115 Author: Thilo Graf Date: 2012-09-02 (Sun, 02 Sep 2012) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/test_menu.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++ src/gui/test_menu.h | 7 ++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b3e0c2975..0289d6776 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -54,6 +54,7 @@ #include #include + extern int cs_test_card(int unit, char * str); #ifdef TEST_MENU @@ -61,10 +62,18 @@ CTestMenu::CTestMenu() { width = w_max (50, 10); selected = -1; + circle = NULL; + sq = NULL; + pic= NULL; + pip = NULL; } CTestMenu::~CTestMenu() { + delete sq; + delete circle; + delete pic; + delete pip; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -311,7 +320,46 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) delete scanTs; return res; } + else if (actionKey == "circle"){ + if (circle == NULL) + circle = new CComponentsShapeCircle (100, 100, 100, false); + if (!circle->isPainted()) + circle->paint(); + else + circle->hide(); + return res; + } + else if (actionKey == "square"){ + if (sq == NULL) + sq = new CComponentsShapeSquare (100, 220, 100, 100, false); + + if (!sq->isPainted()) + sq->paint(); + else + sq->hide(); + return res; + } + else if (actionKey == "picture"){ + if (pic == NULL) + pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg"); + + if (!pic->isPainted() && !pic->isPicPainted()) + pic->paint(); + else + pic->hide(); + return res; + } + else if (actionKey == "pip"){ + if (pip == NULL) + pip = new CComponentsPIP (100, 100, 25); + + if (!pip->isPainted()) + pip->paint(); + else + pip->hide(); + return res; + } showTestMenu(); @@ -337,11 +385,25 @@ void CTestMenu::showTestMenu() //buttons w_test.addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons")); + //components + CMenuWidget * w_cc = new CMenuWidget("OSD-Components Demo", NEUTRINO_ICON_INFO, width); + w_test.addItem(new CMenuForwarderNonLocalized(w_cc->getName().c_str(), true, NULL, w_cc)); + showCCTests(w_cc); + //exit w_test.exec(NULL, ""); selected = w_test.getSelected(); } +void CTestMenu::showCCTests(CMenuWidget *widget) +{ + widget->setSelected(selected); + widget->addIntroItems(); + widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); + widget->addItem(new CMenuForwarderNonLocalized("Square", true, NULL, this, "square")); + widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); + widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); +} void CTestMenu::showHWTests(CMenuWidget *widget) { diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index db68e3c3e..fc2c651de 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -31,7 +31,7 @@ #include #include - +#include // #define TEST_MENU #include @@ -39,10 +39,15 @@ class CTestMenu : public CMenuTarget { private: + CComponentsShapeCircle * circle; + CComponentsShapeSquare* sq; + CComponentsPicture* pic; + CComponentsPIP* pip; int width, selected; void showTestMenu(); void showHWTests(CMenuWidget *widget); + void showCCTests(CMenuWidget *widget); public: CTestMenu();