Skip to content

Commit 755429d

Browse files
authored
Merge branch 'main' into language
2 parents c468e54 + 1d18eae commit 755429d

174 files changed

Lines changed: 5155 additions & 2378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gemini/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
code_review:
2+
pull_request_opened:
3+
code_review: false

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,8 @@ language-subtag-registry
6464
# test
6565
/hmcl.json
6666
/.hmcl.json
67-
/.hmcl/
67+
/.hmcl/
68+
69+
# AI
70+
/.gemini/
71+
!/.gemini/config.yaml

.idea/copyright/HMCL.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HMCL/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dependencies {
5757
implementation(project(":HMCLBoot"))
5858
implementation("libs:JFoenix")
5959
implementation(libs.twelvemonkeys.imageio.webp)
60+
implementation(libs.fxsvgimage)
6061
implementation(libs.java.info)
6162
implementation(libs.monet.fx)
6263
implementation(libs.nayuki.qrcodegen)
@@ -66,6 +67,7 @@ dependencies {
6667
}
6768

6869
embedResources(libs.authlib.injector)
70+
embedResources(libs.lwjgl.unsafe.agent)
6971
}
7072

7173
fun digest(algorithm: String, bytes: ByteArray): ByteArray = MessageDigest.getInstance(algorithm).digest(bytes)
@@ -155,6 +157,7 @@ val hmclProperties = buildList {
155157
add("hmcl.microsoft.auth.id" to microsoftAuthId)
156158
add("hmcl.curseforge.apikey" to curseForgeApiKey)
157159
add("hmcl.authlib-injector.version" to libs.authlib.injector.get().version!!)
160+
add("hmcl.lwjgl-unsafe-agent.version" to libs.lwjgl.unsafe.agent.get().version!!)
158161
}
159162

160163
val hmclPropertiesFile = layout.buildDirectory.file("hmcl.properties")

HMCL/src/main/java/com/jfoenix/controls/JFXDialog.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,13 @@
2323
import com.jfoenix.converters.DialogTransitionConverter;
2424
import com.jfoenix.effects.JFXDepthManager;
2525
import com.jfoenix.transitions.CachedTransition;
26-
import javafx.animation.Interpolator;
27-
import javafx.animation.KeyFrame;
28-
import javafx.animation.KeyValue;
29-
import javafx.animation.Timeline;
30-
import javafx.animation.Transition;
26+
import javafx.animation.*;
3127
import javafx.beans.DefaultProperty;
3228
import javafx.beans.property.BooleanProperty;
3329
import javafx.beans.property.ObjectProperty;
3430
import javafx.beans.property.ObjectPropertyBase;
3531
import javafx.beans.property.SimpleBooleanProperty;
36-
import javafx.css.CssMetaData;
37-
import javafx.css.SimpleStyleableObjectProperty;
38-
import javafx.css.Styleable;
39-
import javafx.css.StyleableObjectProperty;
40-
import javafx.css.StyleableProperty;
32+
import javafx.css.*;
4133
import javafx.event.Event;
4234
import javafx.event.EventHandler;
4335
import javafx.geometry.Pos;
@@ -49,7 +41,6 @@
4941
import javafx.scene.input.MouseEvent;
5042
import javafx.scene.layout.Background;
5143
import javafx.scene.layout.BackgroundFill;
52-
import javafx.scene.layout.CornerRadii;
5344
import javafx.scene.layout.Region;
5445
import javafx.scene.layout.StackPane;
5546
import javafx.scene.paint.Color;
@@ -155,7 +146,6 @@ private void initialize() {
155146
});
156147

157148
contentHolder = new StackPane();
158-
contentHolder.setBackground(new Background(new BackgroundFill(Color.WHITE, new CornerRadii(2), null)));
159149
JFXDepthManager.setDepth(contentHolder, 4);
160150
contentHolder.setPickOnBounds(false);
161151
// ensure stackpane is never resized beyond it's preferred size
@@ -381,6 +371,14 @@ private final class CenterTransition extends CachedTransition {
381371
setCycleDuration(Duration.seconds(0.4));
382372
setDelay(Duration.ZERO);
383373
}
374+
375+
@Override
376+
protected void starting() {
377+
}
378+
379+
@Override
380+
protected void stopping() {
381+
}
384382
}
385383

386384
/***************************************************************************

HMCL/src/main/java/com/jfoenix/controls/JFXProgressBar.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ protected Skin<?> createDefaultSkin() {
4949
return new JFXProgressBarSkin(this);
5050
}
5151

52+
private boolean smoothProgress = true;
53+
54+
public boolean isSmoothProgress() {
55+
return smoothProgress;
56+
}
57+
58+
public void setSmoothProgress(boolean smoothProgress) {
59+
this.smoothProgress = smoothProgress;
60+
}
61+
5262
private void initialize() {
5363
setPrefWidth(200);
5464
getStyleClass().add(DEFAULT_STYLE_CLASS);

HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,11 @@ protected Node getMask() {
231231
*
232232
* @return the ripple radius size
233233
*/
234-
protected double computeRippleRadius() {
235-
double width2 = control.getLayoutBounds().getWidth() * control.getLayoutBounds().getWidth();
236-
double height2 = control.getLayoutBounds().getHeight() * control.getLayoutBounds().getHeight();
237-
return Math.min(Math.sqrt(width2 + height2), RIPPLE_MAX_RADIUS) * 1.1 + 5;
234+
protected double computeRippleRadius(double centerX, double centerY) {
235+
double dx = Math.max(centerX, control.getLayoutBounds().getWidth() - centerX);
236+
double dy = Math.max(centerY, control.getLayoutBounds().getHeight() - centerY);
237+
238+
return (Math.sqrt(dx * dx + dy * dy) / 0.9) + 2;
238239
}
239240

240241
protected void setOverLayBounds(Rectangle overlay) {
@@ -473,7 +474,7 @@ private Ripple(double centerX, double centerY) {
473474
super(centerX,
474475
centerY,
475476
getRipplerRadius() == Region.USE_COMPUTED_SIZE ?
476-
computeRippleRadius() : getRipplerRadius(), null);
477+
computeRippleRadius(centerX, centerY) : getRipplerRadius(), null);
477478
setCache(true);
478479
setCacheHint(CacheHint.SPEED);
479480
setCacheShape(true);
@@ -518,7 +519,7 @@ private Ripple(double centerX, double centerY) {
518519
new KeyValue(opacityProperty(),
519520
1,
520521
RIPPLE_INTERPOLATOR)
521-
), new KeyFrame(Duration.millis(900), inKeyValues));
522+
), new KeyFrame(Duration.millis(600), inKeyValues));
522523

523524
setScaleX(0);
524525
setScaleY(0);

HMCL/src/main/java/com/jfoenix/controls/JFXSpinner.java

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.ArrayList;
3232
import java.util.Collections;
3333
import java.util.List;
34+
import java.util.concurrent.ThreadLocalRandom;
3435

3536
/// JFXSpinner is the material design implementation of a loading spinner.
3637
///
@@ -71,10 +72,10 @@ protected Skin<?> createDefaultSkin() {
7172
/// this control.
7273
private static final String DEFAULT_STYLE_CLASS = "jfx-spinner";
7374

74-
private static final double DEFAULT_RADIUS = 12.0;
75+
private static final double DEFAULT_RADIUS = 16.0;
7576

7677
/**
77-
* specifies the radius of the spinner node, by default it's set to `12.0`
78+
* specifies the radius of the spinner node, by default it's set to `16.0`
7879
*/
7980
private StyleableDoubleProperty radius;
8081

@@ -96,25 +97,8 @@ public final void setRadius(final double radius) {
9697
this.radiusProperty().set(radius);
9798
}
9899

99-
/// specifies from which angle the spinner should start spinning
100-
private StyleableDoubleProperty startingAngle;
101-
102-
public final StyleableDoubleProperty startingAngleProperty() {
103-
if (this.startingAngle == null) {
104-
startingAngle = new SimpleStyleableDoubleProperty(StyleableProperties.STARTING_ANGLE,
105-
JFXSpinner.this,
106-
"startingAngle",
107-
0.0);
108-
}
109-
return this.startingAngle;
110-
}
111-
112-
public final double getStartingAngle() {
113-
return startingAngle != null ? startingAngle.get() : 0.0;
114-
}
115-
116-
public final void setStartingAngle(final double startingAngle) {
117-
this.startingAngleProperty().set(startingAngle);
100+
public double getStartingAngle() {
101+
return 360 - ThreadLocalRandom.current().nextDouble() * 720;
118102
}
119103

120104
private static final class StyleableProperties {
@@ -132,26 +116,12 @@ public StyleableDoubleProperty getStyleableProperty(JFXSpinner control) {
132116
}
133117
};
134118

135-
private static final CssMetaData<JFXSpinner, Number> STARTING_ANGLE =
136-
new CssMetaData<>("-jfx-starting-angle",
137-
SizeConverter.getInstance(), 0.0) {
138-
@Override
139-
public boolean isSettable(JFXSpinner control) {
140-
return control.startingAngle == null || !control.startingAngle.isBound();
141-
}
142-
143-
@Override
144-
public StyleableDoubleProperty getStyleableProperty(JFXSpinner control) {
145-
return control.startingAngleProperty();
146-
}
147-
};
148-
149119
private static final List<CssMetaData<? extends Styleable, ?>> CHILD_STYLEABLES;
150120

151121
static {
152122
final List<CssMetaData<? extends Styleable, ?>> styleables =
153123
new ArrayList<>(ProgressIndicator.getClassCssMetaData());
154-
Collections.addAll(styleables, RADIUS, STARTING_ANGLE);
124+
Collections.addAll(styleables, RADIUS);
155125
CHILD_STYLEABLES = List.copyOf(styleables);
156126
}
157127
}

HMCL/src/main/java/com/jfoenix/controls/JFXTextField.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ private void initialize() {
8888
useJFXContextMenu(this);
8989
}
9090

91+
// https://github.com/HMCL-dev/HMCL/issues/5822
92+
// TODO: This method may no longer be needed after we update JFXTextFieldSkin
93+
@Override
94+
protected void layoutChildren() {
95+
super.layoutChildren();
96+
this.setNeedsLayout(false);
97+
}
98+
9199
/***************************************************************************
92100
* *
93101
* Properties *

0 commit comments

Comments
 (0)