mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2024-11-23 17:13:11 +03:00
remove overwrite switch and fix message dialog
This commit is contained in:
parent
369553007c
commit
f857ba542c
@ -187,15 +187,6 @@
|
|||||||
<property name="margin-bottom">5</property>
|
<property name="margin-bottom">5</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkCheckButton" id="overwriteswitch">
|
|
||||||
<property name="label" translatable="yes">checkbutton</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">False</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="folder_chooser">
|
<object class="GtkButton" id="folder_chooser">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
extern crate subprocess;
|
extern crate subprocess;
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use gettextrs::gettext;
|
use gettextrs::gettext;
|
||||||
use gtk::prelude::*;
|
use gtk::{prelude::*, ResponseType};
|
||||||
use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType};
|
use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType};
|
||||||
use gtk::{CheckButton, ComboBoxText, Entry, FileChooserNative, ProgressBar, SpinButton, Window};
|
use gtk::{CheckButton, ComboBoxText, Entry, FileChooserNative, ProgressBar, SpinButton, Window};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@ -12,6 +12,7 @@ use std::sync::mpsc::Sender;
|
|||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use subprocess::Exec;
|
use subprocess::Exec;
|
||||||
|
use crate::wayland_record::WaylandRecorder;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ProgressWidget {
|
pub struct ProgressWidget {
|
||||||
@ -60,7 +61,7 @@ pub struct Ffmpeg {
|
|||||||
pub unbound: Option<Sender<bool>>,
|
pub unbound: Option<Sender<bool>>,
|
||||||
pub progress_widget: ProgressWidget,
|
pub progress_widget: ProgressWidget,
|
||||||
pub window: Window,
|
pub window: Window,
|
||||||
pub overwrite: CheckButton,
|
pub record_wayland: WaylandRecorder
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ffmpeg {
|
impl Ffmpeg {
|
||||||
@ -89,21 +90,21 @@ impl Ffmpeg {
|
|||||||
let is_file_already_exists =
|
let is_file_already_exists =
|
||||||
std::path::Path::new(&self.saved_filename.clone().unwrap()).exists();
|
std::path::Path::new(&self.saved_filename.clone().unwrap()).exists();
|
||||||
|
|
||||||
if !self.overwrite.is_active() && is_file_already_exists {
|
if is_file_already_exists {
|
||||||
let message_dialog = MessageDialog::new(
|
let message_dialog = MessageDialog::new(
|
||||||
Some(&self.window),
|
Some(&self.window),
|
||||||
DialogFlags::empty(),
|
DialogFlags::all(),
|
||||||
MessageType::Question,
|
MessageType::Warning,
|
||||||
ButtonsType::YesNo,
|
ButtonsType::YesNo,
|
||||||
&gettext("File already exist. Do you want to overwrite it?"),
|
&gettext("File already exist. Do you want to overwrite it?"),
|
||||||
);
|
);
|
||||||
|
|
||||||
message_dialog
|
let answer = glib::MainContext::default().block_on(message_dialog.run_future());
|
||||||
.connect_response(|message_dialog: &MessageDialog, _| message_dialog.hide());
|
message_dialog.close();
|
||||||
|
|
||||||
message_dialog.show();
|
if answer != ResponseType::Yes {
|
||||||
|
return None;
|
||||||
return None;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.record_audio.is_active() {
|
if self.record_audio.is_active() {
|
||||||
|
11
src/main.rs
11
src/main.rs
@ -24,7 +24,6 @@ use std::process::{Command, Stdio};
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use timer::{recording_delay, start_timer, stop_timer};
|
use timer::{recording_delay, start_timer, stop_timer};
|
||||||
use wayland_record::WaylandRecorder;
|
use wayland_record::WaylandRecorder;
|
||||||
use futures::executor;
|
|
||||||
|
|
||||||
|
|
||||||
#[async_std::main]
|
#[async_std::main]
|
||||||
@ -95,7 +94,6 @@ pub fn build_ui(application: &Application) {
|
|||||||
let frames_spin: SpinButton = builder.object("frames").unwrap();
|
let frames_spin: SpinButton = builder.object("frames").unwrap();
|
||||||
let main_window: Window = builder.object("main_window").unwrap();
|
let main_window: Window = builder.object("main_window").unwrap();
|
||||||
let mouse_switch: CheckButton = builder.object("mouseswitch").unwrap();
|
let mouse_switch: CheckButton = builder.object("mouseswitch").unwrap();
|
||||||
let overwrite_switch: CheckButton = builder.object("overwriteswitch").unwrap();
|
|
||||||
let play_button: Button = builder.object("playbutton").unwrap();
|
let play_button: Button = builder.object("playbutton").unwrap();
|
||||||
let progress_dialog: MessageDialog = builder.object("progress_dialog").unwrap();
|
let progress_dialog: MessageDialog = builder.object("progress_dialog").unwrap();
|
||||||
let progressbar: ProgressBar = builder.object("progressbar").unwrap();
|
let progressbar: ProgressBar = builder.object("progressbar").unwrap();
|
||||||
@ -120,8 +118,10 @@ pub fn build_ui(application: &Application) {
|
|||||||
|
|
||||||
// Hide window grab button in Wayland
|
// Hide window grab button in Wayland
|
||||||
if is_wayland() {
|
if is_wayland() {
|
||||||
|
area_grab_button.set_can_focus(false);
|
||||||
area_grab_button.set_can_target(false);
|
area_grab_button.set_can_target(false);
|
||||||
area_grab_button.add_css_class("disabled")
|
area_grab_button.add_css_class("disabled");
|
||||||
|
area_grab_button.set_tooltip_text(Some(&gettext("Not supported in Wayland")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entries
|
// Entries
|
||||||
@ -182,12 +182,10 @@ pub fn build_ui(application: &Application) {
|
|||||||
audio_switch.set_label(Some(&gettext("Record Audio")));
|
audio_switch.set_label(Some(&gettext("Record Audio")));
|
||||||
mouse_switch.set_label(Some(&gettext("Show Mouse")));
|
mouse_switch.set_label(Some(&gettext("Show Mouse")));
|
||||||
follow_mouse_switch.set_label(Some(&gettext("Follow Mouse")));
|
follow_mouse_switch.set_label(Some(&gettext("Follow Mouse")));
|
||||||
overwrite_switch.set_label(Some(&gettext("Overwrite")));
|
|
||||||
video_switch.set_active(config_management::get_bool("default", "videocheck"));
|
video_switch.set_active(config_management::get_bool("default", "videocheck"));
|
||||||
audio_switch.set_active(config_management::get_bool("default", "audiocheck"));
|
audio_switch.set_active(config_management::get_bool("default", "audiocheck"));
|
||||||
mouse_switch.set_active(config_management::get_bool("default", "mousecheck"));
|
mouse_switch.set_active(config_management::get_bool("default", "mousecheck"));
|
||||||
follow_mouse_switch.set_active(config_management::get_bool("default", "followmousecheck"));
|
follow_mouse_switch.set_active(config_management::get_bool("default", "followmousecheck"));
|
||||||
overwrite_switch.set_active(config_management::get_bool("default", "overwritecheck"));
|
|
||||||
|
|
||||||
let _video_switch = video_switch.clone();
|
let _video_switch = video_switch.clone();
|
||||||
let _audio_switch = audio_switch.clone();
|
let _audio_switch = audio_switch.clone();
|
||||||
@ -473,9 +471,8 @@ pub fn build_ui(application: &Application) {
|
|||||||
unbound: None,
|
unbound: None,
|
||||||
progress_widget: ProgressWidget::new(progress_dialog, progressbar),
|
progress_widget: ProgressWidget::new(progress_dialog, progressbar),
|
||||||
window: main_window.clone(),
|
window: main_window.clone(),
|
||||||
overwrite: overwrite_switch,
|
|
||||||
record_delay: delay_spin,
|
record_delay: delay_spin,
|
||||||
record_wayland: executor::block_on(WaylandRecorder::new())
|
record_wayland: glib::MainContext::default().block_on(WaylandRecorder::new())
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Record Button
|
// Record Button
|
||||||
|
Loading…
Reference in New Issue
Block a user