Added improvements

This commit is contained in:
Robert Vokac 2024-03-02 10:23:55 +00:00
parent 1a187ca1ed
commit 488dda556a
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
6 changed files with 29 additions and 14 deletions

View File

@ -97,10 +97,12 @@ public class TimeCalcConfiguration {
public final BooleanProperty notificationsVisibleProperty
= new BooleanProperty(TimeCalcProperty.NOTIFICATIONS_VISIBLE
.getKey());
public final BooleanProperty smileysColoredProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_COLORED.getKey());
public final BooleanProperty smileysVisibleProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_VISIBLE.getKey());
public final BooleanProperty smileysVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
public final BooleanProperty smileysColoredProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_COLORED.getKey());
public final BooleanProperty squareVisibleProperty
= new BooleanProperty(TimeCalcProperty.SQUARE_VISIBLE.getKey());
@ -137,8 +139,9 @@ public class TimeCalcConfiguration {
jokesVisibleProperty,
commandsVisibleProperty,
notificationsVisibleProperty,
smileysColoredProperty,
smileysVisibleProperty,
smileysVisibleOnlyIfMouseMovingOverProperty,
smileysColoredProperty,
squareVisibleProperty,}) {
allProperties.add(p);
}

View File

@ -43,8 +43,10 @@ public enum TimeCalcProperty {
JOKES_VISIBLE("jokes.visible", "Jokes"),
COMMANDS_VISIBLE("commands.visible", "Commands"),
NOTIFICATIONS_VISIBLE("notifications.visible", "Notifications"),
SMILEYS_COLORED("smileys.colored", "Smileys : Colored"),
SMILEYS_VISIBLE("smileys.visible", "Smileys"),
SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER("smileys.visible-only-if-mouse-moving-over", "Smileys : Visible only, if mouse moving over"),
SMILEYS_COLORED("smileys.colored", "Smileys : Colored"),
SQUARE_VISIBLE("square.visible", "Square");

View File

@ -97,10 +97,14 @@ public class ConfigWindow extends TWindow {
= new JCheckBox(TimeCalcProperty.COMMANDS_VISIBLE.getKey());
private JCheckBox notificationsVisibleProperty
= new JCheckBox(TimeCalcProperty.NOTIFICATIONS_VISIBLE.getKey());
private JCheckBox smileysColoredProperty
= new JCheckBox(TimeCalcProperty.SMILEYS_COLORED.getKey());
private JCheckBox smileysVisibleOnlyIfMouseMovingOverProperty
= new JCheckBox(TimeCalcProperty.SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
private JCheckBox smileysVisibleProperty
= new JCheckBox(TimeCalcProperty.SMILEYS_VISIBLE.getKey());
private JCheckBox smileysColoredProperty
= new JCheckBox(TimeCalcProperty.SMILEYS_COLORED.getKey());
private JCheckBox squareVisibleProperty
= new JCheckBox(TimeCalcProperty.SQUARE_VISIBLE.getKey());
@ -112,10 +116,10 @@ public class ConfigWindow extends TWindow {
setLayout(null);
add(enableAsMuchAsPossible);
enableAsMuchAsPossible.setBounds(SwingUtils.MARGIN, currentY, 200,
enableAsMuchAsPossible.setBounds(SwingUtils.MARGIN, currentY, 250,
HEIGHT1);
add(disableAsMuchAsPossible);
disableAsMuchAsPossible.setBounds(enableAsMuchAsPossible.getX() + enableAsMuchAsPossible.getWidth() + SwingUtils.MARGIN, currentY, 200,
disableAsMuchAsPossible.setBounds(enableAsMuchAsPossible.getX() + enableAsMuchAsPossible.getWidth() + SwingUtils.MARGIN, currentY, 250,
HEIGHT1);
nextRow();
for(boolean enable:new boolean[]{true, false}) {
@ -150,8 +154,9 @@ public class ConfigWindow extends TWindow {
jokesVisibleProperty.setSelected(true);
commandsVisibleProperty.setSelected(enable);
notificationsVisibleProperty.setSelected(enable);
smileysVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
smileysVisibleProperty.setSelected(enable);
smileysColoredProperty.setSelected(enable);
smileysVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
squareVisibleProperty.setSelected(true);
});
}
@ -182,6 +187,7 @@ public class ConfigWindow extends TWindow {
jokesVisibleProperty,
commandsVisibleProperty,
notificationsVisibleProperty,
smileysVisibleProperty,
smileysVisibleOnlyIfMouseMovingOverProperty,
smileysColoredProperty,
squareVisibleProperty));

View File

@ -345,8 +345,9 @@ public class MainWindow extends TWindow {
componentRegistry.getSet().stream().filter(c -> c instanceof Widget).forEach(c
-> {
Widget widget = (Widget) c;
widget.smileysColoredProperty.bindTo(timeCalcConfiguration.smileysColoredProperty);
widget.smileysVisibleProperty.bindTo(timeCalcConfiguration.smileysVisibleProperty);
widget.smileysVisibleOnlyIfMouseMovingOverProperty.bindTo(timeCalcConfiguration.smileysVisibleOnlyIfMouseMovingOverProperty);
widget.smileysColoredProperty.bindTo(timeCalcConfiguration.smileysColoredProperty);
}
);
setSize(dayBattery.getX() + dayBattery.getWidth() + 3 * SwingUtils.MARGIN,

View File

@ -39,14 +39,16 @@ public class Widget extends JPanel implements
public StringProperty visibilityProperty
= new StringProperty("widget.visibilityProperty",
Visibility.STRONGLY_COLORED.name());
public final BooleanProperty smileysColoredProperty
= new BooleanProperty("smileysColoredProperty", true);
public final BooleanProperty visibilitySupportedColoredProperty
= new BooleanProperty("visibilitySupportedColoredProperty", true);
public final BooleanProperty visibleProperty
= new BooleanProperty("visibleProperty", true);
public final BooleanProperty smileysVisibleProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_VISIBLE.getKey());
public final BooleanProperty smileysVisibleOnlyIfMouseMovingOverProperty
= new BooleanProperty(TimeCalcProperty.SMILEYS_VISIBLE_ONLY_IF_MOUSE_MOVING_OVER.getKey());
public final BooleanProperty smileysColoredProperty
= new BooleanProperty("smileysColoredProperty", true);
protected int side = 0;
protected double donePercent = 0;
protected boolean mouseOver = false;
@ -181,7 +183,7 @@ public class Widget extends JPanel implements
}
protected void paintSmiley(Visibility visibility, Graphics2D brush, int x, int y) {
if (!mouseOver && smileysVisibleOnlyIfMouseMovingOverProperty.isEnabled()) {
if (smileysVisibleProperty.isDisabled() || (!mouseOver && smileysVisibleOnlyIfMouseMovingOverProperty.isEnabled())) {
if (this.smileyIcon != null) {
this.remove(smileyIcon);
this.smileyIcon = null;

View File

@ -27,6 +27,7 @@ battery.label.visible=true
jokes.visible=true
commands.visible=true
notifications.visible=true
smileys.visible=true
smileys.visible-only-if-mouse-moving-over=true
smileys.colored=true
square.visible=true
@ -51,4 +52,4 @@ battery.week.visible=true
battery.month.visible=true
battery.year.visible=true
battery.blinking-if-critical-low=true
smileys.visible=true