Added new configuration entry: 'Type : Visible'

This commit is contained in:
Robert Vokac 2024-04-06 10:56:36 +02:00
parent 2fa262cf7d
commit ab3a2c1585
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
6 changed files with 29 additions and 14 deletions

View File

@ -273,6 +273,8 @@ public class TimeCalcConfiguration {
.getKey(), false); .getKey(), false);
public final BooleanProperty speedFloatingProperty = new BooleanProperty(TimeCalcProperty.SPEED_FLOATING public final BooleanProperty speedFloatingProperty = new BooleanProperty(TimeCalcProperty.SPEED_FLOATING
.getKey(), false); .getKey(), false);
public final BooleanProperty typeVisibleProperty = new BooleanProperty(TimeCalcProperty.TYPE_VISIBLE
.getKey(), false);
// //
private final Map<TimeCalcProperty, Property> mapOfProperties private final Map<TimeCalcProperty, Property> mapOfProperties
@ -350,6 +352,7 @@ public class TimeCalcConfiguration {
speedProperty, speedProperty,
speedNegativeProperty, speedNegativeProperty,
speedFloatingProperty, speedFloatingProperty,
typeVisibleProperty,
clockHiddenProperty, clockHiddenProperty,
batteryMinuteHiddenProperty, batteryMinuteHiddenProperty,
batteryHourHiddenProperty, batteryHourHiddenProperty,

View File

@ -130,7 +130,8 @@ public enum TimeCalcProperty {
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"); SPEED_FLOATING("speed.floating", "Speed : Floating"),
TYPE_VISIBLE("type.visible", "Type : Visible");
@Getter @Getter
private final String key; private final String key;

View File

@ -83,6 +83,8 @@ public class Widget extends JPanel implements
Visibility.STRONGLY_COLORED.name()); Visibility.STRONGLY_COLORED.name());
public StringProperty typeProperty public StringProperty typeProperty
= new StringProperty("widget.typeProperty", WidgetType.DAY.name().toLowerCase()); = new StringProperty("widget.typeProperty", WidgetType.DAY.name().toLowerCase());
public final BooleanProperty typeVisibleProperty = new BooleanProperty(TimeCalcProperty.TYPE_VISIBLE
.getKey(), false);
protected int side = 0; protected int side = 0;
protected Progress progress = null; protected Progress progress = null;
protected boolean mouseOver = false; protected boolean mouseOver = false;
@ -335,23 +337,26 @@ public class Widget extends JPanel implements
brush.drawRect(1, 1, getWidth() - 2, getHeight() - 2); brush.drawRect(1, 1, getWidth() - 2, getHeight() - 2);
brush.setColor(currentColor); brush.setColor(currentColor);
} }
boolean isLife = getClass() == ProgressLife.class;
boolean isMoney = getClass() == ProgressMoney.class; if (typeVisibleProperty.isEnabled() || typeProperty.getValue().equals(WidgetType.PRESENTATION.name().toLowerCase())) {
if (isLife || isMoney || typeProperty.getValue().equals(WidgetType.PRESENTATION.name().toLowerCase())) { paintTypeName(brush, visibility);
brush.setColor(visibility.isStronglyColored() ? Color.BLUE : Color.GRAY);
if(visibility.isStronglyColored() && (getClass() == ProgressFuelGauge.class)) {
brush.setColor(Color.GRAY);
}
if(visibility.isWeaklyColored() && (getClass() == ProgressFuelGauge.class)) {
brush.setColor(Color.LIGHT_GRAY);
}
brush.setFont(FONT);
brush.drawString(progress.getWidgetType(WidgetType.valueOf(typeProperty.getValue().toUpperCase())).name(),
(int) (getWidth() * 0.5d - 20d), 15);
} }
} }
private void paintTypeName(Graphics brush, Visibility visibility) {
brush.setColor(visibility.isStronglyColored() ? Color.BLUE : Color.GRAY);
if(visibility.isStronglyColored() && (getClass() == ProgressFuelGauge.class)) {
brush.setColor(Color.GRAY);
}
if(visibility.isWeaklyColored() && (getClass() == ProgressFuelGauge.class)) {
brush.setColor(Color.LIGHT_GRAY);
}
brush.setFont(FONT);
brush.drawString(progress.getWidgetType(WidgetType.valueOf(typeProperty.getValue().toUpperCase())).name(),
(int) (getWidth() * 0.5d - 20d), 15);
}
private static void paintCloseIcon(Graphics brush, int width, private static void paintCloseIcon(Graphics brush, int width,
boolean mouseOver, boolean mouseOverCloseButton) { boolean mouseOver, boolean mouseOverCloseButton) {

View File

@ -274,6 +274,8 @@ public class ConfigWindow extends TWindow {
= new JCheckBox(TimeCalcProperty.WEATHER_HIDDEN.getKey()); = new JCheckBox(TimeCalcProperty.WEATHER_HIDDEN.getKey());
public final JCheckBox dotHiddenProperty public final JCheckBox dotHiddenProperty
= new JCheckBox(TimeCalcProperty.DOT_HIDDEN.getKey()); = new JCheckBox(TimeCalcProperty.DOT_HIDDEN.getKey());
public final JCheckBox typeVisibleProperty
= new JCheckBox(TimeCalcProperty.TYPE_VISIBLE.getKey());
// //
private final JCheckBox testEnabledProperty private final JCheckBox testEnabledProperty
@ -465,6 +467,7 @@ public class ConfigWindow extends TWindow {
walkingHumanVisibleProperty.setSelected(enable); walkingHumanVisibleProperty.setSelected(enable);
fuelVisibleProperty.setSelected(enable); fuelVisibleProperty.setSelected(enable);
fuelIconVisibleProperty.setSelected(enable); fuelIconVisibleProperty.setSelected(enable);
typeVisibleProperty.setSelected(enable);
// clockHiddenProperty.setSelected(!enable); // clockHiddenProperty.setSelected(!enable);
// batteryMinuteHiddenProperty.setSelected(!enable); // batteryMinuteHiddenProperty.setSelected(!enable);
// batteryHourHiddenProperty.setSelected(!enable); // batteryHourHiddenProperty.setSelected(!enable);
@ -562,6 +565,7 @@ public class ConfigWindow extends TWindow {
speedProperty, speedProperty,
speedNegativeProperty, speedNegativeProperty,
speedFloatingProperty, speedFloatingProperty,
typeVisibleProperty,
visibilityDefaultProperty, visibilityDefaultProperty,
visibilitySupportedColoredProperty)); visibilitySupportedColoredProperty));
// //

View File

@ -791,6 +791,7 @@ public class MainWindow extends TWindow {
.bindTo(timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty); .bindTo(timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty);
widget.smileysColoredProperty widget.smileysColoredProperty
.bindTo(timeCalcConfiguration.smileysColoredProperty); .bindTo(timeCalcConfiguration.smileysColoredProperty);
widget.typeVisibleProperty.bindTo(timeCalcConfiguration.typeVisibleProperty);
} }
); );
setSize(progressSquare.getX() + progressSquare.getWidth() setSize(progressSquare.getX() + progressSquare.getWidth()

View File

@ -98,6 +98,7 @@ activity.needed-flags=
speed=-2147483648 speed=-2147483648
speed.negative=false speed.negative=false
speed.floating=false speed.floating=false
type.visible=false
#TODO: #TODO:
logs.detailed=false logs.detailed=false