|
@@ -5,6 +5,7 @@ namespace Publicate.Wizards {
|
|
|
|
|
|
public class VideoWizard : Box, Wizard {
|
|
|
|
|
|
+ private VideoChooserRow video_file;
|
|
|
private EntryRow title;
|
|
|
private EntryRow author;
|
|
|
private EntryRow author_email;
|
|
@@ -26,6 +27,10 @@ namespace Publicate.Wizards {
|
|
|
group.title = "Publication Details";
|
|
|
group.description = "These can be changed later";
|
|
|
|
|
|
+ video_file = new VideoChooserRow(window);
|
|
|
+ video_file.title = "Video";
|
|
|
+ group.add(video_file);
|
|
|
+
|
|
|
title = new EntryRow ();
|
|
|
title.title = "Title";
|
|
|
group.add(title);
|
|
@@ -48,7 +53,7 @@ namespace Publicate.Wizards {
|
|
|
var next_button = new Button.with_label ("Create");
|
|
|
next_button.hexpand = true;
|
|
|
next_button.add_css_class ("suggested-action");
|
|
|
- next_button.clicked.connect (() => create_ppub());
|
|
|
+ next_button.clicked.connect (() => create_ppub.begin());
|
|
|
|
|
|
var button_box = new Box(Orientation.HORIZONTAL, 0);
|
|
|
button_box.add_css_class ("linked");
|
|
@@ -109,8 +114,76 @@ namespace Publicate.Wizards {
|
|
|
title.text = "";
|
|
|
author.text = "";
|
|
|
author_email.text = "";
|
|
|
+ video_file.reset();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private class VideoChooserRow : ActionRow {
|
|
|
+
|
|
|
+ private ViewerWindow toplevel;
|
|
|
+
|
|
|
+ public File? selected_file {get; set;}
|
|
|
+
|
|
|
+ public VideoChooserRow(ViewerWindow window) {
|
|
|
+ toplevel = window;
|
|
|
+ reset();
|
|
|
+
|
|
|
+ var button = new Button.from_icon_name("document-open-symbolic");
|
|
|
+ button.clicked.connect(() => open_video.begin());
|
|
|
+ button.margin_bottom = 8;
|
|
|
+ button.margin_top = 8;
|
|
|
+ button.add_css_class("flat");
|
|
|
+ add_suffix(button);
|
|
|
+
|
|
|
+ activatable_widget = button;
|
|
|
+ activatable = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void reset() {
|
|
|
+ selected_file = null;
|
|
|
+ subtitle = "Not selected";
|
|
|
+ }
|
|
|
+
|
|
|
+ public async void open_video() throws Error {
|
|
|
+
|
|
|
+ var dialog = new FileDialog();
|
|
|
+ var filters = new GLib.ListStore(Type.OBJECT);
|
|
|
+ var video_filter = new FileFilter();
|
|
|
+ var all_filter = new FileFilter();
|
|
|
+ filters.append(video_filter);
|
|
|
+ filters.append(all_filter);
|
|
|
+ video_filter.add_pattern("*.mp4");
|
|
|
+ video_filter.add_pattern("*.m4v");
|
|
|
+ video_filter.add_pattern("*.mov");
|
|
|
+ video_filter.add_pattern("*.avi");
|
|
|
+ video_filter.add_pattern("*.mkv");
|
|
|
+ video_filter.add_pattern("*.webm");
|
|
|
+ video_filter.add_pattern("*.ogg");
|
|
|
+ video_filter.add_pattern("*.ogv");
|
|
|
+ video_filter.name = "Video Files";
|
|
|
+ all_filter.add_pattern("*");
|
|
|
+ all_filter.name = "All Files";
|
|
|
+
|
|
|
+ dialog.filters = filters;
|
|
|
+ dialog.set_initial_file(selected_file);
|
|
|
+ var file = yield dialog.open(toplevel, null);
|
|
|
+
|
|
|
+ if(file == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ selected_file = file;
|
|
|
+ subtitle = selected_file.get_basename();
|
|
|
+
|
|
|
+ var info = new Video.VideoInfo(file);
|
|
|
+ yield info.read_info();
|
|
|
+
|
|
|
+ print(@"Video Info:\nWidth = $(info.width);\nHeight = $(info.height);\nFPS = $(info.frame_rate);\nRatio = $(info.ratio_frac);\n Ratio (display) = $(info.aspect_ratio);\n Duration = $(info.duration);\n");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|