From 39a8a99c82f4d1f95ce1fab7dc4bddbf7bc163b0 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 26 May 2010 01:01:25 +0300 Subject: [PATCH] Allow loading Lua plugin without GUI This is useful for doing subtitle insertion from script. --- Changelog.utf8 | 1 + org/jpc/plugins/LuaPlugin.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Changelog.utf8 b/Changelog.utf8 index 23188a1..3691ab4 100644 --- a/Changelog.utf8 +++ b/Changelog.utf8 @@ -4,6 +4,7 @@ Changes since JPC-RR Release 10.8: - Fix some savestate errors. - Add support for author nicknames. - Add ability for Lua to query movie length, rerecord count and headers. +- Allow loading Lua plugin without GUI. Changes from JPC-RR Release 10.7 to JPC-RR Release 10.8: ======================================================== diff --git a/org/jpc/plugins/LuaPlugin.java b/org/jpc/plugins/LuaPlugin.java index 01f6017..0224cb5 100644 --- a/org/jpc/plugins/LuaPlugin.java +++ b/org/jpc/plugins/LuaPlugin.java @@ -84,6 +84,7 @@ public class LuaPlugin implements ActionListener, Plugin private volatile boolean reconnectInProgress; private boolean consoleMode; + private boolean specialNoGUIMode; private Map resources; private IdentityHashMap liveObjects; @@ -458,7 +459,7 @@ public class LuaPlugin implements ActionListener, Plugin { final String _msg = msg; - if(consoleMode) { + if(consoleMode || specialNoGUIMode) { System.out.print(msg); return; } @@ -552,7 +553,7 @@ public class LuaPlugin implements ActionListener, Plugin private void setLuaButtons() { - if(consoleMode) + if(consoleMode || specialNoGUIMode) return; if(!SwingUtilities.isEventDispatchThread()) @@ -571,7 +572,7 @@ public class LuaPlugin implements ActionListener, Plugin private void clearConsole() { - if(consoleMode) + if(consoleMode || specialNoGUIMode) return; if(!SwingUtilities.isEventDispatchThread()) @@ -799,6 +800,9 @@ public class LuaPlugin implements ActionListener, Plugin if(kernelName == null) throw new IOException("Kernel name (kernel) required for LuaPlugin"); + if(kernelArguments.get("noguimode") != null) + this.specialNoGUIMode = true; + this.pcRunning = false; this.luaThread = null; this.luaInvokeReq = null; @@ -818,6 +822,9 @@ public class LuaPlugin implements ActionListener, Plugin this.consoleMode = false; this.vPluginManager = manager; + if(specialNoGUIMode) + return; + window = new JFrame("Lua window"); GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); -- 2.11.4.GIT