mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added several improvements
This commit is contained in:
parent
b9c5e317b0
commit
5a9e7fbf86
@ -139,7 +139,7 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
## Key shortcuts
|
## Key shortcuts
|
||||||
|
|
||||||
* UP - Show widgets again, if they were hidden
|
* UP - Show widgets again, if they were hidden
|
||||||
* DOWN - Hide all widgets and buttons
|
* DOWN or PERIOD - Hide all widgets and buttons
|
||||||
* H - Show all hide everything
|
* H - Show all hide everything
|
||||||
* G - switch between coloured and no-coloured visibility mode
|
* G - switch between coloured and no-coloured visibility mode
|
||||||
* C - switch between strongly coloured and weakly coloured visibility mode
|
* C - switch between strongly coloured and weakly coloured visibility mode
|
||||||
@ -160,6 +160,10 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
* B - hide or show buttons
|
* B - hide or show buttons
|
||||||
* 0,1,2,3,4,5,6,7,8 or 9 - activates a profile
|
* 0,1,2,3,4,5,6,7,8 or 9 - activates a profile
|
||||||
* F - show numbers for profiles
|
* F - show numbers for profiles
|
||||||
|
* Q - hide or show progress square
|
||||||
|
* L - hide or show progress circle
|
||||||
|
* M - hide or show walking human
|
||||||
|
* Y - hide or show smileys
|
||||||
|
|
||||||
## Command button
|
## Command button
|
||||||
|
|
||||||
|
@ -2,15 +2,12 @@ package org.nanoboot.utils.timecalc.app;
|
|||||||
|
|
||||||
import org.nanoboot.utils.timecalc.entity.Visibility;
|
import org.nanoboot.utils.timecalc.entity.Visibility;
|
||||||
import org.nanoboot.utils.timecalc.swing.common.MainWindow;
|
import org.nanoboot.utils.timecalc.swing.common.MainWindow;
|
||||||
import org.nanoboot.utils.timecalc.swing.common.Toaster;
|
|
||||||
import org.nanoboot.utils.timecalc.utils.common.FileConstants;
|
import org.nanoboot.utils.timecalc.utils.common.FileConstants;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -41,142 +38,201 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
.isDisabled();
|
.isDisabled();
|
||||||
Visibility visibility = Visibility
|
Visibility visibility = Visibility
|
||||||
.valueOf(timeCalcApp.visibilityProperty.getValue());
|
.valueOf(timeCalcApp.visibilityProperty.getValue());
|
||||||
if (e.getKeyCode() == KeyEvent.VK_UP) {
|
|
||||||
timeCalcApp.visibilityProperty
|
int keyCode = e.getKeyCode();
|
||||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
|
||||||
: Visibility.STRONGLY_COLORED.name());
|
boolean numberKeyWasPressed = keyCode == KeyEvent.VK_0 ||
|
||||||
}
|
keyCode == KeyEvent.VK_1 ||
|
||||||
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
keyCode == KeyEvent.VK_2 ||
|
||||||
timeCalcApp.visibilityProperty
|
keyCode == KeyEvent.VK_3 ||
|
||||||
.setValue(Visibility.NONE.name());
|
keyCode == KeyEvent.VK_4 ||
|
||||||
|
keyCode == KeyEvent.VK_5 ||
|
||||||
|
keyCode == KeyEvent.VK_6 ||
|
||||||
|
keyCode == KeyEvent.VK_7 ||
|
||||||
|
keyCode == KeyEvent.VK_8 ||
|
||||||
|
keyCode == KeyEvent.VK_9;
|
||||||
|
|
||||||
|
|
||||||
|
if(numberKeyWasPressed && !FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {
|
||||||
|
Utils.showNotification("Warning: There is no profile assigned to Key with number, you pressed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_H) {
|
switch (keyCode) {
|
||||||
if (visibility.isNone()) {
|
|
||||||
|
case KeyEvent.VK_UP: {
|
||||||
timeCalcApp.visibilityProperty
|
timeCalcApp.visibilityProperty
|
||||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
||||||
: Visibility.STRONGLY_COLORED.name());
|
: Visibility.STRONGLY_COLORED.name());
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case KeyEvent.VK_DOWN:
|
||||||
|
case KeyEvent.VK_PERIOD: {
|
||||||
timeCalcApp.visibilityProperty
|
timeCalcApp.visibilityProperty
|
||||||
.setValue(Visibility.NONE.name());
|
.setValue(Visibility.NONE.name());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_G) {
|
case KeyEvent.VK_H: {
|
||||||
if (visibility.isGray() && !onlyGreyOrNone) {
|
if (visibility.isNone()) {
|
||||||
timeCalcApp.visibilityProperty
|
timeCalcApp.visibilityProperty
|
||||||
.setValue(Visibility.WEAKLY_COLORED.name());
|
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
||||||
} else {
|
: Visibility.STRONGLY_COLORED.name());
|
||||||
timeCalcApp.visibilityProperty
|
} else {
|
||||||
.setValue(Visibility.GRAY.name());
|
timeCalcApp.visibilityProperty
|
||||||
MainWindow.hideShowCheckBox.setSelected(false);
|
.setValue(Visibility.NONE.name());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
case KeyEvent.VK_G: {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_C) {
|
if (visibility.isGray() && !onlyGreyOrNone) {
|
||||||
if (!onlyGreyOrNone) {
|
|
||||||
if (visibility.isStronglyColored()) {
|
|
||||||
timeCalcApp.visibilityProperty
|
timeCalcApp.visibilityProperty
|
||||||
.setValue(Visibility.WEAKLY_COLORED.name());
|
.setValue(Visibility.WEAKLY_COLORED.name());
|
||||||
} else {
|
} else {
|
||||||
timeCalcApp.visibilityProperty
|
timeCalcApp.visibilityProperty
|
||||||
.setValue(
|
.setValue(Visibility.GRAY.name());
|
||||||
Visibility.STRONGLY_COLORED.name());
|
MainWindow.hideShowCheckBox.setSelected(false);
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
timeCalcApp.visibilityProperty.setValue(Visibility.GRAY
|
|
||||||
.name());
|
|
||||||
}
|
}
|
||||||
}
|
case KeyEvent.VK_C: {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_V) {
|
if (!onlyGreyOrNone) {
|
||||||
if (visibility.isNone()) {
|
if (visibility.isStronglyColored()) {
|
||||||
timeCalcApp.visibilityProperty
|
timeCalcApp.visibilityProperty
|
||||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
.setValue(Visibility.WEAKLY_COLORED.name());
|
||||||
: Visibility.STRONGLY_COLORED.name());
|
} else {
|
||||||
} else {
|
timeCalcApp.visibilityProperty
|
||||||
timeCalcApp.visibilityProperty
|
.setValue(
|
||||||
.setValue(Visibility.NONE.name());
|
Visibility.STRONGLY_COLORED.name());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
timeCalcApp.visibilityProperty.setValue(Visibility.GRAY
|
||||||
|
.name());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
case KeyEvent.VK_V: {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
if (visibility.isNone()) {
|
||||||
if (visibility.isStronglyColored()) {
|
timeCalcApp.visibilityProperty
|
||||||
timeCalcApp.visibilityProperty
|
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
||||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
: Visibility.STRONGLY_COLORED.name());
|
||||||
: Visibility.WEAKLY_COLORED.name());
|
} else {
|
||||||
|
timeCalcApp.visibilityProperty
|
||||||
|
.setValue(Visibility.NONE.name());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (visibility.isWeaklyColored()) {
|
case KeyEvent.VK_SPACE: {
|
||||||
timeCalcApp.visibilityProperty
|
if (visibility.isStronglyColored()) {
|
||||||
.setValue(Visibility.GRAY.name());
|
timeCalcApp.visibilityProperty
|
||||||
|
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
||||||
|
: Visibility.WEAKLY_COLORED.name());
|
||||||
|
}
|
||||||
|
if (visibility.isWeaklyColored()) {
|
||||||
|
timeCalcApp.visibilityProperty
|
||||||
|
.setValue(Visibility.GRAY.name());
|
||||||
|
}
|
||||||
|
if (visibility.isGray()) {
|
||||||
|
timeCalcApp.visibilityProperty
|
||||||
|
.setValue(Visibility.NONE.name());
|
||||||
|
}
|
||||||
|
if (visibility.isNone()) {
|
||||||
|
timeCalcApp.visibilityProperty
|
||||||
|
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
||||||
|
: Visibility.STRONGLY_COLORED.name());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (visibility.isGray()) {
|
case KeyEvent.VK_F2: {
|
||||||
timeCalcApp.visibilityProperty
|
window.doCommand();
|
||||||
.setValue(Visibility.NONE.name());
|
break;
|
||||||
}
|
}
|
||||||
if (visibility.isNone()) {
|
case KeyEvent.VK_R: {
|
||||||
timeCalcApp.visibilityProperty
|
window.doRestart();
|
||||||
.setValue(onlyGreyOrNone ? Visibility.GRAY.name()
|
break;
|
||||||
: Visibility.STRONGLY_COLORED.name());
|
|
||||||
}
|
}
|
||||||
}
|
case KeyEvent.VK_N: {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_F2) {
|
timeCalcConfiguration.notificationsVisibleProperty.flip();
|
||||||
window.doCommand();
|
break;
|
||||||
}
|
}
|
||||||
if (e.getKeyCode() == KeyEvent.VK_R) {
|
case KeyEvent.VK_W: {
|
||||||
window.doRestart();
|
window.openWorkDaysWindow();
|
||||||
}
|
break;
|
||||||
if (e.getKeyCode() == KeyEvent.VK_N) {
|
}
|
||||||
timeCalcConfiguration.notificationsVisibleProperty.flip();
|
case KeyEvent.VK_A: {
|
||||||
}
|
window.openActivitiesWindow();
|
||||||
if (e.getKeyCode() == KeyEvent.VK_W) {
|
break;
|
||||||
window.openWorkDaysWindow();
|
}
|
||||||
}
|
case KeyEvent.VK_X: {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_A) {
|
window.doExit();
|
||||||
window.openActivitiesWindow();
|
break;
|
||||||
}
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_X) {
|
|
||||||
window.doExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_S) {
|
|
||||||
window.openConfigWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_J) {
|
|
||||||
if (timeCalcConfiguration.jokesVisibleProperty.isEnabled()) {
|
|
||||||
Jokes.showRandom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
case KeyEvent.VK_S: {
|
||||||
|
window.openConfigWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_P || e.getKeyCode() == KeyEvent.VK_F1) {
|
case KeyEvent.VK_J: {
|
||||||
window.openHelpWindow();
|
if (timeCalcConfiguration.jokesVisibleProperty.isEnabled()) {
|
||||||
}
|
Jokes.showRandom();
|
||||||
if (e.getKeyCode() == KeyEvent.VK_U) {
|
break;
|
||||||
window.doEnableEverything();
|
}
|
||||||
|
|
||||||
}
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean numberKeyWasPressed = e.getKeyCode() == KeyEvent.VK_0 ||
|
}
|
||||||
e.getKeyCode() == KeyEvent.VK_1 ||
|
|
||||||
e.getKeyCode() == KeyEvent.VK_2 ||
|
case KeyEvent.VK_P:
|
||||||
e.getKeyCode() == KeyEvent.VK_3 ||
|
case KeyEvent.VK_F1: {
|
||||||
e.getKeyCode() == KeyEvent.VK_4 ||
|
window.openHelpWindow();
|
||||||
e.getKeyCode() == KeyEvent.VK_5 ||
|
break;
|
||||||
e.getKeyCode() == KeyEvent.VK_6 ||
|
}
|
||||||
e.getKeyCode() == KeyEvent.VK_7 ||
|
case KeyEvent.VK_U: {
|
||||||
e.getKeyCode() == KeyEvent.VK_8 ||
|
window.doEnableEverything();
|
||||||
e.getKeyCode() == KeyEvent.VK_9;
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_I: {
|
||||||
|
window.doDisableAlmostEverything();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_E: {
|
||||||
|
timeCalcConfiguration.batteryWavesVisibleProperty.flip();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case KeyEvent.VK_B: {
|
||||||
|
MainWindow.hideShowCheckBox
|
||||||
|
.setSelected(!MainWindow.hideShowCheckBox.isSelected());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_F: {
|
||||||
|
|
||||||
|
if(FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {
|
||||||
|
try {
|
||||||
|
Utils.showNotification(Utils.readTextFromFile(FileConstants.TIME_CALC_PROFILES_TXT_FILE), 15000, 200);
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
Utils.showNotification("Error: " + ioException.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Utils.showNotification("Warning: There are no numbers assigned to profiles. Update file: " + FileConstants.TIME_CALC_PROFILES_TXT_FILE.getAbsolutePath() + ".");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_Q: {
|
||||||
|
timeCalcConfiguration.squareVisibleProperty.flip();break;
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_L: {
|
||||||
|
timeCalcConfiguration.circleVisibleProperty.flip();break;
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_Y: {
|
||||||
|
timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty.flip();break;
|
||||||
|
}
|
||||||
|
case KeyEvent.VK_M: {
|
||||||
|
timeCalcConfiguration.walkingHumanVisibleProperty.flip();break;
|
||||||
|
}
|
||||||
|
default: Utils.showNotification("Unsupported key was pressed. There is no key shortcut for this key.");
|
||||||
|
|
||||||
if(numberKeyWasPressed && !FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Warning: There is no profile assigned to Key with number, you pressed.", "Warning", JOptionPane.WARNING_MESSAGE);
|
|
||||||
}
|
}
|
||||||
if (numberKeyWasPressed && FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {
|
if (numberKeyWasPressed && FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {
|
||||||
|
|
||||||
@ -187,7 +243,7 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
ioException.printStackTrace();
|
ioException.printStackTrace();
|
||||||
}
|
}
|
||||||
int profileNumber = 0;
|
int profileNumber = 0;
|
||||||
switch(e.getKeyCode()) {
|
switch(keyCode) {
|
||||||
case KeyEvent.VK_0: profileNumber = 0;break;
|
case KeyEvent.VK_0: profileNumber = 0;break;
|
||||||
case KeyEvent.VK_1: profileNumber = 1;break;
|
case KeyEvent.VK_1: profileNumber = 1;break;
|
||||||
case KeyEvent.VK_2: profileNumber = 2;break;
|
case KeyEvent.VK_2: profileNumber = 2;break;
|
||||||
@ -217,20 +273,8 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
Utils.showNotification("Warning: There is no profile assigned to Key " + profileNumber, 5000);
|
Utils.showNotification("Warning: There is no profile assigned to Key " + profileNumber, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.getKeyCode() == KeyEvent.VK_F) {
|
|
||||||
|
|
||||||
if(FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {
|
|
||||||
try {
|
|
||||||
Utils.showNotification(Utils.readTextFromFile(FileConstants.TIME_CALC_PROFILES_TXT_FILE), 15000, 200);
|
|
||||||
} catch (IOException ioException) {
|
|
||||||
ioException.printStackTrace();
|
|
||||||
Utils.showNotification("Error: " + ioException.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Utils.showNotification("Warning: There are no numbers assigned to profiles. Update file: " + FileConstants.TIME_CALC_PROFILES_TXT_FILE.getAbsolutePath() + ".");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
window.repaint();
|
window.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
## Key shortcuts
|
## Key shortcuts
|
||||||
|
|
||||||
* UP - Show widgets again, if they were hidden
|
* UP - Show widgets again, if they were hidden
|
||||||
* DOWN - Hide all widgets and buttons
|
* DOWN or PERIOD - Hide all widgets and buttons
|
||||||
* H - Show all hide everything
|
* H - Show all hide everything
|
||||||
* G - switch between coloured and no-coloured visibility mode
|
* G - switch between coloured and no-coloured visibility mode
|
||||||
* C - switch between strongly coloured and weakly coloured visibility mode
|
* C - switch between strongly coloured and weakly coloured visibility mode
|
||||||
@ -160,6 +160,10 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
* B - hide or show buttons
|
* B - hide or show buttons
|
||||||
* 0,1,2,3,4,5,6,7,8 or 9 - activates a profile
|
* 0,1,2,3,4,5,6,7,8 or 9 - activates a profile
|
||||||
* F - show numbers for profiles
|
* F - show numbers for profiles
|
||||||
|
* Q - hide or show progress square
|
||||||
|
* L - hide or show progress circle
|
||||||
|
* M - hide or show walking human
|
||||||
|
* Y - hide or show smileys
|
||||||
|
|
||||||
## Command button
|
## Command button
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user