Moves some modules and files, adds save subtitles
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Controller for the main view
|
||||
*/
|
||||
public interface MainController {
|
||||
|
||||
/**
|
||||
* Selects the given tab
|
||||
*
|
||||
* @param index The tab index
|
||||
*/
|
||||
void selectTab(final int index);
|
||||
|
||||
/**
|
||||
* @return The model
|
||||
*/
|
||||
MainModel model();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Model for the main view
|
||||
*/
|
||||
public interface MainModel {
|
||||
|
||||
/**
|
||||
* @return The currently selected tab index
|
||||
*/
|
||||
int selectedTab();
|
||||
|
||||
/**
|
||||
* @param index The index of the tab to select
|
||||
*/
|
||||
void selectTab(int index);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Controller for the media view
|
||||
*/
|
||||
public interface MediaController {
|
||||
|
||||
/**
|
||||
* Plays the media
|
||||
*/
|
||||
void play();
|
||||
|
||||
/**
|
||||
* Pauses the media
|
||||
*/
|
||||
void pause();
|
||||
|
||||
/**
|
||||
* Seeks the given position in the media
|
||||
*
|
||||
* @param position the new position
|
||||
*/
|
||||
void seek(long position);
|
||||
|
||||
/**
|
||||
* @return The model for this controller
|
||||
*/
|
||||
MediaModel model();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
import com.github.gtache.autosubtitle.Video;
|
||||
import com.github.gtache.autosubtitle.subtitle.EditableSubtitle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Model for the media view
|
||||
*/
|
||||
public interface MediaModel {
|
||||
|
||||
/**
|
||||
* @return The current video
|
||||
*/
|
||||
Video video();
|
||||
|
||||
/**
|
||||
* Sets the video
|
||||
*
|
||||
* @param video the new video
|
||||
*/
|
||||
void setVideo(Video video);
|
||||
|
||||
/**
|
||||
* @return The current volume between 0 and 1
|
||||
*/
|
||||
double volume();
|
||||
|
||||
/**
|
||||
* Sets the volume
|
||||
*
|
||||
* @param volume the new volume
|
||||
*/
|
||||
void setVolume(double volume);
|
||||
|
||||
/**
|
||||
* @return Whether the media is playing
|
||||
*/
|
||||
boolean isPlaying();
|
||||
|
||||
/**
|
||||
* Sets the playing state
|
||||
*
|
||||
* @param playing the new playing state
|
||||
*/
|
||||
void setIsPlaying(boolean playing);
|
||||
|
||||
/**
|
||||
* @return The duration of the media
|
||||
*/
|
||||
long duration();
|
||||
|
||||
/**
|
||||
* @return The current position in the media
|
||||
*/
|
||||
long position();
|
||||
|
||||
/**
|
||||
* Sets the position
|
||||
*
|
||||
* @param position the new position
|
||||
*/
|
||||
void setPosition(long position);
|
||||
|
||||
/**
|
||||
* @return The current subtitles
|
||||
*/
|
||||
List<EditableSubtitle> subtitles();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Controller for the parameters view
|
||||
*/
|
||||
public interface ParametersController {
|
||||
|
||||
/**
|
||||
* Saves the parameters
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* Resets the parameters
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* @return The model
|
||||
*/
|
||||
ParametersModel model();
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
import com.github.gtache.autosubtitle.subtitle.OutputFormat;
|
||||
import com.github.gtache.autosubtitle.subtitle.extractor.ExtractionModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Model for the media view
|
||||
*/
|
||||
public interface ParametersModel {
|
||||
|
||||
/**
|
||||
* @return The available extraction models
|
||||
*/
|
||||
List<ExtractionModel> availableExtractionModels();
|
||||
|
||||
/**
|
||||
* @return The current extraction model
|
||||
*/
|
||||
ExtractionModel extractionModel();
|
||||
|
||||
/**
|
||||
* @param model The new extraction model
|
||||
*/
|
||||
void setExtractionModel(ExtractionModel model);
|
||||
|
||||
/**
|
||||
* @return The available output formats
|
||||
*/
|
||||
List<OutputFormat> availableOutputFormats();
|
||||
|
||||
/**
|
||||
* @return The current output format
|
||||
*/
|
||||
OutputFormat outputFormat();
|
||||
|
||||
/**
|
||||
* @param format The new output format
|
||||
*/
|
||||
void setOutputFormat(OutputFormat format);
|
||||
|
||||
/**
|
||||
* @return The available font families
|
||||
*/
|
||||
List<String> availableFontFamilies();
|
||||
|
||||
/**
|
||||
* @return The current font family
|
||||
*/
|
||||
String fontFamily();
|
||||
|
||||
/**
|
||||
* @param fontFamily The new font family
|
||||
*/
|
||||
void setFontFamily(String fontFamily);
|
||||
|
||||
/**
|
||||
* @return The current font size
|
||||
*/
|
||||
int fontSize();
|
||||
|
||||
/**
|
||||
* @param fontSize The new font size
|
||||
*/
|
||||
void setFontSize(int fontSize);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Controller for the setup view
|
||||
*/
|
||||
public interface SetupController {
|
||||
|
||||
/**
|
||||
* Installs the video converter
|
||||
*/
|
||||
void installVideoConverter();
|
||||
|
||||
/**
|
||||
* Uninstalls the video converter
|
||||
*/
|
||||
void uninstallVideoConverter();
|
||||
|
||||
/**
|
||||
* Updates the video converter
|
||||
*/
|
||||
void updateVideoConverter();
|
||||
|
||||
/**
|
||||
* Reinstalls the video converter
|
||||
*/
|
||||
void reinstallVideoConverter();
|
||||
|
||||
/**
|
||||
* Installs the subtitle extractor
|
||||
*/
|
||||
void installSubtitleExtractor();
|
||||
|
||||
/**
|
||||
* Uninstalls the subtitle extractor
|
||||
*/
|
||||
void uninstallSubtitleExtractor();
|
||||
|
||||
/**
|
||||
* Updates the subtitle extractor
|
||||
*/
|
||||
void updateSubtitleExtractor();
|
||||
|
||||
/**
|
||||
* Reinstalls the subtitle extractor
|
||||
*/
|
||||
void reinstallSubtitleExtractor();
|
||||
|
||||
/**
|
||||
* Installs the translator
|
||||
*/
|
||||
void installTranslator();
|
||||
|
||||
/**
|
||||
* Uninstalls the translator
|
||||
*/
|
||||
void uninstallTranslator();
|
||||
|
||||
/**
|
||||
* Updates the translator
|
||||
*/
|
||||
void updateTranslator();
|
||||
|
||||
/**
|
||||
* Reinstalls the translator
|
||||
*/
|
||||
void reinstallTranslator();
|
||||
|
||||
/**
|
||||
* @return the model
|
||||
*/
|
||||
SetupModel model();
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
import com.github.gtache.autosubtitle.setup.SetupStatus;
|
||||
|
||||
/**
|
||||
* Model for the setup view
|
||||
*/
|
||||
public interface SetupModel {
|
||||
|
||||
/**
|
||||
* @return the status of the subtitle extractor
|
||||
*/
|
||||
SetupStatus subtitleExtractorStatus();
|
||||
|
||||
/**
|
||||
* Sets the status of the subtitle extractor
|
||||
*
|
||||
* @param status the new status
|
||||
*/
|
||||
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
|
||||
*/
|
||||
double subtitleExtractorSetupProgress();
|
||||
|
||||
/**
|
||||
* Sets the progress of the subtitle extractor setup
|
||||
*
|
||||
* @param progress the new progress
|
||||
*/
|
||||
void setSubtitleExtractorSetupProgress(double progress);
|
||||
|
||||
/**
|
||||
* @return the text of the subtitle extractor setup progress
|
||||
*/
|
||||
String subtitleExtractorSetupProgressLabel();
|
||||
|
||||
/**
|
||||
* Sets the text of the subtitle extractor setup progress
|
||||
*
|
||||
* @param label the new text
|
||||
*/
|
||||
void setSubtitleExtractorSetupProgressLabel(String label);
|
||||
|
||||
/**
|
||||
* @return the status of the video converter
|
||||
*/
|
||||
SetupStatus videoConverterStatus();
|
||||
|
||||
/**
|
||||
* Sets the status of the video converter
|
||||
*
|
||||
* @param status the new status
|
||||
*/
|
||||
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
|
||||
*/
|
||||
double videoConverterSetupProgress();
|
||||
|
||||
/**
|
||||
* Sets the progress of the video converter setup
|
||||
*
|
||||
* @param progress the new progress
|
||||
*/
|
||||
void setVideoConverterSetupProgress(double progress);
|
||||
|
||||
/**
|
||||
* @return the text of the video converter setup progress
|
||||
*/
|
||||
String videoConverterSetupProgressLabel();
|
||||
|
||||
/**
|
||||
* Sets the text of the video converter setup progress
|
||||
*
|
||||
* @param label the new text
|
||||
*/
|
||||
void setVideoConverterSetupProgressLabel(String label);
|
||||
|
||||
/**
|
||||
* @return the status of the translator
|
||||
*/
|
||||
SetupStatus translatorStatus();
|
||||
|
||||
/**
|
||||
* Sets the status of the translator
|
||||
*
|
||||
* @param status the new status
|
||||
*/
|
||||
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
|
||||
*/
|
||||
double translatorSetupProgress();
|
||||
|
||||
/**
|
||||
* Sets the progress of the translator setup
|
||||
*
|
||||
* @param progress the new progress
|
||||
*/
|
||||
void setTranslatorSetupProgress(double progress);
|
||||
|
||||
/**
|
||||
* @return the text of the translator setup progress
|
||||
*/
|
||||
String translatorSetupProgressLabel();
|
||||
|
||||
/**
|
||||
* Sets the text of the translator setup progress
|
||||
*
|
||||
* @param label the new text
|
||||
*/
|
||||
void setTranslatorSetupProgressLabel(String label);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Formatter for times
|
||||
*/
|
||||
public interface TimeFormatter {
|
||||
|
||||
/**
|
||||
* Formats the given elapsed time and total time into a string
|
||||
*
|
||||
* @param elapsed The elapsed time in milliseconds
|
||||
* @param total The total time in milliseconds
|
||||
* @return The formatted string
|
||||
*/
|
||||
String format(long elapsed, long total);
|
||||
|
||||
/**
|
||||
* Formats the given time into a string
|
||||
*
|
||||
* @param millis The time in milliseconds
|
||||
* @return The formatted string
|
||||
*/
|
||||
String format(long millis);
|
||||
|
||||
/**
|
||||
* Parses the given string
|
||||
*
|
||||
* @param time The time as a string
|
||||
* @return The time in milliseconds
|
||||
*/
|
||||
long parse(final String time);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Controller for the work view
|
||||
*/
|
||||
public interface WorkController {
|
||||
|
||||
/**
|
||||
* Extracts the subtitles for the current video
|
||||
*/
|
||||
void extractSubtitles();
|
||||
|
||||
/**
|
||||
* Loads a video
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
WorkModel model();
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
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
|
||||
*/
|
||||
public interface WorkModel {
|
||||
|
||||
/**
|
||||
* @return The current video
|
||||
*/
|
||||
Video video();
|
||||
|
||||
/**
|
||||
* @return The current extraction model
|
||||
*/
|
||||
ExtractionModel extractionModel();
|
||||
|
||||
/**
|
||||
* @param model The new extraction model
|
||||
*/
|
||||
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
|
||||
*/
|
||||
WorkStatus status();
|
||||
|
||||
/**
|
||||
* @param status The new status
|
||||
*/
|
||||
void setStatus(WorkStatus status);
|
||||
|
||||
/**
|
||||
* @return The current progress
|
||||
*/
|
||||
double progress();
|
||||
|
||||
/**
|
||||
* @param progress The new progress
|
||||
*/
|
||||
void setProgress(double progress);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.github.gtache.autosubtitle.gui;
|
||||
|
||||
/**
|
||||
* Possible statuses for the work controller
|
||||
*/
|
||||
public enum WorkStatus {
|
||||
IDLE, EXTRACTING, TRANSLATING, EXPORTING
|
||||
}
|
||||
7
gui/api/src/main/java/module-info.java
Normal file
7
gui/api/src/main/java/module-info.java
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* GUI module for auto-subtitle
|
||||
*/
|
||||
module com.github.gtache.autosubtitle.gui.api {
|
||||
requires transitive com.github.gtache.autosubtitle.api;
|
||||
exports com.github.gtache.autosubtitle.gui;
|
||||
}
|
||||
Reference in New Issue
Block a user