Compare commits

...

1 Commits

Author SHA1 Message Date
Christoph J. Scherr ed96ea20ca some ui? 2023-12-02 15:21:29 +01:00
3 changed files with 61 additions and 2 deletions

View File

@ -6,4 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
anyhow = "1.0.75"
gstreamer = "0.21.2"
gtk = { version = "0.7.3", package = "gtk4", features = ["v4_8"] } gtk = { version = "0.7.3", package = "gtk4", features = ["v4_8"] }

View File

@ -1,5 +1,6 @@
use gtk::prelude::*; use gtk::{prelude::*,ListBox, glib, Application, ApplicationWindow, Button, Video, Box, LayoutManager, ffi::gtk_layout_manager_allocate};
use gtk::{glib, Application, ApplicationWindow};
mod video;
const APP_ID: &str = "de.cscherr.vshot"; const APP_ID: &str = "de.cscherr.vshot";
@ -15,10 +16,53 @@ fn main() -> glib::ExitCode {
} }
fn build_ui(app: &Application) { fn build_ui(app: &Application) {
let select_button = Button::builder()
.label("select video")
.margin_top(12)
.margin_bottom(12)
.margin_start(12)
.margin_end(12)
.build();
select_button.connect_clicked(|button| {
println!("TODO");
});
let save_image_button = Button::builder()
.label("save")
.margin_top(12)
.margin_bottom(12)
.margin_start(12)
.margin_end(12)
.build();
save_image_button.connect_clicked(|button| {
println!("TODO");
});
let video_play = Video::builder()
.build();
// Create a `ListBox` and add labels with integers from 0 to 100
let meta_box = Box::builder()
.build();
meta_box.append(&save_image_button);
meta_box.append(&select_button);
let video_box = Box::builder()
.height_request(550)
.width_request(750)
.orientation(gtk::Orientation::Vertical)
.build();
video_box.append(&video_play);
let list = ListBox::builder()
.build();
list.append(&video_box);
list.append(&meta_box);
// Create a window and set the title // Create a window and set the title
let window = ApplicationWindow::builder() let window = ApplicationWindow::builder()
.application(app) .application(app)
.title("vshot") .title("vshot")
.child(&list)
.default_height(600)
.default_width(800)
.build(); .build();
// Present window // Present window

13
src/video.rs Normal file
View File

@ -0,0 +1,13 @@
use std::{
env,
sync::{Arc, Mutex},
};
use anyhow::Error;
use gstreamer::prelude::*;
fn try_play_video(uri: &str) -> Result<(), Error> {
print!("hello world!");
return Ok(())
}