This commit is contained in:
@@ -53,7 +53,7 @@ public class GUI extends JFrame {
|
|||||||
JPanel applicationPanel = createManagerPanel(applicationManager, APPLICATION_TITLE);
|
JPanel applicationPanel = createManagerPanel(applicationManager, APPLICATION_TITLE);
|
||||||
controlPanel.add(applicationPanel);
|
controlPanel.add(applicationPanel);
|
||||||
}
|
}
|
||||||
if (applicationManager.count() > 0) {
|
if (deviceManager.count() > 0) {
|
||||||
JPanel devicePanel = createManagerPanel(deviceManager, DEVICE_TITLE);
|
JPanel devicePanel = createManagerPanel(deviceManager, DEVICE_TITLE);
|
||||||
controlPanel.add(devicePanel);
|
controlPanel.add(devicePanel);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,6 @@ public class GUI extends JFrame {
|
|||||||
protected void processWindowEvent(WindowEvent event) {
|
protected void processWindowEvent(WindowEvent event) {
|
||||||
if (event.getID() == WindowEvent.WINDOW_CLOSING) {
|
if (event.getID() == WindowEvent.WINDOW_CLOSING) {
|
||||||
log.debug("Window closing");
|
log.debug("Window closing");
|
||||||
stop();
|
|
||||||
try {
|
try {
|
||||||
mimis.stop();
|
mimis.stop();
|
||||||
} catch (DeactivateException e) {
|
} catch (DeactivateException e) {
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ public abstract class Worker implements Runnable {
|
|||||||
protected static final boolean THREAD = true;
|
protected static final boolean THREAD = true;
|
||||||
protected static final int SLEEP = 100;
|
protected static final int SLEEP = 100;
|
||||||
|
|
||||||
protected boolean running = false;
|
protected boolean run = false;
|
||||||
protected boolean active = false;
|
protected boolean active = false;
|
||||||
|
|
||||||
public void start(boolean thread) {
|
public void start(boolean thread) {
|
||||||
running = true;
|
run = true;
|
||||||
if (thread) {
|
if (thread) {
|
||||||
log.debug("Start thread");
|
log.debug("Start thread");
|
||||||
new Thread(this, getClass().getName()).start();
|
new Thread(this, getClass().getName()).start();
|
||||||
@@ -32,9 +32,11 @@ public abstract class Worker implements Runnable {
|
|||||||
|
|
||||||
public void stop() throws DeactivateException {
|
public void stop() throws DeactivateException {
|
||||||
if (active()) {
|
if (active()) {
|
||||||
|
log.debug("stop deact");
|
||||||
deactivate();
|
deactivate();
|
||||||
|
log.debug("stop na deact");
|
||||||
}
|
}
|
||||||
running = false;
|
run = false;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
@@ -64,7 +66,7 @@ public abstract class Worker implements Runnable {
|
|||||||
|
|
||||||
public void activate(boolean thread) {
|
public void activate(boolean thread) {
|
||||||
active = true;
|
active = true;
|
||||||
if (!running) {
|
if (!run) {
|
||||||
start(thread);
|
start(thread);
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
@@ -80,7 +82,7 @@ public abstract class Worker implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void run() {
|
public final void run() {
|
||||||
while (running) {
|
while (run) {
|
||||||
if (active()) {
|
if (active()) {
|
||||||
work();
|
work();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import mimis.util.VBScript;
|
|||||||
|
|
||||||
|
|
||||||
public abstract class CMDApplication extends Application {
|
public abstract class CMDApplication extends Application {
|
||||||
protected final static String REGISTRY = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths";
|
protected final static String REGISTRY = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths";
|
||||||
|
|
||||||
protected String program;
|
protected String program;
|
||||||
protected String title;
|
protected String title;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import mimis.value.Action;
|
|||||||
import mimis.value.Amount;
|
import mimis.value.Amount;
|
||||||
|
|
||||||
public class VLCApplication extends CMDApplication {
|
public class VLCApplication extends CMDApplication {
|
||||||
protected final static String REGISTRY = "HKEY_CLASSES_ROOT\\Applications\\vlc.exe\\shell\\Open\\command";
|
protected final static String REGISTRY = "HKCR\\Applications\\vlc.exe\\shell\\Open\\command";
|
||||||
protected final static String PROGRAM = "vlc.exe";
|
protected final static String PROGRAM = "vlc.exe";
|
||||||
protected final static String TITLE = "VLC media player";
|
protected final static String TITLE = "VLC media player";
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
multiplexer.start();
|
|
||||||
lircService.activate();
|
lircService.activate();
|
||||||
add(eventMapCycle.denonRC176);
|
add(eventMapCycle.denonRC176);
|
||||||
add(eventMapCycle.philiphsRCLE011);
|
add(eventMapCycle.philiphsRCLE011);
|
||||||
@@ -52,7 +51,11 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
|
|||||||
public boolean active() {
|
public boolean active() {
|
||||||
log.trace("LircDevice active?");
|
log.trace("LircDevice active?");
|
||||||
if (active && !lircService.active()) {
|
if (active && !lircService.active()) {
|
||||||
active = false;
|
try {
|
||||||
|
deactivate();
|
||||||
|
} catch (DeactivateException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
} else if (!active) {
|
} else if (!active) {
|
||||||
try {
|
try {
|
||||||
if (VBScript.isRunning(PROGRAM)) {
|
if (VBScript.isRunning(PROGRAM)) {
|
||||||
@@ -72,8 +75,9 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
|
|||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
log.debug("Deactivate LircDevice");
|
log.debug("Deactivate LircDevice");
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
multiplexer.stop();
|
log.debug("nu lircserv");
|
||||||
lircService.deactivate();
|
lircService.deactivate();
|
||||||
|
log.debug("nu erna");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(LircButton lircButton) {
|
public void add(LircButton lircButton) {
|
||||||
@@ -92,8 +96,9 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stop() throws DeactivateException {
|
public void stop() throws DeactivateException {
|
||||||
multiplexer.stop();
|
log.debug("Stop LircDevice");
|
||||||
lircService.stop();
|
|
||||||
super.stop();
|
super.stop();
|
||||||
|
lircService.stop();
|
||||||
|
multiplexer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class LircService extends Worker {
|
|||||||
|
|
||||||
public LircService(HashMap<String, LircButton[]> buttonMap) {
|
public LircService(HashMap<String, LircButton[]> buttonMap) {
|
||||||
this(buttonMap, IP, PORT);
|
this(buttonMap, IP, PORT);
|
||||||
send = Native.getValue("HKEY_CURRENT_USER\\Software\\LIRC", "password");
|
send = Native.getValue("HKCU\\Software\\LIRC", "password");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LircService(HashMap<String, LircButton[]> buttonMap, String ip, int port) {
|
public LircService(HashMap<String, LircButton[]> buttonMap, String ip, int port) {
|
||||||
@@ -56,6 +56,7 @@ public class LircService extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
|
log.debug("Activate LircService");
|
||||||
try {
|
try {
|
||||||
socket = new Socket(ip, port);
|
socket = new Socket(ip, port);
|
||||||
|
|
||||||
@@ -75,16 +76,18 @@ public class LircService extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean active() {
|
public boolean active() {
|
||||||
|
log.trace("LircService active?");
|
||||||
if (active && !socket.isConnected()) {
|
if (active && !socket.isConnected()) {
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
|
log.trace(active);
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
|
log.debug("Deactivate LircService");
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
try {
|
try {
|
||||||
bufferedReader.close();
|
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
socket.close();
|
socket.close();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public abstract class EventListener extends Worker {
|
|||||||
try {
|
try {
|
||||||
work.wait();
|
work.wait();
|
||||||
} catch (InterruptedException e) {}
|
} catch (InterruptedException e) {}
|
||||||
if (!running) {
|
if (!run) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,4 @@ feedback?
|
|||||||
|
|
||||||
mogelijkheid tot webstart onderzoeken
|
mogelijkheid tot webstart onderzoeken
|
||||||
|
|
||||||
|
|
||||||
IN PROGRESS
|
|
||||||
-------------
|
|
||||||
|
|
||||||
exporteren naar uitvoerbare jar file
|
exporteren naar uitvoerbare jar file
|
||||||
|
|
||||||
favicon maken?
|
|
||||||
@@ -47,6 +47,7 @@ public class Multiplexer extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void work() {
|
protected void work() {
|
||||||
|
log.debug("Multiplexer work");
|
||||||
try {
|
try {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
wait(TIMEOUT);
|
wait(TIMEOUT);
|
||||||
|
|||||||
Reference in New Issue
Block a user