Skip to content

Commit

Permalink
feat: Various enhancements
Browse files Browse the repository at this point in the history
- Renamed the tabs *Metadata* and *General Information* to *General Metadata* and *File Metadata*.
- Fixed the section naming in the *Metadata* tab.
- Generate icons as part of the maven build. One has to enable this via uncommenting the relevant lines in the `pom.xml`.
- The Windows Executable should now have an icon.
- Fixed some SonarLint findings.
- There is no cancel button anymore to cancel the validation. The button wasn't really doing anything.
- Updated dependencies
  • Loading branch information
Wandmalfarbe authored Nov 18, 2023
1 parent 0b94d6e commit 20fc1c4
Show file tree
Hide file tree
Showing 41 changed files with 192 additions and 115 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project are documented in this file. On the [releases page](https://github.com/Wandmalfarbe/EPUBCheckFX/releases) you can see all released versions of EPUBCheckFX and download the [latest version](https://github.com/Wandmalfarbe/EPUBCheckFX/releases/latest).

## [1.3.0] - 2023-11-18

- Renamed the tabs *Metadata* and *General Information* to *General Metadata* and *File Metadata*.
- Fixed the section naming in the *Metadata* tab.
- Generate icons as part of the maven build. One has to enable this via uncommenting the relevant lines in the `pom.xml`.
- The Windows Executable should now have an icon.
- Fixed some SonarLint findings.
- There is no cancel button anymore to cancel the validation. The button wasn't really doing anything.
- Updated dependencies

## [1.2.0] - 2023-10-05

- Add the following export formats:
Expand Down Expand Up @@ -34,6 +44,7 @@ All notable changes to this project are documented in this file. On the [release

Initial release with different executables for Windows, macOS and Linux.

[1.3.0]: https://github.com/Wandmalfarbe/EPUBCheckFX/compare/v1.2.0...1.3.0
[1.2.0]: https://github.com/Wandmalfarbe/EPUBCheckFX/compare/v1.1.0...1.2.0
[1.1.0]: https://github.com/Wandmalfarbe/EPUBCheckFX/compare/v1.0.0...1.1.0
[1.0.0]: https://github.com/Wandmalfarbe/EPUBCheckFX/releases/tag/v1.0.0
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# EPUBCheckFX

An unofficial graphical interface for the official [W3C EPUBCheck](https://www.w3.org/publishing/epubcheck/) conformance checker.
A graphical interface for the official [W3C EPUBCheck](https://www.w3.org/publishing/epubcheck/) conformance checker.

## Screenshots

Expand Down Expand Up @@ -59,7 +59,6 @@ mvn clean package
## Known Issues / Bugs
- The App is only translated in English and German.
- It is not really possible to cancel the validation despite there being a cancel button. The button just closes the progress overlay but the validation still continues.
- It is not possible to select an EPUB folder with the button on the start page. One can however drag an EPUB folder on the window to validate it.
## Credits
Expand Down
42 changes: 36 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.pascalwagler</groupId>
<artifactId>epubcheckfx</artifactId>
<version>1.2.0</version>
<version>1.3.0</version>

<name>EPUBCheckFX</name>
<description>A graphical interface for EPUBCheck.</description>
Expand All @@ -19,7 +19,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

<openjfx.version>20</openjfx.version>
<openjfx.version>21.0.1</openjfx.version>
<ikonli.version>12.3.1</ikonli.version>

<main.class>de.pascalwagler.epubcheckfx.App</main.class>
Expand Down Expand Up @@ -195,13 +195,13 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.9</version>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>com.github.Dansoftowner</groupId>
Expand Down Expand Up @@ -238,7 +238,7 @@
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
<version>0.9.10</version>
<version>0.9.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -320,6 +320,36 @@
</executions>
</plugin>

<!-- create icons via shell script -->
<!-- This can only run with bash and ImageMagick installed, so it is disabled to enable a build on all platforms. -->
<!--<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>create-icons</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./tools/create-icons.sh</executable>
</configuration>
</execution>
<execution>
<id>create-java-icons</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./tools/create-java-icons.sh</executable>
</configuration>
</execution>
</executions>
</plugin>-->

<!-- create windows executable -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
Expand All @@ -342,7 +372,7 @@
</plugin>

<!-- create macOS app and disk image -->
<!-- This plugin can only be run on macOS, so it is disabled for now. -->
<!-- This plugin can only be run on macOS, so it is disabled to enable a build on all platforms. -->
<!--<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
Expand Down
Binary file modified src/main/assembly/dist-macos/EPUBCheckFX.icns
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/main/assembly/dist-windows/EPUBCheckFX.ico
Binary file not shown.
10 changes: 5 additions & 5 deletions src/main/assembly/dist-windows/launch4j-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<downloadUrl>https://adoptium.net/</downloadUrl>
<stayAlive>true</stayAlive>
<restartOnCrash>false</restartOnCrash>
<!--<icon>icon.ico</icon>-->
<icon>EPUBCheckFX.ico</icon>
<singleInstance>
<mutexName>de.pascalwagler.epubcheckfx</mutexName>
<windowTitle>EPUBCheckFX</windowTitle>
Expand All @@ -25,10 +25,10 @@
<opt>-Xss1024k</opt>
</jre>
<versionInfo>
<fileVersion>1.2.0.0</fileVersion>
<txtFileVersion>1.2.0</txtFileVersion>
<productVersion>1.2.0.0</productVersion>
<txtProductVersion>1.2.0</txtProductVersion>
<fileVersion>1.3.0.0</fileVersion>
<txtFileVersion>1.3.0</txtFileVersion>
<productVersion>1.3.0.0</productVersion>
<txtProductVersion>1.3.0</txtProductVersion>

<fileDescription>EPUBCheckFX</fileDescription>
<copyright>Pascal Wagler</copyright>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/de/pascalwagler/epubcheckfx/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ public static void main(String[] args) {

public static final Preferences userPreferences = Preferences.userNodeForPackage(App.class);

private static final String VERSION = "1.2.0";
private static final String VERSION = "1.3.0";

public static final String PREFERENCES_VERSION = "version";
public static final String PREFERENCES_SEVERITY = "severity";
public static final String PREFERENCES_EXPORT_FORMAT = "export_format";
public static final String PREFERENCES_EPUB_PROFILE = "epub_profile";
public static final String PREFERENCES_THEME = "theme";
public static final String PREFERENCES_VIEW = "view";
public static final String PREFERENCES_VIEW_VALUE_TABLE = "table";
public static final String PREFERENCES_VIEW_VALUE_LIST = "list";

@Override
public void start(Stage stage) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.pascalwagler.epubcheckfx.exception;

public class CreateTempDirException extends RuntimeException {
public CreateTempDirException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.pascalwagler.epubcheckfx.exception;

public class ReadLicenseFileException extends RuntimeException {
public ReadLicenseFileException(String message, Throwable cause) {
super(message, cause);
}
}
46 changes: 22 additions & 24 deletions src/main/java/de/pascalwagler/epubcheckfx/service/CustomReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CustomReport implements Report {

@Override
public void initialize() {

// There is no initialization to be performed.
}

@Override
Expand All @@ -34,23 +34,21 @@ public void message(MessageId messageId, EPUBLocation epubLocation, Object... ob
String formattedMessage = String.format(localizedMessage, objects);
Severity severity = localizedMessages.getMessage(messageId).getSeverity();

Platform.runLater(() -> {
errorList.add(CheckMessage.builder()
.messageId(messageId)
.message(formattedMessage)
.severity(de.pascalwagler.epubcheckfx.model.Severity.fromEpubcheckSeverity(severity))
.suggestion(localizedMessages.getSuggestion(messageId))
.path(epubLocation.path)
.line(epubLocation.line != -1 ? epubLocation.line : null)
.column(epubLocation.column != -1 ? epubLocation.column : null)
.objects(objects)
.build());
});
Platform.runLater(() -> errorList.add(CheckMessage.builder()
.messageId(messageId)
.message(formattedMessage)
.severity(de.pascalwagler.epubcheckfx.model.Severity.fromEpubcheckSeverity(severity))
.suggestion(localizedMessages.getSuggestion(messageId))
.path(epubLocation.path)
.line(epubLocation.line != -1 ? epubLocation.line : null)
.column(epubLocation.column != -1 ? epubLocation.column : null)
.objects(objects)
.build()));
}

@Override
public void message(Message message, EPUBLocation epubLocation, Object... objects) {

// I don't really know what this callback does. the message callback above seems to suffice.
}

@Override
Expand All @@ -65,35 +63,35 @@ public void info(String resource, FeatureEnum feature, String value) {
@Override
public int getErrorCount() {
return (int) errorList.stream()
.filter(checkMessage -> Severity.ERROR.equals(checkMessage.getSeverity()))
.filter(checkMessage -> Severity.ERROR.equals(checkMessage.getSeverity().getEbubcheckSeverity()))
.count();
}

@Override
public int getWarningCount() {
return (int) errorList.stream()
.filter(checkMessage -> Severity.WARNING.equals(checkMessage.getSeverity()))
.filter(checkMessage -> Severity.WARNING.equals(checkMessage.getSeverity().getEbubcheckSeverity()))
.count();
}

@Override
public int getFatalErrorCount() {
return (int) errorList.stream()
.filter(checkMessage -> Severity.FATAL.equals(checkMessage.getSeverity()))
.filter(checkMessage -> Severity.FATAL.equals(checkMessage.getSeverity().getEbubcheckSeverity()))
.count();
}

@Override
public int getInfoCount() {
return (int) errorList.stream()
.filter(checkMessage -> Severity.INFO.equals(checkMessage.getSeverity()))
.filter(checkMessage -> Severity.INFO.equals(checkMessage.getSeverity().getEbubcheckSeverity()))
.count();
}

@Override
public int getUsageCount() {
return (int) errorList.stream()
.filter(checkMessage -> Severity.ERROR.equals(checkMessage.getSeverity()))
.filter(checkMessage -> Severity.ERROR.equals(checkMessage.getSeverity().getEbubcheckSeverity()))
.count();
}

Expand All @@ -104,7 +102,7 @@ public int generate() {

@Override
public void setEpubFileName(String s) {

// Unnecessary for current report generation
}

@Override
Expand All @@ -114,7 +112,7 @@ public String getEpubFileName() {

@Override
public void setCustomMessageFile(String s) {

// Unnecessary for current report generation
}

@Override
Expand All @@ -129,17 +127,17 @@ public int getReportingLevel() {

@Override
public void setReportingLevel(int i) {

// Unnecessary for current report generation
}

@Override
public void close() {

// Unnecessary for current report generation
}

@Override
public void setOverrideFile(File file) {

// Unnecessary for current report generation
}

@Override
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/de/pascalwagler/epubcheckfx/ui/BindingUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.function.Function;

import static java.util.stream.Collectors.toList;

/**
* From https://stackoverflow.com/a/43914715
* From <a href="https://stackoverflow.com/a/43914715">Stackoverflow</a>
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class BindingUtil {

public static <E, F> void mapContent(ObservableList<F> mapped, ObservableList<? extends E> source,
Expand Down Expand Up @@ -76,8 +79,7 @@ public boolean equals(Object obj) {

if (obj instanceof ListContentMapping) {
final ListContentMapping<?, ?> other = (ListContentMapping<?, ?>) obj;
final List<?> mapped2 = other.mapped;
return mapped1 == mapped2;
return mapped1 == other.mapped;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ public class PreferencesUtil {
* Restores the last selected value of the comboBox from Preferences or applies a defaultValue.
* This method also adds a Listener to save the last selected value in the Preferences under preferencesKey.
*/
public static <SomeComboBox extends javafx.scene.control.ComboBox<SomeEnum>, SomeEnum extends Enum<?>> void syncWithPreferences(
SomeComboBox someComboBox, SomeEnum defaultValue, String preferencesKey) {
public static <C extends javafx.scene.control.ComboBox<E>, E extends Enum<?>> void syncWithPreferences(
C someComboBox, E defaultValue, String preferencesKey) {

// select the previously saved option (or the default value)
String selectedSeverity = App.userPreferences.get(preferencesKey, defaultValue.name());
SomeEnum selected = (SomeEnum) SomeEnum.valueOf(defaultValue.getClass(), selectedSeverity);
@SuppressWarnings("unchecked")
E selected = (E) E.valueOf(defaultValue.getClass(), selectedSeverity);
someComboBox.getSelectionModel().select(selected);

// save selection in preferences
Expand Down
Loading

0 comments on commit 20fc1c4

Please sign in to comment.