1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-02 18:32:20 +03:00

Added a "show console" link parameter (Dingux build only).

This commit is contained in:
Paul Cercueil 2012-04-13 19:21:49 +02:00
parent 7687212b4e
commit e6ca072c46
3 changed files with 32 additions and 0 deletions

View File

@ -1705,6 +1705,9 @@ void GMenu2X::editLink() {
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Screenshots"], tr["Directory of the screenshots for the selector"], &linkSelScreens));
sd.addSetting(new MenuSettingFile(this, ts, tr["Selector Aliases"], tr["File containing a list of aliases for the selector"], &linkSelAliases));
sd.addSetting(new MenuSettingBool(this, ts, tr["Don't Leave"], tr["Don't quit GMenu2X when launching this link"], &menu->selLinkApp()->runsInBackgroundRef()));
#ifdef PLATFORM_DINGUX
sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &menu->selLinkApp()->consoleApp));
#endif
if (sd.exec() && sd.edited()) {
ledOn();

View File

@ -32,6 +32,7 @@
#include <sys/ioctl.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <fstream>
#include <sstream>
@ -53,6 +54,9 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
icon = iconPath = "";
selectorbrowser = false;
useRamTimings = false;
#ifdef PLATFORM_DINGUX
consoleApp = false;
#endif
string line;
ifstream infile (linkfile, ios_base::in);
@ -78,6 +82,10 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
manual = value;
} else if (name == "dontleave") {
if (value=="true") dontleave = true;
#ifdef PLATFORM_DINGUX
} else if (name == "consoleapp") {
if (value == "true") consoleApp = true;
#endif
} else if (name == "clock") {
setClock( atoi(value.c_str()) );
} else if (name == "selectordir") {
@ -167,6 +175,9 @@ bool LinkApp::save() {
if (selectorscreens!="") f << "selectorscreens=" << selectorscreens << endl;
if (aliasfile!="" ) f << "selectoraliases=" << aliasfile << endl;
if (dontleave ) f << "dontleave=true" << endl;
#ifdef PLATFORM_DINGUX
if (consoleApp ) f << "consoleapp=true" << endl;
#endif
f.close();
sync();
return true;
@ -429,6 +440,20 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
signal(SIGTTOU, SIG_IGN);
tcsetpgrp(STDOUT_FILENO, pgid);
#ifdef PLATFORM_DINGUX
if (consoleApp) {
/* Enable the framebuffer console */
char c = '1';
int fd = open("/sys/devices/virtual/vtconsole/vtcon1/bind", O_WRONLY);
if (fd < 0) {
WARNING("Unable to open fbcon handle\n");
} else {
write(fd, &c, 1);
close(fd);
}
}
#endif
execlp("/bin/sh","/bin/sh", "-c", command.c_str(), NULL);
//if execution continues then something went wrong and as we already called SDL_Quit we cannot continue
//try relaunching gmenu2x

View File

@ -58,6 +58,10 @@ public:
const char* linkfile);
virtual const std::string &searchIcon();
#ifdef PLATFORM_DINGUX
bool consoleApp;
#endif
const std::string &getExec();
void setExec(const std::string &exec);
const std::string &getParams();