Reworks default tools, moves some files
This commit is contained in:
1 parent
df58cf4585
commit
c58a8b0588
132 files changed
+600
-257
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.main;
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Controller for the main view
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.main;
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Model for the main view
|
||||
@@ -4,7 +4,6 @@
|
||||
module com.github.gtache.autosubtitle.gui.api {
|
||||
requires transitive com.github.gtache.autosubtitle.api;
|
||||
exports com.github.gtache.autosubtitle.gui;
|
||||
exports com.github.gtache.autosubtitle.gui.main;
|
||||
exports com.github.gtache.autosubtitle.gui.media;
|
||||
exports com.github.gtache.autosubtitle.gui.parameters;
|
||||
exports com.github.gtache.autosubtitle.gui.setup;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.parameters.impl.spi;
|
||||
|
||||
import java.util.spi.ResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.parameters.impl.spi;
|
||||
|
||||
import java.util.spi.AbstractResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.setup.impl.spi;
|
||||
|
||||
import java.util.spi.ResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.setup.impl.spi;
|
||||
|
||||
import java.util.spi.AbstractResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.subtitles.impl.spi;
|
||||
|
||||
import java.util.spi.ResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.subtitles.impl.spi;
|
||||
|
||||
import java.util.spi.AbstractResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.work.impl.spi;
|
||||
|
||||
import java.util.spi.ResourceBundleProvider;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
package com.github.gtache.autosubtitle.gui.work.impl.spi;
|
||||
|
||||
import java.util.spi.AbstractResourceBundleProvider;
|
||||
|
||||
+14
-15
@@ -20,32 +20,31 @@ public final class GuiCoreModule {
|
||||
@Provides
|
||||
static ResourceBundle providesBundle() {
|
||||
return new CombinedResourceBundle(ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.impl.MainBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.impl.SetupBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.impl.WorkBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.impl.ParametersBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.impl.SubtitlesBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.impl.MediaBundle"));
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.setup.impl.SetupBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.work.impl.WorkBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.parameters.impl.ParametersBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.subtitles.impl.SubtitlesBundle"),
|
||||
ResourceBundle.getBundle("com.github.gtache.autosubtitle.gui.media.impl.MediaBundle"));
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Play
|
||||
static byte[] providesPlayImage() {
|
||||
try (final var in = GuiCoreModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/impl/play_64.png")) {
|
||||
if (in == null) {
|
||||
throw new UncheckedIOException(new IOException("Resource not found : /com/github/gtache/autosubtitle/gui/impl/play_64.png"));
|
||||
}
|
||||
return in.readAllBytes();
|
||||
} catch (final IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
final var path = "/com/github/gtache/autosubtitle/gui/media/impl/play_64.png";
|
||||
return readResource(path);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Pause
|
||||
static byte[] providesPauseImage() {
|
||||
try (final var in = GuiCoreModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/impl/pause_64.png")) {
|
||||
final var path = "/com/github/gtache/autosubtitle/gui/media/impl/pause_64.png";
|
||||
return readResource(path);
|
||||
}
|
||||
|
||||
private static byte[] readResource(final String path) {
|
||||
try (final var in = GuiCoreModule.class.getResourceAsStream(path)) {
|
||||
if (in == null) {
|
||||
throw new UncheckedIOException(new IOException("Resource not found : /com/github/gtache/autosubtitle/gui/impl/pause_64.png"));
|
||||
throw new UncheckedIOException(new IOException("Resource not found : " + path));
|
||||
}
|
||||
return in.readAllBytes();
|
||||
} catch (final IOException e) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.gtache.autosubtitle.modules.gui.impl;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.gtache.autosubtitle.modules.gui.impl;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.MainBundleProvider;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.MainBundleProviderImpl;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.ParametersBundleProvider;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.ParametersBundleProviderImpl;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.SetupBundleProvider;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.SetupBundleProviderImpl;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.WorkBundleProvider;
|
||||
import com.github.gtache.autosubtitle.gui.impl.spi.WorkBundleProviderImpl;
|
||||
|
||||
/**
|
||||
* Core gui module for autosubtitle
|
||||
*/
|
||||
@@ -14,12 +5,13 @@ module com.github.gtache.autosubtitle.gui.core {
|
||||
requires transitive com.github.gtache.autosubtitle.gui.api;
|
||||
requires transitive com.github.gtache.autosubtitle.core;
|
||||
requires org.apache.logging.log4j;
|
||||
|
||||
exports com.github.gtache.autosubtitle.gui.impl;
|
||||
exports com.github.gtache.autosubtitle.gui.impl.spi;
|
||||
exports com.github.gtache.autosubtitle.gui.parameters.impl.spi;
|
||||
exports com.github.gtache.autosubtitle.gui.setup.impl.spi;
|
||||
exports com.github.gtache.autosubtitle.gui.subtitles.impl.spi;
|
||||
exports com.github.gtache.autosubtitle.gui.work.impl.spi;
|
||||
|
||||
exports com.github.gtache.autosubtitle.modules.gui.impl;
|
||||
|
||||
provides MainBundleProvider with MainBundleProviderImpl;
|
||||
provides ParametersBundleProvider with ParametersBundleProviderImpl;
|
||||
provides SetupBundleProvider with SetupBundleProviderImpl;
|
||||
provides WorkBundleProvider with WorkBundleProviderImpl;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-3
@@ -1,7 +1,6 @@
|
||||
package com.github.gtache.autosubtitle.gui.main.fx;
|
||||
package com.github.gtache.autosubtitle.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.fx.AbstractFXController;
|
||||
import com.github.gtache.autosubtitle.gui.main.MainController;
|
||||
import com.github.gtache.autosubtitle.gui.MainController;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.stage.Window;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.github.gtache.autosubtitle.gui.main.fx;
|
||||
package com.github.gtache.autosubtitle.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.main.MainModel;
|
||||
import com.github.gtache.autosubtitle.gui.MainModel;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.github.gtache.autosubtitle.gui.media.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.fx.FXBinder;
|
||||
import com.github.gtache.autosubtitle.gui.work.fx.FXWorkModel;
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -7,6 +7,10 @@ import com.github.gtache.autosubtitle.modules.gui.impl.Pause;
|
||||
import com.github.gtache.autosubtitle.modules.gui.impl.Play;
|
||||
import com.github.gtache.autosubtitle.subtitle.Subtitle;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.SubtitleLabel;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.fxml.FXML;
|
||||
@@ -29,8 +33,6 @@ import javafx.util.Duration;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -3,14 +3,15 @@ package com.github.gtache.autosubtitle.gui.media.fx;
|
||||
import com.github.gtache.autosubtitle.Video;
|
||||
import com.github.gtache.autosubtitle.gui.media.MediaModel;
|
||||
import com.github.gtache.autosubtitle.subtitle.EditableSubtitle;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* FX implementation of {@link MediaModel}
|
||||
*/
|
||||
|
||||
+4
-2
@@ -4,6 +4,10 @@ import com.github.gtache.autosubtitle.gui.fx.AbstractFXController;
|
||||
import com.github.gtache.autosubtitle.gui.parameters.ParametersController;
|
||||
import com.github.gtache.autosubtitle.subtitle.OutputFormat;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModel;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TextField;
|
||||
@@ -15,8 +19,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.controlsfx.control.PrefixSelectionComboBox;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.prefs.BackingStoreException;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
+4
-2
@@ -10,6 +10,10 @@ import com.github.gtache.autosubtitle.subtitle.OutputFormat;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModel;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModelProvider;
|
||||
import com.github.gtache.autosubtitle.subtitle.impl.FontImpl;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
@@ -23,8 +27,6 @@ import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.ObservableMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FXSetupModel implements SetupModel {
|
||||
|
||||
@Inject
|
||||
FXSetupModel(final Map<ToolType, Map<String, SetupManager>> setupManagers,
|
||||
final Map<ToolType, SetupManager> defaultManagers) {
|
||||
final Map<ToolType, String> defaultTools) {
|
||||
final var tmpAvailableSetupManagers = FXCollections.<ToolType, ObservableList<SetupManager>>observableHashMap();
|
||||
final var tmpSelectedTools = FXCollections.<ToolType, StringProperty>observableHashMap();
|
||||
final var tmpSelectedSetupManagers = FXCollections.<ToolType, ObjectProperty<SetupManager>>observableHashMap();
|
||||
@@ -47,13 +47,22 @@ public class FXSetupModel implements SetupModel {
|
||||
final var tmpSetupEditables = FXCollections.<ToolType, ReadOnlyBooleanWrapper>observableHashMap();
|
||||
setupManagers.forEach((type, managers) -> {
|
||||
tmpAvailableSetupManagers.put(type, getUnmodifiableObservableList(managers.values()));
|
||||
tmpSelectedTools.put(type, new SimpleStringProperty(getKeyForValue(managers, defaultManagers.get(type))));
|
||||
tmpSelectedTools.put(type, new SimpleStringProperty(defaultTools.get(type)));
|
||||
tmpSelectedSetupManagers.put(type, new SimpleObjectProperty<>());
|
||||
tmpSetupStatuses.put(type, new SimpleObjectProperty<>(SetupStatus.ERRORED));
|
||||
tmpSetupProgresses.put(type, new SimpleDoubleProperty(-2));
|
||||
tmpSetupProgressLabels.put(type, new SimpleStringProperty(""));
|
||||
tmpSetupEditables.put(type, new ReadOnlyBooleanWrapper(false));
|
||||
});
|
||||
for (final var value : ToolType.values()) {
|
||||
tmpAvailableSetupManagers.computeIfAbsent(value, t -> FXCollections.emptyObservableList());
|
||||
tmpSelectedTools.computeIfAbsent(value, t -> new SimpleStringProperty());
|
||||
tmpSelectedSetupManagers.computeIfAbsent(value, t -> new SimpleObjectProperty<>());
|
||||
tmpSetupStatuses.computeIfAbsent(value, t -> new SimpleObjectProperty<>(SetupStatus.ERRORED));
|
||||
tmpSetupProgresses.computeIfAbsent(value, t -> new SimpleDoubleProperty(-2));
|
||||
tmpSetupProgressLabels.computeIfAbsent(value, t -> new SimpleStringProperty(""));
|
||||
tmpSetupEditables.computeIfAbsent(value, t -> new ReadOnlyBooleanWrapper(false));
|
||||
}
|
||||
this.availableSetupManagers = FXCollections.unmodifiableObservableMap(tmpAvailableSetupManagers);
|
||||
this.selectedTools = FXCollections.unmodifiableObservableMap(tmpSelectedTools);
|
||||
this.selectedSetupManagers = FXCollections.unmodifiableObservableMap(tmpSelectedSetupManagers);
|
||||
@@ -66,12 +75,12 @@ public class FXSetupModel implements SetupModel {
|
||||
{
|
||||
setupStatuses.get(type).set(newValue == null ? SetupStatus.ERRORED : newValue.status());
|
||||
selectedTools.get(type).set(newValue == null ?
|
||||
getKeyForValue(setupManagers.get(type), defaultManagers.get(type)) :
|
||||
defaultTools.get(type) :
|
||||
getKeyForValue(setupManagers.get(type), newValue));
|
||||
}));
|
||||
selectedTools.forEach((type, value) -> value.addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
final var manager = setupManagers.get(type).get(newValue);
|
||||
final var manager = setupManagers.getOrDefault(type, Map.of()).get(newValue);
|
||||
if (manager != null) {
|
||||
setSelectedSetupManager(type, manager);
|
||||
}
|
||||
@@ -80,7 +89,7 @@ public class FXSetupModel implements SetupModel {
|
||||
|
||||
setupInProgress.forEach((type, value) -> value.bind(setupProgresses.get(type).greaterThan(-2)));
|
||||
|
||||
defaultManagers.forEach(this::setSelectedSetupManager);
|
||||
defaultTools.forEach((type, value) -> setSelectedSetupManager(type, setupManagers.getOrDefault(type, Map.of()).get(value)));
|
||||
}
|
||||
|
||||
private static String getKeyForValue(final Map<String, ? extends SetupManager> managers, final SetupManager manager) {
|
||||
|
||||
+2
-1
@@ -12,11 +12,12 @@ import com.github.gtache.autosubtitle.subtitle.converter.impl.ParseOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.ObservableSubtitleCollectionImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.impl.ExportOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.impl.ImportOptionsImpl;
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -10,6 +10,10 @@ import com.github.gtache.autosubtitle.subtitle.converter.ParseException;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.ObservableSubtitleCollectionImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.ObservableSubtitleImpl;
|
||||
import com.github.gtache.autosubtitle.translation.TranslationException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
@@ -34,8 +38,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.controlsfx.control.PrefixSelectionComboBox;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.github.gtache.autosubtitle.gui.subtitles.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.Language;
|
||||
import com.github.gtache.autosubtitle.ToolType;
|
||||
import com.github.gtache.autosubtitle.gui.subtitles.SubtitlesModel;
|
||||
import com.github.gtache.autosubtitle.subtitle.ExportOptions;
|
||||
import com.github.gtache.autosubtitle.subtitle.ImportOptions;
|
||||
@@ -54,7 +55,7 @@ public class FXSubtitlesModel implements SubtitlesModel<ObservableSubtitleImpl,
|
||||
private final ObjectProperty<ImportOptions> importOptions;
|
||||
|
||||
@Inject
|
||||
FXSubtitlesModel(final Map<String, Translator<?>> translators, final Translator defaultTranslator) {
|
||||
FXSubtitlesModel(final Map<String, Translator<?>> translators, final Map<ToolType, String> defaultTools) {
|
||||
this.availableTranslators = FXCollections.unmodifiableObservableMap(FXCollections.observableMap(translators));
|
||||
this.availableVideoLanguages = FXCollections.unmodifiableObservableList(FXCollections.observableArrayList(Arrays.stream(Language.values())
|
||||
.sorted((o1, o2) -> {
|
||||
@@ -83,7 +84,7 @@ public class FXSubtitlesModel implements SubtitlesModel<ObservableSubtitleImpl,
|
||||
this.isTranslating = new SimpleBooleanProperty(false);
|
||||
this.exportOptions = new SimpleObjectProperty<>();
|
||||
this.importOptions = new SimpleObjectProperty<>();
|
||||
this.translator = new SimpleObjectProperty<>(defaultTranslator);
|
||||
this.translator = new SimpleObjectProperty<>(translators.get(defaultTools.get(ToolType.TRANSLATOR)));
|
||||
|
||||
canSaveSubtitles.bind(Bindings.isNotEmpty(collections));
|
||||
collections.addListener((MapChangeListener<Language, ObservableSubtitleCollectionImpl>) change ->
|
||||
|
||||
@@ -7,11 +7,12 @@ import com.github.gtache.autosubtitle.subtitle.converter.impl.FormatOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.converter.impl.ParseOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.impl.ExtractOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.impl.ExportOptionsImpl;
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -8,6 +8,10 @@ import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractEvent;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractException;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.SubtitleExtractorListener;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.fxml.FXML;
|
||||
@@ -20,8 +24,6 @@ import javafx.stage.Window;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.gtache.autosubtitle.gui.work.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.Language;
|
||||
import com.github.gtache.autosubtitle.ToolType;
|
||||
import com.github.gtache.autosubtitle.Video;
|
||||
import com.github.gtache.autosubtitle.VideoConverter;
|
||||
import com.github.gtache.autosubtitle.VideoLoader;
|
||||
@@ -56,15 +57,14 @@ public class FXWorkModel implements WorkModel {
|
||||
private final ObjectProperty<ExtractOptions> extractOptions;
|
||||
|
||||
@Inject
|
||||
FXWorkModel(final Map<String, SubtitleExtractor<?>> subtitleExtractors, final SubtitleExtractor defaultExtractor,
|
||||
final Map<String, VideoLoader> videoLoaders, final VideoLoader defaultVideoLoader,
|
||||
final Map<String, VideoConverter> videoConverters, final VideoConverter defaultVideoConverter) {
|
||||
FXWorkModel(final Map<String, SubtitleExtractor<?>> subtitleExtractors, final Map<String, VideoLoader> videoLoaders,
|
||||
final Map<String, VideoConverter> videoConverters, final Map<ToolType, String> defaultTools) {
|
||||
this.availableSubtitleExtractors = FXCollections.unmodifiableObservableMap(FXCollections.observableMap(subtitleExtractors));
|
||||
this.subtitleExtractor = new SimpleObjectProperty<>(defaultExtractor);
|
||||
this.subtitleExtractor = new SimpleObjectProperty<>(subtitleExtractors.get(defaultTools.get(ToolType.SUBTITLE_EXTRACTOR)));
|
||||
this.availableVideoLoaders = FXCollections.unmodifiableObservableMap(FXCollections.observableMap(videoLoaders));
|
||||
this.videoLoader = new SimpleObjectProperty<>(defaultVideoLoader);
|
||||
this.videoLoader = new SimpleObjectProperty<>(videoLoaders.get(defaultTools.get(ToolType.VIDEO_LOADER)));
|
||||
this.availableVideoConverters = FXCollections.unmodifiableObservableMap(FXCollections.observableMap(videoConverters));
|
||||
this.videoConverter = new SimpleObjectProperty<>(defaultVideoConverter);
|
||||
this.videoConverter = new SimpleObjectProperty<>(videoConverters.get(defaultTools.get(ToolType.VIDEO_CONVERTER)));
|
||||
this.video = new SimpleObjectProperty<>();
|
||||
this.workStatus = new SimpleObjectProperty<>(WorkStatus.IDLE);
|
||||
this.progress = new SimpleDoubleProperty(-1);
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.gtache.autosubtitle.modules.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.TimeFormatter;
|
||||
import com.github.gtache.autosubtitle.gui.fx.ColonTimeFormatter;
|
||||
import com.github.gtache.autosubtitle.gui.main.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.gui.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.gui.media.fx.FXMediaController;
|
||||
import com.github.gtache.autosubtitle.gui.parameters.fx.FXParametersController;
|
||||
import com.github.gtache.autosubtitle.gui.setup.fx.FXSetupController;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.github.gtache.autosubtitle.setup.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.main.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.gui.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.setup.SetupUserBridge;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.Alert;
|
||||
|
||||
@@ -5,27 +5,27 @@ module com.github.gtache.autosubtitle.gui.fx {
|
||||
requires transitive com.github.gtache.autosubtitle.core;
|
||||
requires transitive com.github.gtache.autosubtitle.gui.core;
|
||||
requires transitive javafx.controls;
|
||||
requires transitive javafx.media;
|
||||
requires transitive javafx.fxml;
|
||||
requires transitive javafx.media;
|
||||
requires transitive java.prefs;
|
||||
requires org.controlsfx.controls;
|
||||
requires org.apache.logging.log4j;
|
||||
requires transitive java.prefs;
|
||||
|
||||
exports com.github.gtache.autosubtitle.gui.fx;
|
||||
exports com.github.gtache.autosubtitle.gui.media.fx;
|
||||
exports com.github.gtache.autosubtitle.gui.parameters.fx;
|
||||
exports com.github.gtache.autosubtitle.gui.setup.fx;
|
||||
exports com.github.gtache.autosubtitle.gui.subtitles.fx;
|
||||
exports com.github.gtache.autosubtitle.gui.work.fx;
|
||||
exports com.github.gtache.autosubtitle.setup.gui.fx;
|
||||
exports com.github.gtache.autosubtitle.subtitle.gui.fx;
|
||||
|
||||
exports com.github.gtache.autosubtitle.modules.gui.fx;
|
||||
|
||||
opens com.github.gtache.autosubtitle.gui.fx to javafx.fxml;
|
||||
exports com.github.gtache.autosubtitle.gui.main.fx;
|
||||
opens com.github.gtache.autosubtitle.gui.main.fx to javafx.fxml;
|
||||
exports com.github.gtache.autosubtitle.gui.media.fx;
|
||||
opens com.github.gtache.autosubtitle.gui.media.fx to javafx.fxml;
|
||||
exports com.github.gtache.autosubtitle.gui.parameters.fx;
|
||||
opens com.github.gtache.autosubtitle.gui.parameters.fx to javafx.fxml;
|
||||
exports com.github.gtache.autosubtitle.gui.setup.fx;
|
||||
opens com.github.gtache.autosubtitle.gui.setup.fx to javafx.fxml;
|
||||
exports com.github.gtache.autosubtitle.gui.subtitles.fx;
|
||||
opens com.github.gtache.autosubtitle.gui.subtitles.fx to javafx.fxml;
|
||||
exports com.github.gtache.autosubtitle.gui.work.fx;
|
||||
opens com.github.gtache.autosubtitle.gui.work.fx to javafx.fxml;
|
||||
}
|
||||
@@ -3,21 +3,21 @@
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<TabPane fx:id="tabPane" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.github.gtache.autosubtitle.gui.main.fx.FXMainController">
|
||||
fx:controller="com.github.gtache.autosubtitle.gui.fx.FXMainController">
|
||||
<tabs>
|
||||
<Tab closable="false" text="%main.tab.work.label">
|
||||
<content>
|
||||
<fx:include source="workView.fxml"/>
|
||||
<fx:include source="../work/fx/workView.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab closable="false" text="%main.tab.setup.label">
|
||||
<content>
|
||||
<fx:include source="setupView.fxml"/>
|
||||
<fx:include source="../setup/fx/setupView.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab closable="false" text="%main.tab.parameters.label">
|
||||
<content>
|
||||
<fx:include source="parametersView.fxml"/>
|
||||
<fx:include source="../parameters/fx/parametersView.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+6
-12
@@ -1,16 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ProgressBar?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.Tooltip?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<GridPane hgap="10.0" vgap="10.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.github.gtache.autosubtitle.gui.work.fx.FXWorkController">
|
||||
<columnConstraints>
|
||||
@@ -51,9 +43,11 @@
|
||||
</children>
|
||||
</HBox>
|
||||
<fx:include fx:id="subtitles" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
||||
source="subtitlesView.fxml" GridPane.columnIndex="0" GridPane.columnSpan="1" GridPane.rowIndex="0"
|
||||
source="../../subtitles/fx/subtitlesView.fxml" GridPane.columnIndex="0" GridPane.columnSpan="1"
|
||||
GridPane.rowIndex="0"
|
||||
GridPane.rowSpan="3" GridPane.vgrow="ALWAYS"/>
|
||||
<fx:include fx:id="media" source="mediaView.fxml" GridPane.columnIndex="1" GridPane.columnSpan="2147483647"
|
||||
<fx:include fx:id="media" source="../../media/fx/mediaView.fxml" GridPane.columnIndex="1"
|
||||
GridPane.columnSpan="2147483647"
|
||||
GridPane.rowIndex="1"/>
|
||||
<Label fx:id="progressLabel" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
<HBox spacing="10.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.main.fx;
|
||||
package com.github.gtache.autosubtitle.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.modules.gui.fx.DaggerResourceComponent;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.github.gtache.autosubtitle.gui.main.fx;
|
||||
package com.github.gtache.autosubtitle.gui.fx;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ class TestFXSubtitlesBinder {
|
||||
this.defaultManagers = Map.of(ToolType.TRANSLATOR, firstManager);
|
||||
this.setupManagers = Map.of(ToolType.TRANSLATOR, Map.of("first", firstManager, "second", secondManager));
|
||||
this.setupModel = mock(FXSetupModel.class, withSettings().defaultAnswer(CALLS_REAL_METHODS).useConstructor(setupManagers, defaultManagers));
|
||||
this.subtitlesModel = new FXSubtitlesModel(translators, firstTranslator);
|
||||
this.subtitlesModel = new FXSubtitlesModel(translators, Map.of(ToolType.TRANSLATOR, "first"));
|
||||
this.binder = new FXSubtitlesBinder(workModel, parametersModel, setupModel, subtitlesModel);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ class TestFXSubtitlesController extends FxRobot {
|
||||
this.videoConverter = requireNonNull(videoConverter);
|
||||
this.translator = requireNonNull(translator);
|
||||
this.timeFormatter = requireNonNull(timeFormatter);
|
||||
this.model = spy(new FXSubtitlesModel(Map.of(), translator));
|
||||
this.model = spy(new FXSubtitlesModel(Map.of(), Map.of()));
|
||||
this.binder = requireNonNull(binder);
|
||||
this.window = FxToolkit.registerPrimaryStage();
|
||||
this.controller = spy(FXSubtitlesController.class);
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.github.gtache.autosubtitle.gui.subtitles.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.Language;
|
||||
import com.github.gtache.autosubtitle.ToolType;
|
||||
import com.github.gtache.autosubtitle.subtitle.ExportOptions;
|
||||
import com.github.gtache.autosubtitle.subtitle.ImportOptions;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.ObservableSubtitleCollectionImpl;
|
||||
@@ -34,7 +35,7 @@ class TestFXSubtitlesModel {
|
||||
this.translator1 = requireNonNull(translator1);
|
||||
this.translator2 = requireNonNull(translator2);
|
||||
this.translators = Map.of("1", translator1, "2", translator2);
|
||||
this.model = new FXSubtitlesModel(translators, translator1);
|
||||
this.model = new FXSubtitlesModel(translators, Map.of(ToolType.TRANSLATOR, "1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-4
@@ -2,9 +2,7 @@ package com.github.gtache.autosubtitle.gui.work.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.Language;
|
||||
import com.github.gtache.autosubtitle.Video;
|
||||
import com.github.gtache.autosubtitle.VideoConverter;
|
||||
import com.github.gtache.autosubtitle.VideoInfo;
|
||||
import com.github.gtache.autosubtitle.VideoLoader;
|
||||
import com.github.gtache.autosubtitle.gui.parameters.fx.FXParametersModel;
|
||||
import com.github.gtache.autosubtitle.gui.subtitles.fx.FXSubtitlesModel;
|
||||
import com.github.gtache.autosubtitle.subtitle.OutputFormat;
|
||||
@@ -12,7 +10,6 @@ import com.github.gtache.autosubtitle.subtitle.converter.impl.FormatOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.converter.impl.ParseOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModel;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModelProvider;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.SubtitleExtractor;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.impl.ExtractOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.impl.ExportOptionsImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.impl.FontImpl;
|
||||
@@ -53,7 +50,7 @@ class TestFXWorkBinder {
|
||||
this.defaultMaxLines = 1;
|
||||
this.parametersModel = mock(FXParametersModel.class, withSettings().defaultAnswer(CALLS_REAL_METHODS).useConstructor(extractionModelProvider, defaultFontFamily, defaultFontSize, defaultMaxLineLength, defaultMaxLines));
|
||||
this.subtitlesModel = spy(FXSubtitlesModel.class);
|
||||
this.workModel = new FXWorkModel(Map.of(), mock(SubtitleExtractor.class), Map.of(), mock(VideoLoader.class), Map.of(), mock(VideoConverter.class)); //TODO
|
||||
this.workModel = new FXWorkModel(Map.of(), Map.of(), Map.of(), Map.of()); //TODO
|
||||
this.binder = new FXWorkBinder(workModel, parametersModel, subtitlesModel);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class TestFXWorkController extends FxRobot {
|
||||
this.extractor = requireNonNull(extractor);
|
||||
this.videoLoader = requireNonNull(videoLoader);
|
||||
this.videoConverter = requireNonNull(videoConverter);
|
||||
this.model = spy(new FXWorkModel(Map.of(), extractor, Map.of(), videoLoader, Map.of(), videoConverter));
|
||||
this.model = spy(new FXWorkModel(Map.of(), Map.of(), Map.of(), Map.of()));
|
||||
this.binder = requireNonNull(binder);
|
||||
this.window = FxToolkit.registerPrimaryStage();
|
||||
this.controller = spy(new FXWorkController(model, binder));
|
||||
|
||||
+1
-4
@@ -2,14 +2,11 @@ package com.github.gtache.autosubtitle.gui.work.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.Language;
|
||||
import com.github.gtache.autosubtitle.Video;
|
||||
import com.github.gtache.autosubtitle.VideoConverter;
|
||||
import com.github.gtache.autosubtitle.VideoLoader;
|
||||
import com.github.gtache.autosubtitle.gui.work.WorkStatus;
|
||||
import com.github.gtache.autosubtitle.subtitle.EditableSubtitle;
|
||||
import com.github.gtache.autosubtitle.subtitle.ExportOptions;
|
||||
import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractOptions;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.SubtitleExtractor;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.ObservableSubtitleCollectionImpl;
|
||||
import com.github.gtache.autosubtitle.subtitle.gui.fx.ObservableSubtitleImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -25,7 +22,7 @@ class TestFXWorkModel {
|
||||
private final FXWorkModel model;
|
||||
|
||||
TestFXWorkModel() {
|
||||
this.model = new FXWorkModel(Map.of(), mock(SubtitleExtractor.class), Map.of(), mock(VideoLoader.class), Map.of(), mock(VideoConverter.class)); //TODO
|
||||
this.model = new FXWorkModel(Map.of(), Map.of(), Map.of(), Map.of()); //TODO
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.github.gtache.autosubtitle.modules.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.main.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.gui.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.gui.media.fx.FXMediaController;
|
||||
import com.github.gtache.autosubtitle.gui.parameters.fx.FXParametersController;
|
||||
import com.github.gtache.autosubtitle.gui.setup.fx.FXSetupController;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.github.gtache.autosubtitle.setup.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.main.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.gui.fx.FXMainController;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
+2
-1
@@ -8,10 +8,11 @@ import com.github.gtache.autosubtitle.modules.impl.CoreModule;
|
||||
import com.github.gtache.autosubtitle.modules.whisper.base.WhisperModule;
|
||||
import com.github.gtache.autosubtitle.modules.whisperx.WhisperXModule;
|
||||
import dagger.Component;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
||||
/**
|
||||
* Main component
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user