initial mockup
This commit is contained in:
commit
af49339517
|
@ -0,0 +1,2 @@
|
|||
/target
|
||||
/Cargo.lock
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "youtube-dl-gtk"
|
||||
version = "0.1.0"
|
||||
authors = ["Max Bradbury <max@tinybird.info>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
gio = "^0"
|
||||
gtk = "^0"
|
|
@ -0,0 +1,49 @@
|
|||
use gio::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use std::env::args;
|
||||
use gtk::Orientation;
|
||||
|
||||
const SPACING: i32 = 16;
|
||||
|
||||
fn build_ui(application: >k::Application) {
|
||||
let window = gtk::ApplicationWindow::new(application);
|
||||
|
||||
window.set_title("youtube-dl");
|
||||
window.set_border_width(10);
|
||||
window.set_position(gtk::WindowPosition::Center);
|
||||
window.set_default_size(400, 100);
|
||||
|
||||
let vertical = gtk::Box::new(Orientation::Vertical, SPACING);
|
||||
let url = gtk::Entry::new();
|
||||
let horizontal = gtk::Box::new(Orientation::Horizontal, SPACING);
|
||||
let convert_to_mp3 = gtk::CheckButton::with_label("convert to mp3");
|
||||
let button = gtk::Button::with_label("Go!");
|
||||
|
||||
url.set_placeholder_text(Some("Enter URL here"));
|
||||
|
||||
horizontal.set_spacing(SPACING);
|
||||
horizontal.set_homogeneous(true);
|
||||
|
||||
window.add(&vertical);
|
||||
|
||||
vertical.add(&url);
|
||||
vertical.add(&horizontal);
|
||||
|
||||
horizontal.add(&convert_to_mp3);
|
||||
horizontal.add(&button);
|
||||
|
||||
window.show_all();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let application = gtk::Application::new(
|
||||
Some("dev.tinybird.max.youtube-dl-gtk"),
|
||||
Default::default()
|
||||
).expect("Initialization failed...");
|
||||
|
||||
application.connect_activate(|app| {
|
||||
build_ui(app);
|
||||
});
|
||||
|
||||
application.run(&args().collect::<Vec<_>>());
|
||||
}
|
Loading…
Reference in New Issue