Added new feature - possibility to allow only the basic
This commit is contained in:
parent
1815e996b6
commit
46cb809502
@ -6,6 +6,7 @@ import org.nanoboot.utils.timecalc.swing.windows.MainWindow;
|
||||
import org.nanoboot.utils.timecalc.utils.common.DateFormats;
|
||||
import org.nanoboot.utils.timecalc.utils.common.FileConstants;
|
||||
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
||||
import org.nanoboot.utils.timecalc.utils.property.ReadOnlyProperty;
|
||||
import org.nanoboot.utils.timecalc.utils.property.StringProperty;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
@ -33,6 +34,7 @@ public class TimeCalcApp {
|
||||
= new StringProperty("timeCalcApp.visibilityProperty",
|
||||
Visibility.WEAKLY_COLORED.name());
|
||||
private long startNanoTime = 0l;
|
||||
public ReadOnlyProperty<Boolean> allowOnlyBasicFeaturesProperty = new ReadOnlyProperty<>("allowOnlyBasicFeatures", false);
|
||||
|
||||
@Getter
|
||||
private SqliteConnectionFactory sqliteConnectionFactory;
|
||||
@ -55,6 +57,9 @@ public class TimeCalcApp {
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(FileConstants.BASIC_TXT.exists()) {
|
||||
allowOnlyBasicFeaturesProperty.setValue(true);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
MainWindow timeCalcMainWindow = null;
|
||||
|
@ -1,5 +1,9 @@
|
||||
package org.nanoboot.utils.timecalc.app;
|
||||
package org.nanoboot.utils.timecalc.swing.common;
|
||||
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcApp;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcConfiguration;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcException;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcProperties;
|
||||
import org.nanoboot.utils.timecalc.entity.Visibility;
|
||||
import org.nanoboot.utils.timecalc.swing.windows.MainWindow;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.Time;
|
||||
@ -693,6 +697,7 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
||||
}
|
||||
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\"")) {
|
||||
@ -703,6 +708,16 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
||||
Utils.showNotification((timeCalcConfiguration.testEnabledProperty.isEnabled() ? "Enabled" : "Disabled") + " \"Test mode\".");
|
||||
break;
|
||||
}
|
||||
case KeyEvent.VK_O: {
|
||||
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;
|
||||
}
|
||||
case KeyEvent.VK_COMMA: {
|
||||
timeCalcConfiguration.speedNegativeProperty.flip();
|
||||
break;
|
@ -402,7 +402,7 @@ public class Battery extends Widget {
|
||||
|
||||
@Override
|
||||
public int getTimerDelay() {
|
||||
return 1000;
|
||||
return 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,239 @@
|
||||
package org.nanoboot.utils.timecalc.swing.progress.weather;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author pc00289
|
||||
* @since 25.03.2024
|
||||
*/
|
||||
public class A {
|
||||
public static void main(String[] args) {
|
||||
String a = "\n"
|
||||
+ " case KeyEvent.VK_UP: {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(onlyGreyOrNone ? Visibility.GRAY.name()\n"
|
||||
+ " : Visibility.STRONGLY_COLORED.name());\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_DOWN:\n"
|
||||
+ " case KeyEvent.VK_PERIOD: {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.NONE.name());\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_G: {\n"
|
||||
+ " if (visibility.isGray() && !onlyGreyOrNone) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.WEAKLY_COLORED.name());\n"
|
||||
+ " } else {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.GRAY.name());\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_C: {\n"
|
||||
+ " if (!onlyGreyOrNone) {\n"
|
||||
+ " if (visibility.isStronglyColored()) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.WEAKLY_COLORED.name());\n"
|
||||
+ " } else {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(\n"
|
||||
+ " Visibility.STRONGLY_COLORED.name());\n"
|
||||
+ " }\n"
|
||||
+ " } else {\n"
|
||||
+ " timeCalcApp.visibilityProperty.setValue(Visibility.GRAY\n"
|
||||
+ " .name());\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_V:\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_H: {\n"
|
||||
+ " if (visibility.isNone()) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(onlyGreyOrNone ? Visibility.GRAY.name()\n"
|
||||
+ " : Visibility.STRONGLY_COLORED.name());\n"
|
||||
+ " } else {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.NONE.name());\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_SPACE: {\n"
|
||||
+ " if (visibility.isStronglyColored()) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(onlyGreyOrNone ? Visibility.GRAY.name()\n"
|
||||
+ " : Visibility.WEAKLY_COLORED.name());\n"
|
||||
+ " }\n"
|
||||
+ " if (visibility.isWeaklyColored()) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.GRAY.name());\n"
|
||||
+ " }\n"
|
||||
+ " if (visibility.isGray()) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(Visibility.NONE.name());\n"
|
||||
+ " }\n"
|
||||
+ " if (visibility.isNone()) {\n"
|
||||
+ " timeCalcApp.visibilityProperty\n"
|
||||
+ " .setValue(onlyGreyOrNone ? Visibility.GRAY.name()\n"
|
||||
+ " : Visibility.STRONGLY_COLORED.name());\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_F2: {\n"
|
||||
+ " mainWindow.doCommand();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_R: {\n"
|
||||
+ " mainWindow.doRestart();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_N: {\n"
|
||||
+ " timeCalcConfiguration.notificationsVisibleProperty.flip();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_W: {\n"
|
||||
+ " mainWindow.openWorkDaysWindow();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_A: {\n"
|
||||
+ " mainWindow.openActivitiesWindow();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_X: {\n"
|
||||
+ " mainWindow.doExit();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_S: {\n"
|
||||
+ " mainWindow.openConfigWindow();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_J: {\n"
|
||||
+ " if (timeCalcConfiguration.jokesVisibleProperty.isEnabled()) {\n"
|
||||
+ " Jokes.showRandom();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_P:\n"
|
||||
+ " case KeyEvent.VK_F1: {\n"
|
||||
+ " mainWindow.openHelpWindow();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_U: {\n"
|
||||
+ " mainWindow.doEnableEverything();\n"
|
||||
+ " break;\n"
|
||||
+ "\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_I: {\n"
|
||||
+ " mainWindow.doDisableAlmostEverything();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_E: {\n"
|
||||
+ " timeCalcConfiguration.batteryWavesVisibleProperty.flip();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_B: {\n"
|
||||
+ " MainWindow.hideShowFormsCheckBox\n"
|
||||
+ " .setSelected(!MainWindow.hideShowFormsCheckBox.isSelected());\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_F: {\n"
|
||||
+ "\n"
|
||||
+ " if (FileConstants.TIME_CALC_PROFILES_TXT_FILE.exists()) {\n"
|
||||
+ " try {\n"
|
||||
+ " Utils.showNotification(Utils.readTextFromFile(\n"
|
||||
+ " FileConstants.TIME_CALC_PROFILES_TXT_FILE),\n"
|
||||
+ " 15000, 200);\n"
|
||||
+ " } catch (IOException ioException) {\n"
|
||||
+ " ioException.printStackTrace();\n"
|
||||
+ " Utils.showNotification(\n"
|
||||
+ " \"Error: \" + ioException.getMessage());\n"
|
||||
+ " }\n"
|
||||
+ " } else {\n"
|
||||
+ " Utils.showNotification(\n"
|
||||
+ " \"Warning: There are no numbers assigned to profiles. Update file: \"\n"
|
||||
+ " + FileConstants.TIME_CALC_PROFILES_TXT_FILE\n"
|
||||
+ " .getAbsolutePath() + \".\");\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_Q: {\n"
|
||||
+ " timeCalcConfiguration.squareVisibleProperty.flip();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_L: {\n"
|
||||
+ " timeCalcConfiguration.circleVisibleProperty.flip();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_Y: {\n"
|
||||
+ " timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty\n"
|
||||
+ " .flip();\n"
|
||||
+ " if (timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty.isDisabled() && timeCalcConfiguration.smileysVisibleProperty.isDisabled()) {\n"
|
||||
+ " timeCalcConfiguration.smileysVisibleProperty.enable();\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_M: {\n"
|
||||
+ " timeCalcConfiguration.walkingHumanVisibleProperty.flip();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_LEFT: {\n"
|
||||
+ " switchProfile(true, false);\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_RIGHT: {\n"
|
||||
+ " switchProfile(false, true);\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_D: {\n"
|
||||
+ " timeCalcConfiguration.testYearCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " timeCalcConfiguration.testMonthCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " timeCalcConfiguration.testDayCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " timeCalcConfiguration.testHourCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " timeCalcConfiguration.testMinuteCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " timeCalcConfiguration.testSecondCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " timeCalcConfiguration.testMillisecondCustomProperty.setValue(Integer.MAX_VALUE);\n"
|
||||
+ " Utils.showNotification(timeCalcConfiguration.print(), 15000, 400);\n"
|
||||
+ " this.mainWindow.resetSpeed();\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ "\n"
|
||||
+ " case KeyEvent.VK_K: {\n"
|
||||
+ " if (timeCalcConfiguration.clockVisibleProperty.isEnabled()) {\n"
|
||||
+ " timeCalcConfiguration.clockVisibleProperty.disable();\n"
|
||||
+ " } else {\n"
|
||||
+ " timeCalcConfiguration.clockVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockHandsLongVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockHandsColoredProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockHandsHourVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockHandsMinuteVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockHandsSecondVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockHandsMillisecondVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockBorderVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockBorderOnlyHoursProperty.disable();\n"
|
||||
+ " timeCalcConfiguration.clockNumbersVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockCircleVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockCircleStrongBorderProperty.disable();\n"
|
||||
+ " timeCalcConfiguration.clockCircleBorderColorProperty.setValue(\"0,0,255\");\n"
|
||||
+ " timeCalcConfiguration.clockCentreCircleVisibleProperty.enable();\n"
|
||||
+ " timeCalcConfiguration.clockCentreCircleBlackProperty.disable();\n"
|
||||
+ " timeCalcConfiguration.clockProgressVisibleOnlyIfMouseMovingOverProperty.disable();\n"
|
||||
+ " timeCalcConfiguration.clockDateVisibleOnlyIfMouseMovingOverProperty.disable();\n"
|
||||
+ " }\n"
|
||||
+ " break;\n"
|
||||
+ " }\n"
|
||||
+ " case KeyEvent.VK_Z: {";
|
||||
Arrays.stream(a.split("\n")).filter(l->l.contains("VK_"))
|
||||
.map(l->l.replace("case KeyEvent.VK_",""))
|
||||
.map(l->l.replace(": {","")).sorted()
|
||||
.forEach(System.out::println);
|
||||
}
|
||||
}
|
@ -442,21 +442,21 @@ public class ConfigWindow extends TWindow {
|
||||
swingVisibleProperty.setSelected(enable);
|
||||
swingQuarterIconVisibleProperty.setSelected(enable);
|
||||
walkingHumanVisibleProperty.setSelected(enable);
|
||||
clockHiddenProperty.setSelected(!enable);
|
||||
batteryMinuteHiddenProperty.setSelected(!enable);
|
||||
batteryHourHiddenProperty.setSelected(!enable);
|
||||
batteryDayHiddenProperty.setSelected(!enable);
|
||||
batteryWeekHiddenProperty.setSelected(!enable);
|
||||
batteryMonthHiddenProperty.setSelected(!enable);
|
||||
batteryYearHiddenProperty.setSelected(!enable);
|
||||
squareHiddenProperty.setSelected(!enable);
|
||||
circleHiddenProperty.setSelected(!enable);
|
||||
walkingHumanHiddenProperty.setSelected(!enable);
|
||||
swingHiddenProperty.setSelected(!enable);
|
||||
lifeHiddenProperty.setSelected(!enable);
|
||||
moneyHiddenProperty.setSelected(!enable);
|
||||
weatherHiddenProperty.setSelected(!enable);
|
||||
dotHiddenProperty.setSelected(!enable);
|
||||
// clockHiddenProperty.setSelected(!enable);
|
||||
// batteryMinuteHiddenProperty.setSelected(!enable);
|
||||
// batteryHourHiddenProperty.setSelected(!enable);
|
||||
// batteryDayHiddenProperty.setSelected(!enable);
|
||||
// batteryWeekHiddenProperty.setSelected(!enable);
|
||||
// batteryMonthHiddenProperty.setSelected(!enable);
|
||||
// batteryYearHiddenProperty.setSelected(!enable);
|
||||
// squareHiddenProperty.setSelected(!enable);
|
||||
// circleHiddenProperty.setSelected(!enable);
|
||||
// walkingHumanHiddenProperty.setSelected(!enable);
|
||||
// swingHiddenProperty.setSelected(!enable);
|
||||
// lifeHiddenProperty.setSelected(!enable);
|
||||
// moneyHiddenProperty.setSelected(!enable);
|
||||
// weatherHiddenProperty.setSelected(!enable);
|
||||
// dotHiddenProperty.setSelected(!enable);
|
||||
if (enable) {
|
||||
speedProperty.setText("0");
|
||||
speedFloatingProperty.setSelected(true);
|
||||
|
@ -4,7 +4,7 @@ import org.nanoboot.utils.timecalc.app.CommandActionListener;
|
||||
import org.nanoboot.utils.timecalc.app.GetProperty;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcApp;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcConfiguration;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcKeyAdapter;
|
||||
import org.nanoboot.utils.timecalc.swing.common.TimeCalcKeyAdapter;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcProperties;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcProperty;
|
||||
import org.nanoboot.utils.timecalc.entity.Progress;
|
||||
|
@ -19,6 +19,7 @@ public class FileConstants {
|
||||
public static final File DB_FILE = new File(FileConstants.TC_DIRECTORY.getAbsolutePath() + "/" + "time-calc.sqlite3");
|
||||
public static final File CLIMATE_TXT = new File(TC_DIRECTORY, "climate.txt");
|
||||
public static final File WEATHER_CSV = new File(TC_DIRECTORY, "weather.csv");
|
||||
public static final File BASIC_TXT = new File(TC_DIRECTORY, "basic.txt");
|
||||
private FileConstants() {
|
||||
//Not meant to be instantiated.
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ test.clock.custom.minute=2147483647
|
||||
test.clock.custom.second=2147483647
|
||||
test.clock.custom.millisecond=2147483647
|
||||
activity.needed-flags=
|
||||
speed=0
|
||||
speed=-2147483648
|
||||
speed.negative=false
|
||||
speed.floating=false
|
||||
#TODO:
|
||||
|
Loading…
x
Reference in New Issue
Block a user