From a73b765df1ca25fd98dad302e68f1d48fc75ceae Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 7 Jan 2018 23:55:52 +0100 Subject: [PATCH] test_menu: add CTermWindow() test Conflicts: src/gui/test_menu.cpp --- src/gui/test_menu.cpp | 20 ++++++++++++++++++++ src/gui/test_menu.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 6229825f6..c4459b070 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -116,6 +117,11 @@ CTestMenu::~CTestMenu() //static int test_pos[4] = { 130, 192, 282, 360 }; +void CTestMenu::handleShellOutput(std::string *line, int *, bool *) +{ + fprintf(stderr, "%s: %s\n", __func__, line->c_str()); +} + int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) { dprintf(DEBUG_DEBUG, "init test menu\n"); @@ -975,6 +981,19 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) DisplayInfoMessage("Info Test!"); return menu_return::RETURN_REPAINT; } + else if (actionKey == "shellwindow"){ + sigc::slot3 sl_shell_output; + sl_shell_output = sigc::mem_fun(*this, &CTestMenu::handleShellOutput); + int r = 0; + const char *c = getenv("TEST_COMMAND"); + std::string cmd = "/bin/ps auxwf"; + if (c) + cmd = (std::string)c; + CTermWindow term(cmd, CTermWindow::VERBOSE | CTermWindow::ACKNOWLEDGE, &r, false); + term.OnShellOutputLoop.connect(sl_shell_output); + term.exec(); + return menu_return::RETURN_REPAINT; + } else if (actionKey == "msgbox_alt_btn"){ CMsgBox msgBox("Variable buttontext...", "Msgbox Test"); msgBox.setShowedButtons(CMsgBox::mbNo | CMsgBox::mbYes); @@ -1110,6 +1129,7 @@ int CTestMenu::showTestMenu() CMenuWidget w_test(rev /*"Test menu"*/, NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU); w_test.addIntroItems(); + w_test.addItem(new CMenuForwarder("Shell Window Test", true, NULL, this, "shellwindow")); //hardware CMenuWidget * w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_HARDWARE); w_test.addItem(new CMenuForwarder(w_hw->getName(), true, NULL, w_hw)); diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 84cacac6e..d1d4a98c0 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -62,6 +62,7 @@ class CTestMenu : public CMenuTarget void showCCTests(CMenuWidget *widget); void showMsgTests(CMenuWidget *widget); void showRecords(); + void handleShellOutput(std::string *line, int *, bool *); public: CTestMenu(); ~CTestMenu();