Skip to content

Commit 66f2e1f

Browse files
Upgraded settings menu
Signed-off-by: JayFromProgramming <ajsweene@mtu.edu>
1 parent 38647c0 commit 66f2e1f

6 files changed

Lines changed: 168 additions & 5 deletions

File tree

javaFX-resources/com/example/clippyfx/hello-view.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</padding>
1717

1818
<Label fx:id="welcomeText" />
19-
<AnchorPane fx:id="Pain" prefHeight="702.0" prefWidth="1240.0">
19+
<AnchorPane fx:id="Pain" onKeyPressed="#keyPressed" prefHeight="702.0" prefWidth="1240.0">
2020
<children>
2121
<AnchorPane fx:id="VideoPain" layoutY="14.0" maxHeight="541.0" maxWidth="909.0" prefHeight="541.0" prefWidth="909.0">
2222
<children>

out/artifacts/ClippyFX_jar/resources/settingsTemplates/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,19 @@
117117
"value": "Enter",
118118
"description": "Launches the clipIt window.",
119119
"group": "Keybinds"
120+
},
121+
"setStartTime": {
122+
"name": "Set Start Time",
123+
"type": "keyBind",
124+
"value": "Semicolon",
125+
"description": "Sets the start time of the current clip.",
126+
"group": "Keybinds"
127+
},
128+
"setEndTime": {
129+
"name": "Set End Time",
130+
"type": "keyBind",
131+
"value": "Quote",
132+
"description": "Sets the end time of the current clip.",
133+
"group": "Keybinds"
120134
}
121135
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"defaultAdvancedLoadPath": {
3+
"name": "Default file load path",
4+
"type": "filePath",
5+
"value": "C:\\Users\\Public\\Videos",
6+
"description": "The default path to load files from.",
7+
"group": "Save and Load"
8+
},
9+
"defaultAdvancedSavePath": {
10+
"name": "Default file save path",
11+
"type": "filePath",
12+
"value": "C:\\Users\\Public\\Videos",
13+
"description": "The default path to save files to.",
14+
"group": "Save and Load"
15+
},
16+
"defaultURLSavePath": {
17+
"name": "Default URL save path",
18+
"type": "filePath",
19+
"value": "C:\\Users\\Public\\Videos",
20+
"description": "The default path to save URLs to.",
21+
"group": "Save and Load"
22+
},
23+
"defaultYoutubeSavePath": {
24+
"name": "Default YouTube save path",
25+
"type": "filePath",
26+
"value": "C:\\Users\\Public\\Videos",
27+
"description": "The default path to save youtube clips to.",
28+
"group": "Save and Load"
29+
},
30+
"preferredOutputEncoder": {
31+
"name": "preferredOutputEncoder",
32+
"type": "encoderEnum",
33+
"value": "libvpx_vp9",
34+
"description": "The preferred encoder to select for output.",
35+
"group": "Encoding"
36+
},
37+
"preferredCompatibilityEncoder": {
38+
"name": "Preferred HWAccel Encoder",
39+
"type": "encoderEnum",
40+
"value": "libx264",
41+
"description": "\nThe preferred encoder to select for when converting to a compatible format.",
42+
"group": "Encoding"
43+
},
44+
"defaultAllow100MB": {
45+
"name": "Allow 100MB",
46+
"type": "toggle",
47+
"value": "false",
48+
"description": "Whether or not to allow 100MB files instead of the default 8MB.",
49+
"group": "Encoding"
50+
},
51+
"defaultUseFullCPU": {
52+
"name": "Use Full CPU",
53+
"type": "toggle",
54+
"value": "true",
55+
"description": "Whether or not to use full CPU in vp9 encoding. \n(Reduces compression, but allows for higher speed)",
56+
"group": "Encoding"
57+
},
58+
"preferredVideoSize": {
59+
"name": "preferredVideoSize",
60+
"type": "sizeEnum",
61+
"value": "Source",
62+
"description": "The preferred video size to select.",
63+
"group": "Encoding"
64+
},
65+
"defaultAudioVolume": {
66+
"name": "Default audio volume",
67+
"type": "text",
68+
"value": "1",
69+
"description": "The default audio volume to use.",
70+
"group": "Playback"
71+
},
72+
"forceGarbageCollection": {
73+
"name": "Force garbage collection on eject",
74+
"type": "toggle",
75+
"value": "false",
76+
"description": "\nWhether or not to force the JVM to garbage collect on media eject.",
77+
"group": "Playback"
78+
},
79+
"playPauseKey": {
80+
"name": "Play/Pause Key",
81+
"type": "keyBind",
82+
"value": "Space",
83+
"description": "The key to use to play/pause.",
84+
"group": "Keybinds"
85+
},
86+
"nextFrame": {
87+
"name": "Next Frame",
88+
"type": "keyBind",
89+
"value": "Period",
90+
"description": "The key to use to go to the next frame.",
91+
"group": "Keybinds"
92+
},
93+
"previousFrame": {
94+
"name": "Previous Frame",
95+
"type": "keyBind",
96+
"value": "Comma",
97+
"description": "The key to use to go to the previous frame.",
98+
"group": "Keybinds"
99+
},
100+
"skipForward": {
101+
"name": "Skip Forward",
102+
"type": "keyBind",
103+
"value": "Right",
104+
"description": "The key to use to skip forward one second.",
105+
"group": "Keybinds"
106+
},
107+
"skipBackward": {
108+
"name": "Skip Backward",
109+
"type": "keyBind",
110+
"value": "Left",
111+
"description": "The key to use to skip backward one second.",
112+
"group": "Keybinds"
113+
},
114+
"previewClip": {
115+
"name": "Preview Clip",
116+
"type": "keyBind",
117+
"value": "P",
118+
"description": "The key to use to preview the current clip.",
119+
"group": "Keybinds"
120+
},
121+
"clipIt": {
122+
"name": "Clip It",
123+
"type": "keyBind",
124+
"value": "Enter",
125+
"description": "Launches the clipIt window.",
126+
"group": "Keybinds"
127+
},
128+
"setStartTime": {
129+
"name": "Set Start Time",
130+
"type": "keyBind",
131+
"value": "Semicolon",
132+
"description": "Sets the start time of the current clip.",
133+
"group": "Keybinds"
134+
},
135+
"setEndTime": {
136+
"name": "Set End Time",
137+
"type": "keyBind",
138+
"value": "Quote",
139+
"description": "Sets the end time of the current clip.",
140+
"group": "Keybinds"
141+
}
142+
}

src/main/java/EncodingMagic/FilePegGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ private String buildVP9Peg(PegArgument args) {
226226
default -> throw new IllegalStateException("Unexpected value: " + (args.dimensions == VideoChecks.Sizes.Source ?
227227
args.dimensions : VideoChecks.getSize()));
228228
};
229-
return String.format("-c:v libvpx-vp9 -crf:v %s -cpu-used 1 -row-mt 1 -c:a libopus -b:a 96k", crf);
229+
if (SettingsWrapper.getSetting("defaultUseFullCPU").bool()) {
230+
return String.format("-c:v libvpx-vp9 -crf:v %s -cpu-used 1 -row-mt 1 -c:a libopus -b:a 96k", crf);
231+
} else return String.format("-c:v libvpx-vp9 -crf:v %s -c:a libopus -b:a 96k", crf);
230232
}
231233
}

src/main/java/com/example/clippyfx/MainController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class MainController {
6666
private float fps = 30;
6767
private ArrayList<PopOut> popOuts = new ArrayList<>();
6868
private PegGenerator pegGenerator;
69+
private final Runtime runtime = Runtime.getRuntime();
6970

7071
private String timeFormatter(double time) {
7172
int hours = (int) (time / 3600);
@@ -171,6 +172,9 @@ public void handle(long now) {
171172
clipStartText.setText(timeFormatter(clipStart.getValue() / 100 * mediaPlayer.getTotalDuration().toSeconds()));
172173
scrubBarText.setText(timeFormatter(scrubBar.getValue() / 100 * mediaPlayer.getTotalDuration().toSeconds()));
173174
clipEndText.setText(timeFormatter(clipEnd.getValue() / 100 * mediaPlayer.getTotalDuration().toSeconds()));
175+
((Stage) Pain.getScene().getWindow()).setTitle("ClippyFX: Mem: ("
176+
+ (Math.round(runtime.freeMemory() / 1.049e+6)) + "MB / " +
177+
Math.round((runtime.totalMemory() / 1.049e+6)) + " MB) FPS: ??");
174178
}
175179
};
176180
timer.start();
@@ -209,7 +213,7 @@ public void ejectMedia(MouseEvent mouseEvent) {
209213
setEnabledUI(false);
210214
LoadPane.setVisible(true);
211215
VideoURI.clear();
212-
216+
runtime.gc(); // Force garbage collection
213217
}
214218

215219
protected double calcFrameRate(String ffprobeOutput) {

src/main/java/com/example/clippyfx/SettingsView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ public int settingOptionBuilder(SettingsWrapper.setting setting, int yOffset, Pa
183183
case "text" -> {
184184
TextField textField = new TextField();
185185
textField.setText(setting.value);
186-
yOffset += 6;
186+
// yOffset += 6;
187187
textField.setLayoutY(yOffset);
188+
yOffset += textField.getLayoutBounds().getHeight() + 6;
188189
textField.setPrefWidth(350);
189190
option.textField = textField;
190191
option.type = "text";
@@ -193,7 +194,7 @@ public int settingOptionBuilder(SettingsWrapper.setting setting, int yOffset, Pa
193194
};
194195
// System.out.println("End " + yOffset);
195196
options.add(option);
196-
return yOffset + 32;
197+
return yOffset + 34;
197198
}
198199

199200
private void makeDirectorySelector(TextField textField, String directory) {

0 commit comments

Comments
 (0)