mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added some improvements
This commit is contained in:
parent
f28759ffd1
commit
54411412d8
@ -184,6 +184,7 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
* CTRL + Q - Decrease speed of time
|
* CTRL + Q - Decrease speed of time
|
||||||
* ALT + Q - Reset speed of time
|
* ALT + Q - Reset speed of time
|
||||||
* COMMA - Switch between foreward and backward speed
|
* COMMA - Switch between foreward and backward speed
|
||||||
|
* T - Enable or disable floating speed
|
||||||
* D - Reset custom time values to the real time
|
* D - Reset custom time values to the real time
|
||||||
* SHIFT + A - Increase arrival time
|
* SHIFT + A - Increase arrival time
|
||||||
* CTRL + A - Decrease arrival time
|
* CTRL + A - Decrease arrival time
|
||||||
@ -213,7 +214,6 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
### Fix these known bugs
|
### Fix these known bugs
|
||||||
|
|
||||||
* Clock, square and circle are grey, if visibility mode is weakly colored.
|
* Clock, square and circle are grey, if visibility mode is weakly colored.
|
||||||
* Decreasing real time sometimes does not work correctly.
|
|
||||||
|
|
||||||
## For Developers
|
## For Developers
|
||||||
|
|
||||||
|
@ -263,6 +263,8 @@ public class TimeCalcConfiguration {
|
|||||||
.getKey(), 1);
|
.getKey(), 1);
|
||||||
public final BooleanProperty speedNegativeProperty = new BooleanProperty(TimeCalcProperty.SPEED_NEGATIVE
|
public final BooleanProperty speedNegativeProperty = new BooleanProperty(TimeCalcProperty.SPEED_NEGATIVE
|
||||||
.getKey(), false);
|
.getKey(), false);
|
||||||
|
public final BooleanProperty speedFloatingProperty = new BooleanProperty(TimeCalcProperty.SPEED_FLOATING
|
||||||
|
.getKey(), false);
|
||||||
|
|
||||||
//
|
//
|
||||||
private final Map<TimeCalcProperty, Property> mapOfProperties
|
private final Map<TimeCalcProperty, Property> mapOfProperties
|
||||||
@ -340,6 +342,7 @@ public class TimeCalcConfiguration {
|
|||||||
activityNeededFlagsProperty,
|
activityNeededFlagsProperty,
|
||||||
speedProperty,
|
speedProperty,
|
||||||
speedNegativeProperty,
|
speedNegativeProperty,
|
||||||
|
speedFloatingProperty,
|
||||||
clockHiddenProperty,
|
clockHiddenProperty,
|
||||||
batteryMinuteHiddenProperty,
|
batteryMinuteHiddenProperty,
|
||||||
batteryHourHiddenProperty,
|
batteryHourHiddenProperty,
|
||||||
|
@ -707,6 +707,11 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
timeCalcConfiguration.speedNegativeProperty.flip();
|
timeCalcConfiguration.speedNegativeProperty.flip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case KeyEvent.VK_T: {
|
||||||
|
timeCalcConfiguration.speedFloatingProperty.flip();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if (!numberKeyWasPressed) {
|
if (!numberKeyWasPressed) {
|
||||||
Utils.showNotification(
|
Utils.showNotification(
|
||||||
|
@ -125,7 +125,8 @@ public enum TimeCalcProperty {
|
|||||||
TEST_CLOCK_CUSTOM_MILLISECOND("test.clock.custom.millisecond", "Test : Clock : Custom : Millisecond", Integer.class),
|
TEST_CLOCK_CUSTOM_MILLISECOND("test.clock.custom.millisecond", "Test : Clock : Custom : Millisecond", Integer.class),
|
||||||
ACTIVITY_NEEDED_FLAGS("activity.needed-flags", "Activity : Needed flags", String.class),
|
ACTIVITY_NEEDED_FLAGS("activity.needed-flags", "Activity : Needed flags", String.class),
|
||||||
SPEED("speed", "Speed", Integer.class),
|
SPEED("speed", "Speed", Integer.class),
|
||||||
SPEED_NEGATIVE("speed.negative", "Speed : Negative", Integer.class);
|
SPEED_NEGATIVE("speed.negative", "Speed : Negative", Integer.class),
|
||||||
|
SPEED_FLOATING("speed.floating", "Speed : Floating");
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final String key;
|
private final String key;
|
||||||
|
@ -230,6 +230,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
= new JTextField(TimeCalcProperty.SPEED.getKey());
|
= new JTextField(TimeCalcProperty.SPEED.getKey());
|
||||||
public final JCheckBox speedNegativeProperty
|
public final JCheckBox speedNegativeProperty
|
||||||
= new JCheckBox(TimeCalcProperty.SPEED_NEGATIVE.getKey());
|
= new JCheckBox(TimeCalcProperty.SPEED_NEGATIVE.getKey());
|
||||||
|
public final JCheckBox speedFloatingProperty
|
||||||
|
= new JCheckBox(TimeCalcProperty.SPEED_FLOATING.getKey());
|
||||||
|
|
||||||
//
|
//
|
||||||
public final JCheckBox clockHiddenProperty
|
public final JCheckBox clockHiddenProperty
|
||||||
@ -455,6 +457,14 @@ public class ConfigWindow extends TWindow {
|
|||||||
moneyHiddenProperty.setSelected(!enable);
|
moneyHiddenProperty.setSelected(!enable);
|
||||||
weatherHiddenProperty.setSelected(!enable);
|
weatherHiddenProperty.setSelected(!enable);
|
||||||
dotHiddenProperty.setSelected(!enable);
|
dotHiddenProperty.setSelected(!enable);
|
||||||
|
if (enable) {
|
||||||
|
speedProperty.setText("0");
|
||||||
|
speedFloatingProperty.setSelected(true);
|
||||||
|
}
|
||||||
|
if (!enable) {
|
||||||
|
speedProperty.setText(String.valueOf(Integer.MIN_VALUE));
|
||||||
|
speedFloatingProperty.setSelected(false);
|
||||||
|
}
|
||||||
MainWindow.hideShowFormsCheckBox.setSelected(enable);
|
MainWindow.hideShowFormsCheckBox.setSelected(enable);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -549,6 +559,7 @@ public class ConfigWindow extends TWindow {
|
|||||||
activityNeededFlagsProperty,
|
activityNeededFlagsProperty,
|
||||||
speedProperty,
|
speedProperty,
|
||||||
speedNegativeProperty,
|
speedNegativeProperty,
|
||||||
|
speedFloatingProperty,
|
||||||
visibilityDefaultProperty,
|
visibilityDefaultProperty,
|
||||||
visibilitySupportedColoredProperty));
|
visibilitySupportedColoredProperty));
|
||||||
//
|
//
|
||||||
|
@ -122,7 +122,6 @@ public class MainWindow extends TWindow {
|
|||||||
private final TimeCalcKeyAdapter timeCalcKeyAdapter;
|
private final TimeCalcKeyAdapter timeCalcKeyAdapter;
|
||||||
private double msRemaining = 0d;
|
private double msRemaining = 0d;
|
||||||
private final Time timeAlwaysReal;
|
private final Time timeAlwaysReal;
|
||||||
private boolean floatingTime = false;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ChangeListener valueMustBeTime
|
ChangeListener valueMustBeTime
|
||||||
@ -850,7 +849,12 @@ public class MainWindow extends TWindow {
|
|||||||
new Timer(100, e -> {
|
new Timer(100, e -> {
|
||||||
if (speed == Integer.MIN_VALUE) {
|
if (speed == Integer.MIN_VALUE) {
|
||||||
//timeCalcConfiguration.testEnabledProperty.setValue(false);
|
//timeCalcConfiguration.testEnabledProperty.setValue(false);
|
||||||
return;
|
if (timeCalcConfiguration.speedFloatingProperty.isEnabled()) {
|
||||||
|
speed = 0;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
double r = Math.pow(2, speed + 6);
|
double r = Math.pow(2, speed + 6);
|
||||||
if (speed < -6 && Math.random() > r) {
|
if (speed < -6 && Math.random() > r) {
|
||||||
@ -861,6 +865,7 @@ public class MainWindow extends TWindow {
|
|||||||
if (timeCalcConfiguration.testEnabledProperty.isDisabled()) {
|
if (timeCalcConfiguration.testEnabledProperty.isDisabled()) {
|
||||||
timeCalcConfiguration.testEnabledProperty.enable();
|
timeCalcConfiguration.testEnabledProperty.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.yearCustomProperty.getValue() == Integer.MAX_VALUE) {
|
if (time.yearCustomProperty.getValue() == Integer.MAX_VALUE) {
|
||||||
time.yearCustomProperty.setValue(time.yearProperty.getValue());
|
time.yearCustomProperty.setValue(time.yearProperty.getValue());
|
||||||
}
|
}
|
||||||
@ -882,26 +887,92 @@ public class MainWindow extends TWindow {
|
|||||||
if (time.millisecondCustomProperty.getValue() == Integer.MAX_VALUE) {
|
if (time.millisecondCustomProperty.getValue() == Integer.MAX_VALUE) {
|
||||||
time.millisecondCustomProperty.setValue(time.millisecondProperty.getValue());
|
time.millisecondCustomProperty.setValue(time.millisecondProperty.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeCalcConfiguration.speedFloatingProperty.isEnabled()) {
|
||||||
|
long nowTime = timeAlwaysReal.asCalendar().getTime().getTime();
|
||||||
|
long fakeTime = time.asCalendar().getTime().getTime();
|
||||||
|
long diff = fakeTime - nowTime;
|
||||||
|
boolean forewardMs = diff > 0;
|
||||||
|
boolean backwardMs = !forewardMs;
|
||||||
|
if (forewardMs && diff > 60000 && Math.random() > 0.95) {
|
||||||
|
speed = -2;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if (forewardMs && diff <= 60000 && Math.random() > 0.95) {
|
||||||
|
speed = 1;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if (backwardMs && diff < -60000 && Math.random() > 0.95) {
|
||||||
|
speed = 2;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if (backwardMs && diff >= -60000 && Math.random() > 0.95) {
|
||||||
|
speed = -1;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (forewardMs && diff > 600000 && Math.random() > 0.95) {
|
||||||
|
speed = -4;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if (backwardMs && diff < -600000 && Math.random() > 0.95) {
|
||||||
|
speed = 4;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Math.random() > 0.95) {
|
||||||
|
speed = (int) (-8d + Math.random() * 8d);
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if(timeCalcConfiguration.speedNegativeProperty.isDisabled()){
|
||||||
|
if(Math.random() > 0.95 && Math.abs(diff) > 360000d * 6d) {
|
||||||
|
speed = (int) (backwardMs ? (5d + Math.random() * 5d) : (-5d - Math.random() * 3d)) ;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Math.random() > 0.999 ) {
|
||||||
|
speed = 10;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if(Math.random() < 0.001 ) {
|
||||||
|
speed = -6;
|
||||||
|
timeCalcConfiguration.speedProperty.setValue(speed);
|
||||||
|
}
|
||||||
|
if(diff > 360000 * 3) {
|
||||||
|
timeCalcConfiguration.speedNegativeProperty.setValue(true);
|
||||||
|
} else {
|
||||||
|
timeCalcConfiguration.speedNegativeProperty.setValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(Math.random() > 0.98) {
|
||||||
|
// boolean add = Math.random() > 0.5;
|
||||||
|
// this.timeCalcKeyAdapter.setMsToAdd((int) ((add ? (1) : (-1)) * Math.random() * 360000d));
|
||||||
|
// this.timeCalcKeyAdapter.processShifCtrlAltModeKeyCodes(KeyEvent.VK_U, add, !add, false);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
double msShouldBeAdded = speed < -6 ? 1 : (Math.pow(2, speed) * 100d) + this.msRemaining;
|
double msShouldBeAdded = speed < -6 ? 1 : (Math.pow(2, speed) * 100d) + this.msRemaining;
|
||||||
int msShouldBeAddedInt = (int)Math.floor(msShouldBeAdded);
|
int msShouldBeAddedInt = (int) Math.floor(msShouldBeAdded);
|
||||||
this.msRemaining = msShouldBeAdded - msShouldBeAddedInt;
|
this.msRemaining = msShouldBeAdded - msShouldBeAddedInt;
|
||||||
this.timeCalcKeyAdapter.setMsToAdd((timeCalcConfiguration.speedNegativeProperty.isEnabled() ? (-1) : 1) * msShouldBeAddedInt);
|
this.timeCalcKeyAdapter.setMsToAdd((timeCalcConfiguration.speedNegativeProperty.isEnabled() ? (-1) : 1) * msShouldBeAddedInt);
|
||||||
this.timeCalcKeyAdapter.processShifCtrlAltModeKeyCodes(KeyEvent.VK_U, true, false, false);
|
this.timeCalcKeyAdapter.processShifCtrlAltModeKeyCodes(KeyEvent.VK_U, true, false, false);
|
||||||
|
|
||||||
}).start();
|
}).start();
|
||||||
this.timeCalcConfiguration.speedProperty.addListener(e -> {
|
this.timeCalcConfiguration.speedProperty.addListener(e -> {
|
||||||
|
|
||||||
int newSpeed = Integer.valueOf(timeCalcConfiguration.speedProperty.getValue());
|
int newSpeed = Integer.valueOf(timeCalcConfiguration.speedProperty.getValue());
|
||||||
if(newSpeed < MIN_SPEED) {
|
if (newSpeed < MIN_SPEED) {
|
||||||
newSpeed = MIN_SPEED;
|
newSpeed = MIN_SPEED;
|
||||||
}
|
}
|
||||||
this.speed = newSpeed;
|
this.speed = newSpeed;
|
||||||
});
|
});
|
||||||
int newSpeed = Integer.valueOf(timeCalcConfiguration.speedProperty.getValue());
|
int newSpeed = Integer.valueOf(timeCalcConfiguration.speedProperty.getValue());
|
||||||
if(newSpeed < MIN_SPEED) {
|
if (newSpeed < MIN_SPEED) {
|
||||||
newSpeed = MIN_SPEED;
|
newSpeed = MIN_SPEED;
|
||||||
}
|
}
|
||||||
this.speed = newSpeed;
|
this.speed = newSpeed;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
if (Math.random() > 0.99) {
|
if (Math.random() > 0.99) {
|
||||||
@ -1354,10 +1425,12 @@ public class MainWindow extends TWindow {
|
|||||||
this.speed = Integer.MIN_VALUE;
|
this.speed = Integer.MIN_VALUE;
|
||||||
timeCalcConfiguration.speedProperty.setValue(this.speed);
|
timeCalcConfiguration.speedProperty.setValue(this.speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableFloatingTime() {
|
public void enableFloatingTime() {
|
||||||
this.floatingTime = true;
|
this.timeCalcConfiguration.speedFloatingProperty.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableFloatingTieme() {
|
public void disableFloatingTieme() {
|
||||||
this.floatingTime = false;
|
this.timeCalcConfiguration.speedFloatingProperty.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,7 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
* CTRL + Q - Decrease speed of time
|
* CTRL + Q - Decrease speed of time
|
||||||
* ALT + Q - Reset speed of time
|
* ALT + Q - Reset speed of time
|
||||||
* COMMA - Switch between foreward and backward speed
|
* COMMA - Switch between foreward and backward speed
|
||||||
|
* T - Enable or disable floating speed
|
||||||
* D - Reset custom time values to the real time
|
* D - Reset custom time values to the real time
|
||||||
* SHIFT + A - Increase arrival time
|
* SHIFT + A - Increase arrival time
|
||||||
* CTRL + A - Decrease arrival time
|
* CTRL + A - Decrease arrival time
|
||||||
@ -213,7 +214,6 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
### Fix these known bugs
|
### Fix these known bugs
|
||||||
|
|
||||||
* Clock, square and circle are grey, if visibility mode is weakly colored.
|
* Clock, square and circle are grey, if visibility mode is weakly colored.
|
||||||
* Decreasing real time sometimes does not work correctly.
|
|
||||||
|
|
||||||
## For Developers
|
## For Developers
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ test.clock.custom.millisecond=2147483647
|
|||||||
activity.needed-flags=
|
activity.needed-flags=
|
||||||
speed=0
|
speed=0
|
||||||
speed.negative=false
|
speed.negative=false
|
||||||
|
speed.floating=false
|
||||||
#TODO:
|
#TODO:
|
||||||
logs.detailed=false
|
logs.detailed=false
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user