1
1
package controller ;
2
2
3
- import handler . ConfigHandler ;
3
+ import configuration . Settings ;
4
4
import javafx .event .Event ;
5
5
import javafx .event .EventHandler ;
6
6
import javafx .scene .Scene ;
@@ -20,16 +20,16 @@ public class SettingsDialogController extends Stage implements EventHandler {
20
20
/**
21
21
* The object that handles settings for encoding, decoding, compression, and a number of other features.
22
22
*/
23
- private final ConfigHandler configHandler ;
23
+ private final Settings settings ;
24
24
25
25
/**
26
26
* Construct a new settings dialog controller.
27
- * @param configHandler The object that handles settings for encoding, decoding, compression, and a number of other features.
27
+ * @param settings The object that handles settings for encoding, decoding, compression, and a number of other features.
28
28
*/
29
- public SettingsDialogController (final Stage settingsStage , final ConfigHandler configHandler ) {
30
- this .configHandler = configHandler ;
29
+ public SettingsDialogController (final Stage settingsStage , final Settings settings ) {
30
+ this .settings = settings ;
31
31
32
- view = new SettingsDialogView (settingsStage , this , configHandler );
32
+ view = new SettingsDialogView (settingsStage , this , this . settings );
33
33
34
34
// Setup Stage:
35
35
final Scene scene = new Scene (view );
@@ -48,36 +48,44 @@ public void handle(Event event) {
48
48
final Object source = event .getSource ();
49
49
50
50
// The button to close the window and save settings.
51
- if (source .equals (view .getButton_accept ())) {
51
+ if (source .equals (view .getButton_accept ())) {
52
52
// Check to see if all data is correct.
53
53
// If it is, then save the settings.
54
- if (! view .getController_ffmpegSettings ().areSettingsCorrect ()) {
54
+ if (! view .getController_ffmpegSettings ().areSettingsCorrect ()) {
55
55
// Show any warnings about YouTube compatability:
56
- if ( configHandler . isWarnUserIfSettingsMayNotWorkForYouTube ( )) {
56
+ if ( settings . getBooleanSetting ( "Warn If Settings Possibly Incompatible With YouTube" )) {
57
57
view .getController_ffmpegSettings ().displayWarningsAboutYouTubeCompatability ();
58
58
}
59
59
60
60
final ArchivalSettingsPane pane_archival = view .getController_archivalSettings ().getPane ();
61
61
final FfmpegSettingsPane pane_ffmpeg = view .getController_ffmpegSettings ().getPane ();
62
62
final MiscSettingsPane pane_misc = view .getPane_miscSettings ();
63
63
64
- configHandler .setFfmpegPath (pane_ffmpeg .getField_ffmpegPath ().getText ());
65
- configHandler .setCompressionProgramPath (pane_archival .getField_compressionProgramPath ().getText ());
66
- configHandler .setCompressionOutputExtension (pane_archival .getField_archiveOutputExtension ().getText ());
67
- configHandler .setEncodeFormat (pane_ffmpeg .getField_encodeFormat ().getText ());
68
- configHandler .setDecodeFormat (pane_ffmpeg .getField_decodeFormat ().getText ());
69
- configHandler .setEncodedVideoWidth (Integer .valueOf (pane_ffmpeg .getField_encodedVideoWidth ().getText ()));
70
- configHandler .setEncodedVideoHeight (Integer .valueOf (pane_ffmpeg .getField_encodedVideoHeight ().getText ()));
71
- configHandler .setEncodedFramerate (Integer .valueOf (pane_ffmpeg .getField_encodedFramerate ().getText ()));
72
- configHandler .setMacroBlockDimensions (Integer .valueOf (pane_ffmpeg .getField_macroBlockDimensions ().getText ()));
73
- configHandler .setUseFullyCustomFfmpegOptions (pane_ffmpeg .getRadioButton_useFullyCustomEncodingOptions_yes ().isSelected ());
74
- configHandler .setFullyCustomFfmpegEncodingOptions (pane_ffmpeg .getField_fullyCustomFfmpegEncodingOptions ().getText ());
75
- configHandler .setFullyCustomFfmpegDecodingOptions (pane_ffmpeg .getField_fullyCustomFfmpegDecodingptions ().getText ());
76
- configHandler .setEncodingLibrary (pane_ffmpeg .getField_encodingLibrary ().getText ());
77
- configHandler .setFfmpegLogLevel (pane_ffmpeg .getComboBox_ffmpegLogLevel ().getSelectionModel ().getSelectedItem ());
78
- configHandler .setCompressionCommands (pane_archival .getField_compressionCommands ().getText ());
79
- configHandler .setWarnUserIfSettingsMayNotWorkForYouTube (pane_misc .getWarnUserIfSettingsMayNotWorkForYouTube ());
80
- configHandler .createConfigFile ();
64
+ settings .setSetting ("FFMPEG Path" , pane_ffmpeg .getField_ffmpegPath ().getText ());
65
+ settings .setSetting ("Compression Program Path" , pane_archival .getField_compressionProgramPath ().getText ());
66
+
67
+ settings .setSetting ("Enc Format" , pane_ffmpeg .getField_encodeFormat ().getText ());
68
+ settings .setSetting ("Dec Format" , pane_ffmpeg .getField_decodeFormat ().getText ());
69
+
70
+ settings .setSetting ("Enc Vid Width" , pane_ffmpeg .getField_encodedVideoWidth ().getText ());
71
+ settings .setSetting ("Enc Vid Height" , pane_ffmpeg .getField_encodedVideoHeight ().getText ());
72
+ settings .setSetting ("Enc Vid Framerate" , pane_ffmpeg .getField_encodedFramerate ().getText ());
73
+ settings .setSetting ("Enc Vid Macro Block Dimensions" , pane_ffmpeg .getField_macroBlockDimensions ().getText ());
74
+ settings .setSetting ("Enc Library" , pane_ffmpeg .getField_encodingLibrary ().getText ());
75
+
76
+ settings .setSetting ("FFMPEG Log Level" , pane_ffmpeg .getComboBox_ffmpegLogLevel ().getSelectionModel ().getSelectedItem ());
77
+
78
+ settings .setSetting ("Use Custom FFMPEG Options" , pane_ffmpeg .getRadioButton_useFullyCustomEncodingOptions_yes ().isSelected ());
79
+ settings .setSetting ("Custom FFMPEG Enc Options" , pane_ffmpeg .getField_fullyCustomFfmpegEncodingOptions ().getText ());
80
+ settings .setSetting ("Custom FFMPEG Dec Options" , pane_ffmpeg .getField_fullyCustomFfmpegDecodingptions ().getText ());
81
+
82
+ settings .setSetting ("Delete Source File When Enc" , false );
83
+ settings .setSetting ("Delete Source File When Dec" , false );
84
+
85
+ settings .setSetting ("Compression Commands" , pane_archival .getField_compressionCommands ().getText ());
86
+ settings .setSetting ("Compression Output Extension" , pane_archival .getField_archiveOutputExtension ().getText ());
87
+
88
+ settings .setSetting ("Warn If Settings Possibly Incompatible With YouTube" , pane_misc .getWarnUserIfSettingsMayNotWorkForYouTube ());
81
89
82
90
this .close ();
83
91
}
0 commit comments