Minor fixes
This commit is contained in:
parent
a03404381c
commit
d7a47ce9f4
8 changed files with 33 additions and 19 deletions
|
@ -51,3 +51,8 @@ Want to support development? Make a donation* (see below):
|
|||
|
||||
* [EN] Please note! This is non-commercial application. Any received money considered as a gift.
|
||||
* [RU] Пожалуйста обратите внимание! Это некоммерческое приложение. Перечисляя средства вы совершаете дарение.
|
||||
|
||||
#### TODO
|
||||
[ ] Tray support
|
||||
[ ] Headless mode (CLI)
|
||||
[ ] Dark theme
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>loper</groupId>
|
||||
<artifactId>LogiLed</artifactId>
|
||||
<version>0.2-SNAPSHOT</version>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
|
||||
<!-- <url></url> -->
|
||||
<description>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package logiled.Controllers;
|
||||
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
@ -52,20 +53,25 @@ public class MainController implements Initializable {
|
|||
HashMap<String, List<byte[][]>> rules = KeysLedsController.getRules();
|
||||
if (rules == null)
|
||||
return;
|
||||
applyBtn.setDisable(true);
|
||||
KeyLedThread keyLedThread = new KeyLedThread(rules);
|
||||
keyLedThread.setOnSucceeded(EventHandler -> applyBtn.setDisable(false)); // <- I guess this shit never fails
|
||||
Thread commThread = new Thread(keyLedThread);
|
||||
commThread.setDaemon(true);
|
||||
commThread.start();
|
||||
}
|
||||
else if (MainTabPane.getSelectionModel().getSelectedItem().getId().equals("EffectsTab")) {
|
||||
applyBtn.setDisable(true);
|
||||
EffectsThread effectsThread = new EffectsThread(EffectsController.getEffect());
|
||||
effectsThread.setOnSucceeded(EventHandler -> applyBtn.setDisable(false));
|
||||
Thread commThread = new Thread(effectsThread);
|
||||
commThread.setDaemon(true);
|
||||
commThread.start();
|
||||
}
|
||||
else { // Consider as GameMode; refactor in case more tabs added.
|
||||
List<Byte> disKeysList = GameModeController.getKeys();
|
||||
GameModeThread gameModeThread = new GameModeThread(disKeysList);
|
||||
applyBtn.setDisable(true);
|
||||
GameModeThread gameModeThread = new GameModeThread(GameModeController.getKeys());
|
||||
gameModeThread.setOnSucceeded(EventHandler -> applyBtn.setDisable(false));
|
||||
Thread commThread = new Thread(gameModeThread);
|
||||
commThread.setDaemon(true);
|
||||
commThread.start();
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Locale;
|
|||
import java.util.ResourceBundle;
|
||||
|
||||
public class MainFx extends Application {
|
||||
public static final String appVersion = "v0.2";
|
||||
public static final String appVersion = "v0.3";
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
|
|
|
@ -5,7 +5,7 @@ import logiled.MessagesConsumer;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class EffectsThread extends LoThread implements Runnable{
|
||||
public class EffectsThread extends LoThread {
|
||||
|
||||
private byte[] command;
|
||||
|
||||
|
@ -49,16 +49,15 @@ public class EffectsThread extends LoThread implements Runnable{
|
|||
command = effectWaveEdgeToCenter(effectData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
protected Void call() throws Exception {
|
||||
if (command == null)
|
||||
return;
|
||||
return null;
|
||||
|
||||
UsbConnect usbConnect = new UsbConnect();
|
||||
|
||||
if (!usbConnect.isConnected())
|
||||
return;
|
||||
return null;
|
||||
|
||||
handler = usbConnect.getHandlerKbrd();
|
||||
|
||||
|
@ -66,6 +65,7 @@ public class EffectsThread extends LoThread implements Runnable{
|
|||
MessagesConsumer.getInstance().inform("Complete!");
|
||||
|
||||
usbConnect.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
private byte[] effectDisable(){
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class GameModeThread extends LoThread implements Runnable{
|
||||
public class GameModeThread extends LoThread{
|
||||
|
||||
private static final byte[] game_key_prepare = {
|
||||
0x11, (byte) 0xff, 0x03, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -48,11 +48,11 @@ public class GameModeThread extends LoThread implements Runnable{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
protected Void call() throws Exception {
|
||||
UsbConnect usbConnect = new UsbConnect();
|
||||
|
||||
if (!usbConnect.isConnected())
|
||||
return;
|
||||
return null;
|
||||
|
||||
handler = usbConnect.getHandlerKbrd();
|
||||
|
||||
|
@ -68,5 +68,6 @@ public class GameModeThread extends LoThread implements Runnable{
|
|||
MessagesConsumer.getInstance().inform("Complete!");
|
||||
|
||||
usbConnect.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package logiled.USB;
|
||||
|
||||
import javafx.concurrent.Task;
|
||||
import logiled.MessagesConsumer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -7,7 +8,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class KeyLedThread extends LoThread implements Runnable{
|
||||
public class KeyLedThread extends LoThread {
|
||||
// Keys and indicators individual settings
|
||||
private static final byte[] commit = {
|
||||
0x11, (byte) 0xff, 0x0c, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -77,15 +78,15 @@ public class KeyLedThread extends LoThread implements Runnable{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
protected Void call() throws Exception {
|
||||
// If no commands in the query, then nothing to do
|
||||
if (keyLedCommands.size() == 0)
|
||||
return;
|
||||
return null;
|
||||
|
||||
UsbConnect usbConnect = new UsbConnect();
|
||||
|
||||
if (!usbConnect.isConnected())
|
||||
return;
|
||||
return null;
|
||||
|
||||
handler = usbConnect.getHandlerKbrd();
|
||||
|
||||
|
@ -101,6 +102,6 @@ public class KeyLedThread extends LoThread implements Runnable{
|
|||
MessagesConsumer.getInstance().inform("Complete!");
|
||||
|
||||
usbConnect.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package logiled.USB;
|
||||
|
||||
import javafx.concurrent.Task;
|
||||
import logiled.MessagesConsumer;
|
||||
import org.usb4java.DeviceHandle;
|
||||
import org.usb4java.LibUsb;
|
||||
|
@ -7,7 +8,7 @@ import org.usb4java.LibUsb;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
abstract class LoThread {
|
||||
abstract class LoThread extends Task<Void> {
|
||||
|
||||
DeviceHandle handler;
|
||||
|
||||
|
|
Loading…
Reference in a new issue