Skip to content

Commit

Permalink
feat: various features and enhancements (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandmalfarbe authored Oct 8, 2023
1 parent f43058e commit 0b94d6e
Show file tree
Hide file tree
Showing 55 changed files with 2,236 additions and 241 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

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.2.0] - 2023-10-05

- Add the following export formats:
- AsciiDoc
- reStructuredText
- Textile
- CSV (Comma-separated values)
- TSV (Tab-separated values)
- Remove the export format *Markdown (Table)*.
- Remove the additional extracted features from all export formats.
- The ComboBox for the export formats now displays the file extensions of all the formats.
- Don't show empty line numbers when exporting to *plaintext* and *pagina EPUB-Checker Text*.
- Don't HTML encode anything when exporting to *plaintext* and *pagina EPUB-Checker Text*.
- Reports are fully translated.
- Add a menubar where it is possible to change the theme, open links to the project website, or open the about screen.
- Add an About screen that displays copyright information, license information and third-party licenses.
- Add persistence to the `ComboBoxes` for the EPUB profile, the severity filter and the export format.
They will remember the last selected value even when the application is closed.
- Add the view modes *table* and *list* for the validation results. The view mode will be remembered even
when the application is closed.

## [1.1.0] - 2023-09-04

- Add a toolbar with a new button to open folders.
Expand All @@ -13,5 +34,6 @@ 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.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
Binary file modified img/EPUBCheckFX-Screenshot-Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/EPUBCheckFX-Screenshot-Light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.pascalwagler</groupId>
<artifactId>epubcheckfx</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>

<name>EPUBCheckFX</name>
<description>A graphical interface for EPUBCheck.</description>
Expand All @@ -22,7 +22,7 @@
<openjfx.version>20</openjfx.version>
<ikonli.version>12.3.1</ikonli.version>

<main.class>de.pascalwagler.epubcheckfx.ui.App</main.class>
<main.class>de.pascalwagler.epubcheckfx.App</main.class>

<project.assembly.sourceDir>${project.basedir}/src/main/assembly</project.assembly.sourceDir>
<project.notRunnableJar.name>${project.name}-${project.version}-not-runnable.jar</project.notRunnableJar.name>
Expand Down Expand Up @@ -233,11 +233,18 @@
<artifactId>ikonli-javafx</artifactId>
<version>${ikonli.version}</version>
</dependency>

<!-- for export formats -->
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.10.0</version>
</dependency>
</dependencies>

<build>
Expand Down
8 changes: 4 additions & 4 deletions src/main/assembly/dist-windows/launch4j-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<opt>-Xss1024k</opt>
</jre>
<versionInfo>
<fileVersion>1.1.0.0</fileVersion>
<txtFileVersion>1.1.0</txtFileVersion>
<productVersion>1.1.0.0</productVersion>
<txtProductVersion>1.1.0</txtProductVersion>
<fileVersion>1.2.0.0</fileVersion>
<txtFileVersion>1.2.0</txtFileVersion>
<productVersion>1.2.0.0</productVersion>
<txtProductVersion>1.2.0</txtProductVersion>

<fileDescription>EPUBCheckFX</fileDescription>
<copyright>Pascal Wagler</copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package de.pascalwagler.epubcheckfx.ui;
package de.pascalwagler.epubcheckfx;

import atlantafx.base.theme.PrimerDark;
import atlantafx.base.theme.PrimerLight;
import com.jthemedetecor.OsThemeDetector;
import de.pascalwagler.epubcheckfx.model.Theme;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
Expand All @@ -12,9 +11,12 @@
import javafx.stage.Stage;
import lombok.extern.slf4j.Slf4j;

import java.awt.*;
import java.awt.Taskbar;
import java.awt.Toolkit;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;

@Slf4j
public class App extends Application {
Expand All @@ -23,27 +25,53 @@ public static void main(String[] args) {
Application.launch(args);
}

private final OsThemeDetector detector = OsThemeDetector.getDetector();
private static final OsThemeDetector detector = OsThemeDetector.getDetector();
private static Theme currentTheme;

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

private static final String VERSION = "1.2.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";

@Override
public void start(Stage stage) throws Exception {

log.info("Java Version: " + System.getProperty("java.version"));
log.info("JavaFX Version: " + System.getProperty("javafx.version"));

clearPreferencesWhenChangedVersion();

ResourceBundle bundle = ResourceBundle.getBundle("i18n.LangBundle", Locale.getDefault());
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/MainWindow.fxml"), bundle);
Parent root = loader.load();
Scene scene = new Scene(root);

applyTheme(scene);
initStyles(scene);
applyIcon(stage);

stage.setTitle(bundle.getString("app.name"));
stage.setScene(scene);
stage.show();
}

/**
* Just delete all the preferences when a new (or old) version is run for the first time.
* There are no preferences migrations.
*/
private static void clearPreferencesWhenChangedVersion() throws BackingStoreException {
String version = userPreferences.get(PREFERENCES_VERSION, VERSION);
if (!version.equals(VERSION)) {
userPreferences.clear();
}
userPreferences.put(PREFERENCES_VERSION, VERSION);
}

private void applyIcon(Stage stage) {

// app icons
Expand All @@ -68,25 +96,25 @@ private void applyIcon(Stage stage) {
}
}

private void applyTheme(Scene scene) {
private void initStyles(Scene scene) {

String selectedThemeFromPreferences = App.userPreferences.get(PREFERENCES_THEME, Theme.PRIMER.name());
setTheme(Theme.valueOf(selectedThemeFromPreferences));
detector.registerListener(isDark -> Platform.runLater(() -> setTheme(currentTheme)));

scene.getStylesheets().add("/css/style.css");
}

public static void setTheme(Theme theme) {
App.currentTheme = theme;
App.userPreferences.put(PREFERENCES_THEME, theme.name());

// The theme detection code currently logs a NullPointerException
// (see https://github.com/Dansoftowner/jSystemThemeDetector/issues/18).

if (detector.isDark()) {
Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
Application.setUserAgentStylesheet(App.currentTheme.getAtlantaFxDarkTheme().getUserAgentStylesheet());
} else {
Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
Application.setUserAgentStylesheet(App.currentTheme.getAtlantaFxLightTheme().getUserAgentStylesheet());
}

detector.registerListener(isDark -> Platform.runLater(() -> {
if (Boolean.TRUE.equals(isDark)) {
Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
} else {
Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
}
}));

scene.getStylesheets().add("/css/style.css");
}
}
10 changes: 4 additions & 6 deletions src/main/java/de/pascalwagler/epubcheckfx/model/EpubProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@
import de.pascalwagler.epubcheckfx.ui.Translatable;
import lombok.Getter;

@Getter
public enum EpubProfile implements Translatable {
DEFAULT("epub_profile.default", EPUBProfile.DEFAULT),
IDX("epub_profile.idx", EPUBProfile.IDX),
DICT("epub_profile.dict", EPUBProfile.DICT),
EDUPUB("epub_profile.edupub", EPUBProfile.EDUPUB),
PREVIEW("epub_profile.preview", EPUBProfile.PREVIEW);

EpubProfile(String i18nKey, EPUBProfile epubProfile) {
EpubProfile(String i18nKey, EPUBProfile epubcheckEpubProfile) {
this.i18nKey = i18nKey;
this.epubProfile = epubProfile;
this.epubcheckEpubProfile = epubcheckEpubProfile;
}

@Getter
private final String i18nKey;

@Getter
private final EPUBProfile epubProfile;
private final EPUBProfile epubcheckEpubProfile;
}
33 changes: 22 additions & 11 deletions src/main/java/de/pascalwagler/epubcheckfx/model/ExportFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,34 @@
import de.pascalwagler.epubcheckfx.ui.Translatable;
import lombok.Getter;

@Getter
public enum ExportFormat implements Translatable {
HTML("html", "html", "export_format.html"),
MARKDOWN("markdown", "md", "export_format.markdown"),
MARKDOWN_LIST("markdown-list", "md", "export_format.markdown_list"),
PLAINTEXT("plaintext", "txt", "export_format.plaintext"),
EPUB_CHECKER_TXT("epub-checker-txt", "txt", "export_format.epub-checker-txt");
HTML("html",
new String[]{"html", "htm"}, "export_format.html"),
MARKDOWN("markdown",
new String[]{"md", "markdown"}, "export_format.markdown"),
ASCIIDOC("asciidoc",
new String[]{"adoc", "asciidoc", "txt"}, "export_format.asciidoc"),
RESTRUCTUREDTEXT("restructuredtext",
new String[]{"rst"}, "export_format.restructuredtext"),
TEXTILE("textile",
new String[]{"textile"}, "export_format.textile"),
PLAINTEXT("plaintext",
new String[]{"txt"}, "export_format.plaintext"),
EPUB_CHECKER_TXT("epub-checker-txt",
new String[]{"txt"}, "export_format.epub-checker-txt"),
CSV("comma-separated-values",
new String[]{"csv"}, "export_format.csv"),
TSV("tab-separated-values",
new String[]{"tsv", "tab"}, "export_format.tsv");

ExportFormat(String name, String extension, String i18nKey) {
ExportFormat(String name, String[] extensions, String i18nKey) {
this.name = name;
this.extension = extension;
this.extensions = extensions;
this.i18nKey = i18nKey;
}

@Getter
private final String name;
@Getter
private final String extension;
@Getter
private final String[] extensions;
private final String i18nKey;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package de.pascalwagler.epubcheckfx.model;

import lombok.Builder;
import lombok.Data;

@Builder
@Data
public class ReportMetadata {
private String language;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.pascalwagler.epubcheckfx.model;

import lombok.Builder;
import lombok.Data;

@Builder
@Data
public class ReportTranslatedStrings {
private String headingReport;
private String headingValidationResults;

private String messageId;
private String severity;
private String message;
private String path;
private String line;
private String column;
}
6 changes: 0 additions & 6 deletions src/main/java/de/pascalwagler/epubcheckfx/model/Severity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@

@Getter
public enum Severity implements Translatable {

SUPPRESSED(com.adobe.epubcheck.messages.Severity.SUPPRESSED, Material2OutlinedAL.DO_NOT_DISTURB_ALT, "color-suppressed", "severity.suppressed"),

USAGE(com.adobe.epubcheck.messages.Severity.USAGE, Material2OutlinedAL.ADJUST, "color-usage", "severity.usage"),

INFO(com.adobe.epubcheck.messages.Severity.INFO, Material2OutlinedAL.INFO, "color-info", "severity.info"),

WARNING(com.adobe.epubcheck.messages.Severity.WARNING, Material2OutlinedAL.ERROR_OUTLINE, "color-warning", "severity.warning"),

ERROR(com.adobe.epubcheck.messages.Severity.ERROR, Material2OutlinedAL.ERROR_OUTLINE, "color-error", "severity.error"),

FATAL(com.adobe.epubcheck.messages.Severity.FATAL, Material2OutlinedAL.ERROR, "color-fatal", "severity.fatal");

Severity(com.adobe.epubcheck.messages.Severity ebubcheckSeverity, Ikon icon, String colorStyleClass, String i18nKey) {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/de/pascalwagler/epubcheckfx/model/Theme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.pascalwagler.epubcheckfx.model;

import atlantafx.base.theme.CupertinoDark;
import atlantafx.base.theme.CupertinoLight;
import atlantafx.base.theme.Dracula;
import atlantafx.base.theme.NordDark;
import atlantafx.base.theme.NordLight;
import atlantafx.base.theme.PrimerDark;
import atlantafx.base.theme.PrimerLight;
import de.pascalwagler.epubcheckfx.ui.Translatable;
import lombok.Getter;

@Getter
public enum Theme implements Translatable {
PRIMER(new PrimerLight(), new PrimerDark(), "menu.view.theme.primer"),
NORD(new NordLight(), new NordDark(), "menu.view.theme.nord"),
CUPERTINO(new CupertinoLight(), new CupertinoDark(), "menu.view.theme.cupertino"),
DRACULA(new Dracula(), new Dracula(), "menu.view.theme.dracula");

Theme(atlantafx.base.theme.Theme atlantaFxLightTheme, atlantafx.base.theme.Theme atlantaFxDarkTheme, String i18nKey) {
this.atlantaFxLightTheme = atlantaFxLightTheme;
this.atlantaFxDarkTheme = atlantaFxDarkTheme;
this.i18nKey = i18nKey;
}

private final atlantafx.base.theme.Theme atlantaFxLightTheme;
private final atlantafx.base.theme.Theme atlantaFxDarkTheme;
private final String i18nKey;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package de.pascalwagler.epubcheckfx.service;

import de.pascalwagler.epubcheckfx.model.CheckMessage;

public class CheckMessageMapper {
private CheckMessageMapper() {
}

public static String[] toStringArray(CheckMessage checkMessage) {
return new String[]{
checkMessage.getMessageId().toString(),
checkMessage.getSeverity().toString(),
checkMessage.getMessage(),
checkMessage.getPath(),
checkMessage.getLine() == null ? "" : String.valueOf(checkMessage.getLine()),
checkMessage.getColumn() == null ? "" : String.valueOf(checkMessage.getColumn())
};
}
}
Loading

0 comments on commit 0b94d6e

Please sign in to comment.