2023-12-02 15:21:29 +01:00
|
|
|
use gtk::{prelude::*,ListBox, glib, Application, ApplicationWindow, Button, Video, Box, LayoutManager, ffi::gtk_layout_manager_allocate};
|
|
|
|
|
|
|
|
mod video;
|
2023-12-02 14:01:18 +01:00
|
|
|
|
|
|
|
const APP_ID: &str = "de.cscherr.vshot";
|
|
|
|
|
|
|
|
fn main() -> glib::ExitCode {
|
|
|
|
// Create a new application
|
|
|
|
let app = Application::builder().application_id(APP_ID).build();
|
|
|
|
|
|
|
|
// Connect to "activate" signal of `app`
|
|
|
|
app.connect_activate(build_ui);
|
|
|
|
|
|
|
|
// Run the application
|
|
|
|
app.run()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn build_ui(app: &Application) {
|
2023-12-02 15:21:29 +01:00
|
|
|
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);
|
|
|
|
|
2023-12-02 14:01:18 +01:00
|
|
|
// Create a window and set the title
|
|
|
|
let window = ApplicationWindow::builder()
|
|
|
|
.application(app)
|
|
|
|
.title("vshot")
|
2023-12-02 15:21:29 +01:00
|
|
|
.child(&list)
|
|
|
|
.default_height(600)
|
|
|
|
.default_width(800)
|
2023-12-02 14:01:18 +01:00
|
|
|
.build();
|
|
|
|
|
|
|
|
// Present window
|
|
|
|
window.present();
|
|
|
|
}
|