move some actionkey-stuff from ni-menu directly to neutrino.cpp

Origin commit data
------------------
Branch: ni/coolstream
Commit: 16b57e40a8
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-09-12 (Tue, 12 Sep 2017)

Origin message was:
------------------
- move some actionkey-stuff from ni-menu directly to neutrino.cpp

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-09-12 22:30:35 +02:00
parent 922ed30bb7
commit 390b4406d0
4 changed files with 45 additions and 57 deletions

View File

@@ -79,66 +79,14 @@ CNIMenu::~CNIMenu()
{
}
CNIMenu* CNIMenu::getInstance()
{
static CNIMenu* NIMenu = NULL;
if (!NIMenu)
NIMenu = new CNIMenu();
return NIMenu;
}
int CNIMenu::exec(CMenuTarget* parent, const std::string &actionkey)
{
printf("CNIMenu::exec: actionkey %s\n", actionkey.c_str());
int res = menu_return::RETURN_REPAINT;
char *buffer;
ssize_t read;
size_t len;
FILE *fh;
if (parent)
parent->hide();
if (actionkey == "camd_reset")
{
CHintBox hintbox(LOCALE_CAMD_CONTROL, g_Locale->getText(LOCALE_CAMD_MSG_RESET));
hintbox.paint();
printf("[ni_menu.cpp] executing \"service emu restart\"\n");
if (my_system(3, "service", "emu", "restart") != 0)
printf("[ni_menu.cpp] executing failed\n");
sleep(1);
hintbox.hide();
return menu_return::RETURN_EXIT_ALL;
}
else if(actionkey == "ecmInfo")
{
buffer=NULL;
CFileHelpers fhlp;
if (fhlp.copyFile("/tmp/ecm.info", "/tmp/ecm.info.tmp", 0644))
{
if ((fh = fopen("/tmp/ecm.info.tmp", "r")))
{
std::string str = "";
while ((read = getline(&buffer, &len, fh)) != -1)
{
str += buffer;
}
fclose(fh);
remove("/tmp/ecm.info.tmp");
if(buffer)
free(buffer);
ShowHint(LOCALE_ECMINFO, str.c_str(), 450, 20);
}
}
else
ShowHint(LOCALE_ECMINFO, LOCALE_ECMINFO_NULL, 450, 20);
return menu_return::RETURN_EXIT_ALL;
}
res = show();
return res;

View File

@@ -39,7 +39,6 @@ class CNIMenu : public CMenuTarget, CChangeObserver
public:
CNIMenu();
~CNIMenu();
static CNIMenu* getInstance();
int exec(CMenuTarget* parent, const std::string &actionkey);
#if 0
virtual bool changeNotify(const neutrino_locale_t OptionName, void * /*data*/);

View File

@@ -95,7 +95,6 @@ extern CCAMMenuHandler * g_CamHandler;
#include <system/debug.h>
//NI
#include <gui/ni_menu.h>
#include <gui/infoicons_setup.h>
#include <gui/infoicons.h>
@@ -167,7 +166,6 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
// define classes
CSubChannelSelectMenu subchanselect;
CNeutrinoApp * neutrino = CNeutrinoApp::getInstance();
CNIMenu *ni_menu = CNIMenu::getInstance(); //NI
std::string txt = g_settings.usermenu[button]->title;
if (button < COL_BUTTONMAX && txt.empty())
@@ -417,7 +415,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
case SNeutrinoSettings::ITEM_ECMINFO:
{
keyhelper.get(&key,&icon);
menu_item = new CMenuForwarder(LOCALE_ECMINFO_SHOW, file_size("/tmp/ecm.info"), NULL, ni_menu, "ecmInfo", key, icon);
menu_item = new CMenuForwarder(LOCALE_ECMINFO_SHOW, file_size("/tmp/ecm.info"), NULL, neutrino, "ecmInfo", key, icon);
// FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
break;
}
@@ -425,7 +423,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
case SNeutrinoSettings::ITEM_CAMD_RESET:
{
keyhelper.get(&key,&icon);
menu_item = new CMenuForwarder(LOCALE_CAMD_RESET, true, NULL, ni_menu, "camd_reset", key, icon);
menu_item = new CMenuForwarder(LOCALE_CAMD_RESET, true, NULL, neutrino, "camd_reset", key, icon);
// FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
break;
}

View File

@@ -4514,6 +4514,49 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey)
hintBox->hide();
delete hintBox;
}
else if (actionKey == "camd_reset")
{
CHintBox hintbox(LOCALE_CAMD_CONTROL, LOCALE_CAMD_MSG_RESET);
hintbox.paint();
printf("[neutrino.cpp] executing \"service emu restart\"\n");
if (my_system(3, "service", "emu", "restart") != 0)
printf("[neutrino.cpp] executing failed\n");
sleep(1);
hintbox.hide();
return menu_return::RETURN_EXIT_ALL;
}
else if (actionKey == "ecmInfo")
{
char *buffer = NULL;
ssize_t read;
size_t len;
FILE *fh;
CFileHelpers fhlp;
if (fhlp.copyFile("/tmp/ecm.info", "/tmp/ecm.info.tmp", 0644))
{
if ((fh = fopen("/tmp/ecm.info.tmp", "r")))
{
std::string str = "";
while ((read = getline(&buffer, &len, fh)) != -1)
{
str += buffer;
}
fclose(fh);
remove("/tmp/ecm.info.tmp");
if(buffer)
free(buffer);
ShowHint(LOCALE_ECMINFO, str.c_str(), 450, 20);
}
}
else
ShowHint(LOCALE_ECMINFO, LOCALE_ECMINFO_NULL, 450, 20);
return menu_return::RETURN_EXIT_ALL;
}
else if(actionKey=="nkplayback" || actionKey=="ytplayback" || actionKey=="tsmoviebrowser" || actionKey=="fileplayback") {
frameBuffer->Clear();
if(mode == NeutrinoMessages::mode_radio )