mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
patch1
This commit is contained in:
parent
fcffaed480
commit
9756a2fd6a
@ -157,6 +157,7 @@ public class TimeCalcConfiguration {
|
|||||||
= new BooleanProperty("testModeProperty", false);
|
= new BooleanProperty("testModeProperty", false);
|
||||||
public final StringProperty profileNameProperty
|
public final StringProperty profileNameProperty
|
||||||
= new StringProperty(TimeCalcProperty.PROFILE_NAME.getKey());
|
= new StringProperty(TimeCalcProperty.PROFILE_NAME.getKey());
|
||||||
|
public final BooleanProperty testEnabledProperty = new BooleanProperty(TimeCalcProperty.TEST_ENABLED.getKey(), false);
|
||||||
public final IntegerProperty testYearCustomProperty = new IntegerProperty(TimeCalcProperty.TEST_CLOCK_CUSTOM_YEAR
|
public final IntegerProperty testYearCustomProperty = new IntegerProperty(TimeCalcProperty.TEST_CLOCK_CUSTOM_YEAR
|
||||||
.getKey(), Integer.MAX_VALUE);
|
.getKey(), Integer.MAX_VALUE);
|
||||||
public final IntegerProperty testMonthCustomProperty = new IntegerProperty(TimeCalcProperty.TEST_CLOCK_CUSTOM_MONTH
|
public final IntegerProperty testMonthCustomProperty = new IntegerProperty(TimeCalcProperty.TEST_CLOCK_CUSTOM_MONTH
|
||||||
@ -225,6 +226,7 @@ public class TimeCalcConfiguration {
|
|||||||
walkingHumanVisibleProperty,
|
walkingHumanVisibleProperty,
|
||||||
mainWindowCustomTitleProperty,
|
mainWindowCustomTitleProperty,
|
||||||
profileNameProperty,
|
profileNameProperty,
|
||||||
|
testEnabledProperty,
|
||||||
testYearCustomProperty,
|
testYearCustomProperty,
|
||||||
testMonthCustomProperty,
|
testMonthCustomProperty,
|
||||||
testDayCustomProperty,
|
testDayCustomProperty,
|
||||||
|
@ -597,6 +597,16 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case KeyEvent.VK_SLASH: {
|
||||||
|
if(timeCalcConfiguration.testEnabledProperty.isDisabled()) {
|
||||||
|
if(!Utils.askYesNo(null, "Do you really want to enable \"Test mode\"? If yes, then you will be allowed to set custom time.", "Enabling \"Test mode\"")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timeCalcConfiguration.testEnabledProperty.flip();
|
||||||
|
Utils.showNotification((timeCalcConfiguration.testEnabledProperty.isEnabled()? "Enabled" : "Disabled") + " \"Test mode\".");
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if (!numberKeyWasPressed) {
|
if (!numberKeyWasPressed) {
|
||||||
Utils.showNotification(
|
Utils.showNotification(
|
||||||
|
@ -78,6 +78,7 @@ public enum TimeCalcProperty {
|
|||||||
MAIN_WINDOW_CUSTOM_TITLE("main-window.custom-title",
|
MAIN_WINDOW_CUSTOM_TITLE("main-window.custom-title",
|
||||||
"Main Window : Custom Title"),
|
"Main Window : Custom Title"),
|
||||||
PROFILE_NAME("profile.name", "Profile : Name"),
|
PROFILE_NAME("profile.name", "Profile : Name"),
|
||||||
|
TEST_ENABLED("test.enabled", "Test : Enabled", Boolean.class),
|
||||||
TEST_CLOCK_CUSTOM_YEAR("test.clock.custom.year", "Test : Clock : Custom : Year", Integer.class),
|
TEST_CLOCK_CUSTOM_YEAR("test.clock.custom.year", "Test : Clock : Custom : Year", Integer.class),
|
||||||
TEST_CLOCK_CUSTOM_MONTH("test.clock.custom.month", "Test : Clock : Custom : Month", Integer.class),
|
TEST_CLOCK_CUSTOM_MONTH("test.clock.custom.month", "Test : Clock : Custom : Month", Integer.class),
|
||||||
TEST_CLOCK_CUSTOM_DAY("test.clock.custom.day", "Test : Clock : Custom : Day", Integer.class),
|
TEST_CLOCK_CUSTOM_DAY("test.clock.custom.day", "Test : Clock : Custom : Day", Integer.class),
|
||||||
|
@ -286,7 +286,7 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalOvertimeForDayInMinutes(int year, int month, int day) {
|
public int getTotalOvertimeForDayInMinutes(int year, int month, int day) {
|
||||||
System.out.println("#"+year+month+day);
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb
|
sb
|
||||||
.append("SELECT (sum(OVERTIME_HOUR)*60 + sum(OVERTIME_MINUTE) - sum(FORGET_OVERTIME)) as total_overtime FROM ")
|
.append("SELECT (sum(OVERTIME_HOUR)*60 + sum(OVERTIME_MINUTE) - sum(FORGET_OVERTIME)) as total_overtime FROM ")
|
||||||
|
@ -376,7 +376,7 @@ public class AnalogClock extends Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getTimerDelay() {
|
public int getTimerDelay() {
|
||||||
return 10;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class Time extends Thread {
|
|||||||
dayOfWeekReadWriteProperty
|
dayOfWeekReadWriteProperty
|
||||||
.setValue(dayOfWeek);
|
.setValue(dayOfWeek);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,8 @@ public class ConfigWindow extends TWindow {
|
|||||||
= new JTextField();
|
= new JTextField();
|
||||||
private final JTextField profileNameProperty
|
private final JTextField profileNameProperty
|
||||||
= new JTextField();
|
= new JTextField();
|
||||||
|
private final JCheckBox testEnabledProperty
|
||||||
|
= new JCheckBox(TimeCalcProperty.TEST_ENABLED.getKey());
|
||||||
private final JTextField testClockCustomYearProperty
|
private final JTextField testClockCustomYearProperty
|
||||||
= new JTextField(TimeCalcProperty.TEST_CLOCK_CUSTOM_YEAR.getKey());
|
= new JTextField(TimeCalcProperty.TEST_CLOCK_CUSTOM_YEAR.getKey());
|
||||||
private final JTextField testClockCustomMonthProperty
|
private final JTextField testClockCustomMonthProperty
|
||||||
@ -203,7 +205,7 @@ public class ConfigWindow extends TWindow {
|
|||||||
panelInsideScrollPaneBattery,
|
panelInsideScrollPaneBattery,
|
||||||
panelInsideScrollPaneSmileys,
|
panelInsideScrollPaneSmileys,
|
||||||
panelInsideScrollPaneTest,
|
panelInsideScrollPaneTest,
|
||||||
panelInsideScrollPaneMisc).toList();
|
panelInsideScrollPaneMisc).collect(Collectors.toList());
|
||||||
panelsInsideScrollPane.forEach(p-> {
|
panelsInsideScrollPane.forEach(p-> {
|
||||||
final BoxLayout boxLayout = new BoxLayout(p, BoxLayout.Y_AXIS);
|
final BoxLayout boxLayout = new BoxLayout(p, BoxLayout.Y_AXIS);
|
||||||
p.setLayout(boxLayout);
|
p.setLayout(boxLayout);
|
||||||
@ -229,7 +231,7 @@ public class ConfigWindow extends TWindow {
|
|||||||
scrollPaneSmileys,
|
scrollPaneSmileys,
|
||||||
scrollPaneTest,
|
scrollPaneTest,
|
||||||
scrollPaneMisc
|
scrollPaneMisc
|
||||||
).toList();
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
tp.add("Clock", scrollPaneClock);
|
tp.add("Clock", scrollPaneClock);
|
||||||
tp.add("Battery", scrollPaneBattery);
|
tp.add("Battery", scrollPaneBattery);
|
||||||
@ -361,6 +363,7 @@ public class ConfigWindow extends TWindow {
|
|||||||
smileysVisibleProperty,
|
smileysVisibleProperty,
|
||||||
smileysVisibleOnlyIfMouseMovingOverProperty,
|
smileysVisibleOnlyIfMouseMovingOverProperty,
|
||||||
smileysColoredProperty,
|
smileysColoredProperty,
|
||||||
|
testEnabledProperty,
|
||||||
testClockCustomYearProperty,
|
testClockCustomYearProperty,
|
||||||
testClockCustomMonthProperty,
|
testClockCustomMonthProperty,
|
||||||
testClockCustomDayProperty,
|
testClockCustomDayProperty,
|
||||||
|
@ -146,7 +146,7 @@ public class MainWindow extends TWindow {
|
|||||||
.bindTo(timeCalcConfiguration.testSecondCustomProperty);
|
.bindTo(timeCalcConfiguration.testSecondCustomProperty);
|
||||||
time.millisecondCustomProperty
|
time.millisecondCustomProperty
|
||||||
.bindTo(timeCalcConfiguration.testMillisecondCustomProperty);
|
.bindTo(timeCalcConfiguration.testMillisecondCustomProperty);
|
||||||
time.allowCustomValuesProperty.setValue(true);
|
time.allowCustomValuesProperty.bindTo(timeCalcConfiguration.testEnabledProperty);
|
||||||
|
|
||||||
arrivalTextField.addVetoableChangeListener(e -> {
|
arrivalTextField.addVetoableChangeListener(e -> {
|
||||||
String newValue = (String) e.getNewValue();
|
String newValue = (String) e.getNewValue();
|
||||||
@ -696,7 +696,7 @@ public class MainWindow extends TWindow {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
if(Math.random() > 0.99) {
|
if(Math.random() > 0.999) {
|
||||||
File dbFileBackup = new File(dbFile.getAbsolutePath() + ".backup." + DateFormats.DATE_TIME_FORMATTER_SHORT.format(new Date()).substring(0, 10) + ".sqlite3");
|
File dbFileBackup = new File(dbFile.getAbsolutePath() + ".backup." + DateFormats.DATE_TIME_FORMATTER_SHORT.format(new Date()).substring(0, 10) + ".sqlite3");
|
||||||
if (dbFile.exists() && !dbFileBackup.exists()) {
|
if (dbFile.exists() && !dbFileBackup.exists()) {
|
||||||
try {
|
try {
|
||||||
@ -711,7 +711,7 @@ public class MainWindow extends TWindow {
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long diff = now - Files.getLastModifiedTime(file.toPath()).toMillis();
|
long diff = now - Files.getLastModifiedTime(file.toPath()).toMillis();
|
||||||
int fileAgeInDays = (int) (diff/ 1000 / 60 / 60 / 24);
|
int fileAgeInDays = (int) (diff/ 1000 / 60 / 60 / 24);
|
||||||
System.out.println("Found backup file " + file.getName() + "with age: " + fileAgeInDays);
|
System.out.println("Found backup file " + file.getName() + " with age: " + fileAgeInDays);
|
||||||
if(fileAgeInDays > 14) {
|
if(fileAgeInDays > 14) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ circle.visible=true
|
|||||||
walking-human.visible=true
|
walking-human.visible=true
|
||||||
main-window.custom-title=---
|
main-window.custom-title=---
|
||||||
profile.name=
|
profile.name=
|
||||||
|
test.enabled=false
|
||||||
|
test.clock.custom.year=2147483647
|
||||||
test.clock.custom.year=2147483647
|
test.clock.custom.year=2147483647
|
||||||
test.clock.custom.month=2147483647
|
test.clock.custom.month=2147483647
|
||||||
test.clock.custom.day=2147483647
|
test.clock.custom.day=2147483647
|
||||||
|
Loading…
x
Reference in New Issue
Block a user