Adds WhisperX, reworks UI (still needs some work), theoretically usable

This commit is contained in:
Guillaume Tâche
2024-08-17 22:05:04 +02:00
parent 7bddf53bab
commit 3fa51eb95b
204 changed files with 4787 additions and 1321 deletions

View File

@@ -13,5 +13,5 @@ public interface MainModel {
/**
* @param index The index of the tab to select
*/
void selectTab(int index);
void setSelectedTab(int index);
}

View File

@@ -19,20 +19,6 @@ public interface SetupModel {
*/
void setSubtitleExtractorStatus(SetupStatus status);
/**
* @return whether the subtitle extractor is installed
*/
default boolean isSubtitleExtractorInstalled() {
return subtitleExtractorStatus().isInstalled();
}
/**
* @return whether an update is available for the subtitle extractor
*/
default boolean isSubtitleExtractorUpdateAvailable() {
return subtitleExtractorStatus() == SetupStatus.UPDATE_AVAILABLE;
}
/**
* @return the progress of the subtitle extractor setup
*/
@@ -69,20 +55,6 @@ public interface SetupModel {
*/
void setVideoConverterStatus(SetupStatus status);
/**
* @return whether the video converter is installed
*/
default boolean isVideoConverterInstalled() {
return videoConverterStatus().isInstalled();
}
/**
* @return whether an update is available for the video converter
*/
default boolean isVideoConverterUpdateAvailable() {
return videoConverterStatus() == SetupStatus.UPDATE_AVAILABLE;
}
/**
* @return the progress of the video converter setup
*/
@@ -119,20 +91,6 @@ public interface SetupModel {
*/
void setTranslatorStatus(SetupStatus status);
/**
* @return whether the translator is installed
*/
default boolean isTranslatorInstalled() {
return translatorStatus().isInstalled();
}
/**
* @return whether an update is available for the translator
*/
default boolean isTranslatorUpdateAvailable() {
return translatorStatus() == SetupStatus.UPDATE_AVAILABLE;
}
/**
* @return the progress of the translator setup
*/

View File

@@ -0,0 +1,44 @@
package com.github.gtache.autosubtitle.gui;
import com.github.gtache.autosubtitle.Language;
import java.nio.file.Path;
/**
* Controller for the subtitles view
*/
public interface SubtitlesController {
/**
* Selects the given language for edition
*
* @param language The language
*/
void selectLanguage(final Language language);
/**
* Deletes a language
*
* @param language The language
*/
void deleteLanguage(final Language language);
/**
* Saves the subtitles to the given path
*
* @param file The output path
*/
void saveSubtitles(final Path file);
/**
* Loads a subtitles file
*
* @param file The path to the file
*/
void loadSubtitles(final Path file);
/**
* @return the model
*/
SubtitlesModel model();
}

View File

@@ -0,0 +1,146 @@
package com.github.gtache.autosubtitle.gui;
import com.github.gtache.autosubtitle.Language;
import com.github.gtache.autosubtitle.subtitle.Subtitle;
import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
import java.util.List;
import java.util.Map;
/**
* Model for the subtitles view
*
* @param <T> The type of subtitle
* @param <U> The type of subtitle collection
*/
public interface SubtitlesModel<T extends Subtitle, U extends SubtitleCollection<T>> {
/**
* @return The list of available video languages
*/
List<Language> availableVideoLanguages();
/**
* @return the video language
*/
Language videoLanguage();
/**
* Sets the video language
*
* @param language The new language
*/
void setVideoLanguage(Language language);
/**
* @return The list of available translations languages
*/
List<Language> availableTranslationsLanguage();
/**
* @return The list of selected translations languages
*/
List<Language> selectedTranslationsLanguages();
/**
* @return The currently selected language
*/
Language selectedLanguage();
/**
* @param language The new selected language
*/
void setSelectedLanguage(Language language);
/**
* @return The mapping of language to subtitles
*/
Map<Language, U> collections();
/**
* @return The currently selected collection
*/
U selectedCollection();
/**
* @param collection The new selected collection
*/
void setSelectedCollection(U collection);
/**
* @return The mapping of language to subtitles
*/
Map<Language, U> originalCollections();
/**
* @return The list of selected subtitles
*/
List<T> selectedSubtitles();
/**
* @return The currently selected subtitle
*/
T selectedSubtitle();
/**
* @param subtitle The new selected subtitle
*/
void setSelectedSubtitle(T subtitle);
/**
* @return Whether the user can load subtitles
*/
boolean canLoadSubtitles();
/**
* @param canLoadSubtitles Whether the user can load subtitles
*/
void setCanLoadSubtitles(boolean canLoadSubtitles);
/**
* @return Whether the user can add subtitles
*/
boolean canAddSubtitle();
/**
* @param canAddSubtitle Whether the user can add subtitles
*/
void setCanAddSubtitle(boolean canAddSubtitle);
/**
* @return Whether the user can reset subtitles
*/
boolean canResetSubtitles();
/**
* @param canResetSubtitles Whether the user can reset subtitles
*/
void setCanResetSubtitles(boolean canResetSubtitles);
/**
* @return Whether the user can save subtitles
*/
boolean canSaveSubtitles();
/**
* @return Whether subtitles are currently being translated
*/
boolean isTranslating();
/**
* @param translating Whether subtitles are currently being translated
*/
void setTranslating(boolean translating);
/**
* @return Whether the user can edit the table
*/
boolean canEditTable();
/**
* Sets whether the user can edit the table
*
* @param canEditTable Whether the user can edit the table
*/
void setCanEditTable(boolean canEditTable);
}

View File

@@ -18,21 +18,7 @@ public interface WorkController {
* @param file The path to the video
*/
void loadVideo(final Path file);
/**
* Saves the subtitles to the given path
*
* @param file The output path
*/
void saveSubtitles(final Path file);
/**
* Loads a subtitles file
*
* @param file The path to the file
*/
void loadSubtitles(final Path file);
/**
* @return The model
*/

View File

@@ -1,13 +1,9 @@
package com.github.gtache.autosubtitle.gui;
import com.github.gtache.autosubtitle.Language;
import com.github.gtache.autosubtitle.Video;
import com.github.gtache.autosubtitle.subtitle.EditableSubtitle;
import com.github.gtache.autosubtitle.subtitle.SubtitleCollection;
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModel;
import java.util.List;
/**
* Model for the main view
*/
@@ -18,6 +14,11 @@ public interface WorkModel {
*/
Video video();
/**
* @param video The new video
*/
void setVideo(Video video);
/**
* @return The current extraction model
*/
@@ -28,56 +29,6 @@ public interface WorkModel {
*/
void setExtractionModel(ExtractionModel model);
/**
* @return The current subtitle collection
*/
SubtitleCollection subtitleCollection();
/**
* @return The current list of subtitles
*/
List<EditableSubtitle> subtitles();
/**
* @return The current text
*/
String text();
/**
* @return The original extracted subtitles (used to reset)
*/
List<EditableSubtitle> originalSubtitles();
/**
* @return The currently selected subtitle
*/
EditableSubtitle selectedSubtitle();
/**
* @return The list of available video languages
*/
List<Language> availableVideoLanguages();
/**
* @return The list of available translations languages
*/
List<Language> availableTranslationsLanguage();
/**
* @return The video language
*/
Language videoLanguage();
/**
* @param language The video language
*/
void setVideoLanguage(Language language);
/**
* @return The list of selected translations
*/
List<Language> translations();
/**
* @return The current status
*/
@@ -97,4 +48,36 @@ public interface WorkModel {
* @param progress The new progress
*/
void setProgress(double progress);
/**
* @return Whether the user can extract subtitles
*/
boolean canExtract();
/**
* @return Whether the user can export subtitles
*/
boolean canExport();
/**
* @param canExport Whether the user can export subtitles
*/
void setCanExport(boolean canExport);
/**
* @return Whether the progress bar and label are currently visible
*/
boolean isProgressVisible();
/**
* @return The last extracted collection
*/
SubtitleCollection<?> extractedCollection();
/**
* Sets the last extracted collection
*
* @param collection The last extracted collection
*/
void setExtractedCollection(SubtitleCollection<?> collection);
}