1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-25 17:08:26 +02:00

Enable "Display Console" flag for all platforms

Applications with this flag will not have their stdout/stderr
redirected to a log file when logging is enabled. That is a useful
feature also on platforms where we don't micromanage the console.
This commit is contained in:
Maarten ter Huurne 2014-08-08 01:35:51 +02:00
parent 3e34124e68
commit dc23718f7f
3 changed files with 9 additions and 22 deletions

View File

@ -894,9 +894,7 @@ void GMenu2X::editLink() {
#endif #endif
if (!linkApp->isOpk()) { if (!linkApp->isOpk()) {
sd.addSetting(new MenuSettingString(this, ts, tr["Selector Filter"], tr["Selector filter (Separate values with a comma)"], &linkSelFilter, diagTitle, diagIcon)); sd.addSetting(new MenuSettingString(this, ts, tr["Selector Filter"], tr["Selector filter (Separate values with a comma)"], &linkSelFilter, diagTitle, diagIcon));
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &linkApp->consoleApp)); sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &linkApp->consoleApp));
#endif
} }
if (sd.exec() && sd.edited()) { if (sd.exec() && sd.edited()) {

View File

@ -43,7 +43,11 @@
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0) // Bind and activate the framebuffer console on selected platforms.
#define BIND_CONSOLE \
defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
#if BIND_CONSOLE
#include <linux/vt.h> #include <linux/vt.h>
#endif #endif
@ -78,9 +82,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
selectorbrowser = true; selectorbrowser = true;
editable = true; editable = true;
edited = false; edited = false;
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
consoleApp = false;
#endif
#ifdef HAVE_LIBOPK #ifdef HAVE_LIBOPK
isOPK = !!opk; isOPK = !!opk;
@ -127,10 +128,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
gmenu2x->tr["Lng"] + "]").c_str(), lkey)) { gmenu2x->tr["Lng"] + "]").c_str(), lkey)) {
description = buf; description = buf;
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
} else if (!strncmp(key, "Terminal", lkey)) { } else if (!strncmp(key, "Terminal", lkey)) {
consoleApp = !strncmp(val, "true", lval); consoleApp = !strncmp(val, "true", lval);
#endif
} else if (!strncmp(key, "X-OD-Manual", lkey)) { } else if (!strncmp(key, "X-OD-Manual", lkey)) {
manual = buf; manual = buf;
@ -225,10 +224,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
params = value; params = value;
} else if (name == "manual") { } else if (name == "manual") {
manual = value; manual = value;
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
} else if (name == "consoleapp") { } else if (name == "consoleapp") {
if (value == "true") consoleApp = true; if (value == "true") consoleApp = true;
#endif
} else if (name == "selectorfilter") { } else if (name == "selectorfilter") {
setSelectorFilter( value ); setSelectorFilter( value );
} else if (name == "editable") { } else if (name == "editable") {
@ -320,9 +317,7 @@ bool LinkApp::save() {
if (!exec.empty() ) f << "exec=" << exec << endl; if (!exec.empty() ) f << "exec=" << exec << endl;
if (!params.empty() ) f << "params=" << params << endl; if (!params.empty() ) f << "params=" << params << endl;
if (!manual.empty() ) f << "manual=" << manual << endl; if (!manual.empty() ) f << "manual=" << manual << endl;
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
if (consoleApp ) f << "consoleapp=true" << endl; if (consoleApp ) f << "consoleapp=true" << endl;
#endif
if (selectorfilter != "*") f << "selectorfilter=" << selectorfilter << endl; if (selectorfilter != "*") f << "selectorfilter=" << selectorfilter << endl;
} }
if (iclock != 0 ) f << "clock=" << iclock << endl; if (iclock != 0 ) f << "clock=" << iclock << endl;
@ -559,11 +554,7 @@ void LinkApp::launch(const string &selectedFile) {
} }
} }
if (gmenu2x->confInt["outputLogs"] if (gmenu2x->confInt["outputLogs"] && !consoleApp) {
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
&& !consoleApp
#endif
) {
int fd = open(LOG_FILE, O_WRONLY | O_TRUNC | O_CREAT, 0644); int fd = open(LOG_FILE, O_WRONLY | O_TRUNC | O_CREAT, 0644);
if (fd < 0) { if (fd < 0) {
ERROR("Unable to open log file for write: %s\n", LOG_FILE); ERROR("Unable to open log file for write: %s\n", LOG_FILE);
@ -587,8 +578,8 @@ void LinkApp::launch(const string &selectedFile) {
#endif #endif
gmenu2x->quit(); gmenu2x->quit();
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
if (consoleApp) { if (consoleApp) {
#if BIND_CONSOLE
/* Enable the framebuffer console */ /* Enable the framebuffer console */
char c = '1'; char c = '1';
int fd = open("/sys/devices/virtual/vtconsole/vtcon1/bind", O_WRONLY); int fd = open("/sys/devices/virtual/vtconsole/vtcon1/bind", O_WRONLY);
@ -607,8 +598,8 @@ void LinkApp::launch(const string &selectedFile) {
WARNING("Unable to activate tty1\n"); WARNING("Unable to activate tty1\n");
close(fd); close(fd);
} }
}
#endif #endif
}
vector<string> commandLine; vector<string> commandLine;
if (isOpk()) { if (isOpk()) {

View File

@ -67,9 +67,7 @@ public:
virtual void loadIcon(); virtual void loadIcon();
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0) bool consoleApp = false;
bool consoleApp;
#endif
const std::string &getExec(); const std::string &getExec();
void setExec(const std::string &exec); void setExec(const std::string &exec);