Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 13 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<version>3.3.0</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -84,32 +84,32 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.15.3</version>
<version>1.21.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.22</version>
<version>2.0.59</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>19</version>
<version>25</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
<version>25</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
<version>25</version>
</dependency>
<dependency>
<groupId>io.github.palexdev</groupId>
<artifactId>materialfx</artifactId>
<version>11.13.8</version>
<version>11.17.0</version>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
Expand All @@ -119,34 +119,24 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.1.0</version>
<version>26.0.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.42</version>
</dependency>
<!--suppress VulnerableLibrariesLocal -->
<dependency>
<groupId>log4j</groupId>
<!--suppress VulnerableLibrariesLocal -->
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>3.25.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.14.0</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.6</version>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>25</version>
</dependency>
</dependencies>
</project>
2 changes: 2 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
requires org.jsoup;
requires animated.gif.lib;
requires fastjson;
requires javafx.web;
requires javafx.graphics;

opens xyz.zcraft.acgpicdownload to javafx.controls, javafx.base, javafx.graphics, javafx.fxml, com.alibaba.fastjson2;
opens xyz.zcraft.acgpicdownload.gui to javafx.base, javafx.controls, javafx.graphics, javafx.fxml;
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/xyz/zcraft/acgpicdownload/gui/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import io.github.palexdev.materialfx.enums.ScrimPriority;
import io.github.palexdev.materialfx.i18n.I18N;
import io.github.palexdev.materialfx.i18n.Language;
import io.github.palexdev.materialfx.theming.JavaFXThemes;
import io.github.palexdev.materialfx.theming.MaterialFXStylesheets;
import io.github.palexdev.materialfx.theming.UserAgentBuilder;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
Expand Down Expand Up @@ -136,6 +139,14 @@ public void start(Stage stage) throws Exception {
logger.setLevel(Level.ALL);
logger.info("Launching GUI");

UserAgentBuilder.builder()
.themes(JavaFXThemes.MODENA)
.themes(MaterialFXStylesheets.forAssemble(true))
.setDeploy(true)
.setResolveAssets(true)
.build()
.setGlobal();

setLanguage();
gui = this;
mainStage = stage;
Expand All @@ -159,7 +170,7 @@ public void start(Stage stage) throws Exception {

mainPaneController.init();

stage.setOnCloseRequest(windowEvent -> {
stage.setOnCloseRequest(_ -> {
stage.hide();
System.exit(0);
});
Expand Down Expand Up @@ -312,7 +323,7 @@ private void initWindow() {
.setContentText(ResourceBundleUtil.getString("gui.seriousERR") + "\n" + sw)
.setShowClose(true)
.setHeaderText(ResourceBundleUtil.getString("gui.fetch.err")).get();
content.addActions(Map.entry(new MFXButton("OK"), event -> System.exit(1)));
content.addActions(Map.entry(new MFXButton("OK"), _ -> System.exit(1)));
MFXGenericDialogBuilder.build(content)
.toStageDialogBuilder()
.initOwner(stage)
Expand All @@ -333,6 +344,7 @@ private void initWindow() {
}
}

@SuppressWarnings("unused")
public void reloadWindow() throws IOException {
mainPaneController.reload();
setLanguage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import io.github.palexdev.materialfx.controls.*;
import io.github.palexdev.materialfx.controls.cell.MFXTableRowCell;
import io.github.palexdev.materialfx.filter.StringFilter;
import io.github.palexdev.materialfx.font.MFXFontIcon;
import io.github.palexdev.materialfx.utils.StringUtils;
import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.animation.FadeTransition;
import javafx.application.Platform;
import javafx.collections.FXCollections;
Expand Down Expand Up @@ -48,8 +48,8 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.*;
import java.util.List;

public class FetchPaneController extends MyPane {
private final LinkedList<ArgumentPane<?>> arguments = new LinkedList<>();
Expand Down Expand Up @@ -146,7 +146,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
initTable();

fetchBtn.disableProperty().bind(sourcesComboBox.selectedIndexProperty().isEqualTo(-1));
data.addListener((ListChangeListener<DownloadResult>) c -> downloadBtn.setDisable(data.isEmpty()));
data.addListener((ListChangeListener<DownloadResult>) _ -> downloadBtn.setDisable(data.isEmpty()));

try {
ConfigManager.readConfig();
Expand All @@ -155,10 +155,10 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
Main.logError(e);
}

sourceUpdateBtn.setGraphic(new MFXFontIcon("mfx-sync"));
backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
delCompletedBtn.setGraphic(new MFXFontIcon("mfx-delete"));
selectDirBtn.setGraphic(new MFXFontIcon("mfx-folder"));
sourceUpdateBtn.setGraphic(new MFXFontIcon("fas-arrows-rotate"));
backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
delCompletedBtn.setGraphic(new MFXFontIcon("fas-trash"));
selectDirBtn.setGraphic(new MFXFontIcon("fas-folder"));
}

private void initTable() {
Expand All @@ -171,9 +171,9 @@ private void initTable() {
MFXTableColumn<DownloadResult> statusColumn = new MFXTableColumn<>(
ResourceBundleUtil.getString("gui.fetch.table.column.status"), true);

titleColumn.setRowCellFactory(arg0 -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getFileName()));
linkColumn.setRowCellFactory(arg0 -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getUrl()));
statusColumn.setRowCellFactory(arg0 -> new MFXTableRowCell<>(DownloadResult::getStatusString));
titleColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getFileName()));
linkColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getUrl()));
statusColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(DownloadResult::getStatusString));

titleColumn.setAlignment(Pos.CENTER);
linkColumn.setAlignment(Pos.CENTER);
Expand All @@ -198,21 +198,21 @@ private void initTable() {

dataTable.getSelectionModel().setAllowsMultipleSelection(false);
dataTable.getSelectionModel().selectionProperty()
.addListener((observableValue, integerDownloadResultObservableMap, t1) -> {
.addListener((_, _, _) -> {
List<DownloadResult> selectedValues = dataTable.getSelectionModel().getSelectedValues();
if (!selectedValues.isEmpty()) {
if (selectedValues.get(0).getStatus() == DownloadStatus.COMPLETED &&
if (selectedValues.getFirst().getStatus() == DownloadStatus.COMPLETED &&
ConfigManager.getConfig().getBooleanValue("fetchPLCOCopy")) {
try {
Desktop.getDesktop().open(new File(outputDirField.getText(),
selectedValues.get(0).getResult().getFileName()));
selectedValues.getFirst().getResult().getFileName()));
} catch (IOException e) {
Notice.showError(ResourceBundleUtil.getString("gui.fetch.table.cantOpen"),
gui.mainPane);
}
} else {
Toolkit.getDefaultToolkit().getSystemClipboard()
.setContents(new StringSelection(selectedValues.get(0).getResult().getUrl()), null);
.setContents(new StringSelection(selectedValues.getFirst().getResult().getUrl()), null);
dataTable.getSelectionModel().clearSelection();
Notice.showSuccess(ResourceBundleUtil.getString("gui.fetch.table.copy"), gui.mainPane);
}
Expand Down Expand Up @@ -247,7 +247,7 @@ public Source fromString(String s) {
SourceManager.readConfig();
sources.addAll(SourceManager.getSources());
} catch (JSONException | IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}

Expand Down Expand Up @@ -275,7 +275,7 @@ public void updateFromGithub() {
ft.setFromValue(1);
ft.setToValue(0);
ft.play();
ft.setOnFinished((e) -> loadingPane.setVisible(false));
ft.setOnFinished((_) -> loadingPane.setVisible(false));
}
}).start();
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public void handle(Exception e) {
ft.setFromValue(1);
ft.setToValue(0);
data.addAll(r);
ft.setOnFinished((e) -> loadingPane.setVisible(false));
ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
});

Expand Down Expand Up @@ -380,7 +380,7 @@ private void updateSource() {
Main.logError(e);
}
ft.play();
ft.setOnFinished((e) -> loadingPane.setVisible(false));
ft.setOnFinished((_) -> loadingPane.setVisible(false));
}).start();

ft.setFromValue(1);
Expand Down
Loading
Loading