Added new improvements

This commit is contained in:
Robert Vokac 2024-03-03 11:23:14 +00:00
parent bba77ef67d
commit ac3962fe8b
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
8 changed files with 35 additions and 20 deletions

View File

@ -130,7 +130,7 @@ Smileys can be colored or white-black (can be set in configuration)
* SPACE - switch visibility mode: NONE, GREY, WEAKLY_COLOURED, STRONGLY_COLOURED
* F2 - run commands
* R - restart app
* T - enable or disable notifications
* N - enable or disable notifications
* W - open work days window
* A - open activity window
* S - open config window
@ -139,6 +139,8 @@ Smileys can be colored or white-black (can be set in configuration)
* J - show random Joke
* U - enable everything
* I - disable almost everything
* E - enable or disable battery waves
* B - hide or show buttons
## Command button

View File

@ -75,8 +75,7 @@ public class CommandActionListener
t.showToaster(commands.substring(6));
break;
case "toasts":
Utils.toastsAreEnabled
.setValue(commandsAsArray[1].equals("1"));
timeCalcConfiguration.notificationsVisibleProperty.setValue(commandsAsArray[1].equals("1"));
break;
default:
JOptionPane.showMessageDialog(null,

View File

@ -115,8 +115,8 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
if (e.getKeyCode() == KeyEvent.VK_R) {
window.doRestart();
}
if (e.getKeyCode() == KeyEvent.VK_T) {
Utils.toastsAreEnabled.flip();
if (e.getKeyCode() == KeyEvent.VK_N) {
timeCalcConfiguration.notificationsVisibleProperty.flip();
}
if (e.getKeyCode() == KeyEvent.VK_W) {
window.openWorkDaysWindow();
@ -148,7 +148,13 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
}
if (e.getKeyCode() == KeyEvent.VK_I) {
window.doDisableAlmostEverything();
}
if (e.getKeyCode() == KeyEvent.VK_E) {
timeCalcConfiguration.batteryWavesVisibleProperty.flip();
}
if (e.getKeyCode() == KeyEvent.VK_B) {
MainWindow.hideShowCheckBox.setSelected(!MainWindow.hideShowCheckBox.isSelected());
}
window.repaint();

View File

@ -1,7 +1,11 @@
package org.nanoboot.utils.timecalc.swing.common;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import static org.nanoboot.utils.timecalc.swing.common.Widget.CLOSE_BUTTON_SIDE;
/**
* @author Robert Vokac
@ -9,6 +13,16 @@ import java.awt.Font;
*/
public class SwingUtils {
public static void paintCloseIcon(Graphics brush, int width) {
brush.setColor(SwingUtils.CLOSE_BUTTON_BACKGROUND_COLOR);
brush.fillOval(width- CLOSE_BUTTON_SIDE - 1, 0 + 1, CLOSE_BUTTON_SIDE, CLOSE_BUTTON_SIDE);
brush.setColor(Color.LIGHT_GRAY);
Graphics2D brush2d = (Graphics2D) brush;
brush2d.setStroke(new BasicStroke(2f));
brush.drawLine(width - CLOSE_BUTTON_SIDE - 1 + 2, 0 + 1 + 2, width - 0 * CLOSE_BUTTON_SIDE - 1 - 2, 0 + CLOSE_BUTTON_SIDE + 1 - 2);
brush.drawLine(width - CLOSE_BUTTON_SIDE - 1 + 2, 0 + CLOSE_BUTTON_SIDE + 1 - 2, width - 0 * CLOSE_BUTTON_SIDE - 1 - 2, 0 + 1 + 2);
}
private SwingUtils() {
//Not meant to be instantiated.
}

View File

@ -110,10 +110,10 @@ public class Toaster {
* Show a toaster with the specified message and the associated icon.
*/
public void showToaster(Icon icon, String msg) {
if (!Utils.toastsAreEnabled.getValue()) {
//nothing to do
return;
}
// if (!Utils.toastsAreEnabled.getValue()) {
// //nothing to do
// return;
// }
SingleToaster singleToaster = new SingleToaster();
if (icon != null) {
singleToaster.iconLabel.setIcon(icon);

View File

@ -164,13 +164,7 @@ public class Widget extends JPanel implements
paintWidget(brush);
if (mouseOver && mouseOverCloseButton) {
brush.setColor(SwingUtils.CLOSE_BUTTON_BACKGROUND_COLOR);
brush.fillOval(getWidth() - CLOSE_BUTTON_SIDE - 1, 0 + 1, CLOSE_BUTTON_SIDE, CLOSE_BUTTON_SIDE);
brush.setColor(Color.LIGHT_GRAY);
Graphics2D brush2d = (Graphics2D) brush;
brush2d.setStroke(new BasicStroke(2f));
brush.drawLine(getWidth() - CLOSE_BUTTON_SIDE - 1 + 2, 0 + 1 + 2, getWidth() - 0 * CLOSE_BUTTON_SIDE - 1 - 2, 0 + CLOSE_BUTTON_SIDE + 1 - 2);
brush.drawLine(getWidth() - CLOSE_BUTTON_SIDE - 1 + 2, 0 + CLOSE_BUTTON_SIDE + 1 - 2, getWidth() - 0 * CLOSE_BUTTON_SIDE - 1 - 2, 0 + 1 + 2);
SwingUtils.paintCloseIcon(brush, getWidth());
}
}

View File

@ -25,8 +25,6 @@ import java.util.jar.Manifest;
*/
public class Utils {
public static final BooleanProperty toastsAreEnabled
= new BooleanProperty("toastsAreEnabled", true);
public static final Color ULTRA_LIGHT_GRAY = new Color(216, 216, 216);
/**
* Count of bytes per one kilobyte.

View File

@ -130,7 +130,7 @@ Smileys can be colored or white-black (can be set in configuration)
* SPACE - switch visibility mode: NONE, GREY, WEAKLY_COLOURED, STRONGLY_COLOURED
* F2 - run commands
* R - restart app
* T - enable or disable notifications
* N - enable or disable notifications
* W - open work days window
* A - open activity window
* S - open config window
@ -139,6 +139,8 @@ Smileys can be colored or white-black (can be set in configuration)
* J - show random Joke
* U - enable everything
* I - disable almost everything
* E - enable or disable battery waves
* B - hide or show buttons
## Command button