mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2024-11-23 17:13:11 +03:00
define all objects and improve the UI
This commit is contained in:
parent
cf6e694321
commit
f1e9e7677f
41
src/main.rs
41
src/main.rs
@ -4,7 +4,10 @@ mod config_management;
|
||||
|
||||
use gio::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{Builder, Window};
|
||||
use gtk::{
|
||||
Adjustment, Builder, Button, CheckButton, ComboBox, Entry, FileChooser, Label, MenuItem,
|
||||
SpinButton, Window, Dialog
|
||||
};
|
||||
use std::path::Path;
|
||||
fn main() {
|
||||
if gtk::init().is_err() {
|
||||
@ -17,7 +20,43 @@ fn main() {
|
||||
config_management::set("default", "frame", "30");
|
||||
// get Objects from UI
|
||||
let main_window: Window = builder.get_object("window1").unwrap();
|
||||
let about_dialog: Dialog = builder.get_object("aboutdialog").unwrap();
|
||||
let area_chooser: Window = builder.get_object("window2").unwrap();
|
||||
let folder_chooser: FileChooser = builder.get_object("filechooser").unwrap();
|
||||
let filename_entry: Entry = builder.get_object("filename").unwrap();
|
||||
let command_entry: Entry = builder.get_object("command").unwrap();
|
||||
let format_chooser: ComboBox = builder.get_object("comboboxtext1").unwrap();
|
||||
let audio_source: ComboBox = builder.get_object("audiosource").unwrap();
|
||||
let record_button: Button = builder.get_object("recordbutton").unwrap();
|
||||
let stop_button: Button = builder.get_object("stopbutton").unwrap();
|
||||
let window_grab_button: Button = builder.get_object("button4").unwrap();
|
||||
let area_grab_button: Button = builder.get_object("button5").unwrap();
|
||||
let frame_text: Label = builder.get_object("label2").unwrap();
|
||||
let delay_text: Label = builder.get_object("label3").unwrap();
|
||||
let command_text: Label = builder.get_object("label6").unwrap();
|
||||
let frames_spin: SpinButton = builder.get_object("frames").unwrap();
|
||||
let delay_spin: SpinButton = builder.get_object("delay").unwrap();
|
||||
let audio_source_label: Label = builder.get_object("audiosourcelabel").unwrap();
|
||||
let delay_adjustment: Adjustment = builder.get_object("adjustment1").unwrap();
|
||||
let frames_adjustment: Adjustment = builder.get_object("adjustment2").unwrap();
|
||||
let delay_pref_adjustment: Adjustment = builder.get_object("adjustment3").unwrap();
|
||||
let play_button: Button = builder.get_object("playbutton").unwrap();
|
||||
let video_switch: CheckButton = builder.get_object("videoswitch").unwrap();
|
||||
let audio_switch: CheckButton = builder.get_object("audioswitch").unwrap();
|
||||
let mouse_switch: CheckButton = builder.get_object("mouseswitch").unwrap();
|
||||
let follow_mouse_switch: CheckButton = builder.get_object("followmouseswitch").unwrap();
|
||||
let about_menu_item: MenuItem = builder.get_object("item2").unwrap();
|
||||
|
||||
// --- default properties
|
||||
about_menu_item.set_label("about");
|
||||
|
||||
|
||||
// --- connections
|
||||
// show dialog window when about button clicked then hide it after close
|
||||
about_menu_item.connect_activate(move |_| {
|
||||
&about_dialog.run();
|
||||
&about_dialog.hide();
|
||||
});
|
||||
// close the application when main window destroy
|
||||
main_window.connect_destroy(|_| {
|
||||
std::process::exit(0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<object class="GtkAboutDialog" id="aboutdialog">
|
||||
@ -7,7 +7,7 @@
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="logo_icon_name">blue-recorder</property>
|
||||
<child>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
@ -55,7 +55,7 @@
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
<property name="icon_name">media-playback-start</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
@ -87,14 +87,42 @@
|
||||
<property name="show_close_button">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="recordbutton">
|
||||
<property name="label">gtk-media-record</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">half</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="recordclicked" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">2</property>
|
||||
<property name="row_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">media-record</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Record</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -102,9 +130,15 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image5</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="stoprecordingclicked" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">media-playback-stop</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
@ -504,14 +538,42 @@
|
||||
<property name="show_close_button">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="areasettings">
|
||||
<property name="label">gtk-apply</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">half</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="areasettings" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">3</property>
|
||||
<property name="row_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">dialog-ok</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Apply</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user