Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial gtk4 migration #39

Merged
merged 50 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6f48df3
Initial gtk4 migration
ochibani Sep 24, 2022
3c0ea6e
fix window size by changing main.ui
ochibani Sep 28, 2022
78d3fb6
display home icons in folder chooser
ochibani Sep 29, 2022
84cc6b3
area chooser window redesigned
ochibani Sep 30, 2022
8092950
spell check
ochibani Oct 1, 2022
835e466
remove wayland from ffmpeg-interface
ochibani Oct 14, 2022
3428d6d
Remove buggy video formats
ochibani Oct 14, 2022
56f5598
fix is_file_already_exists & play button
ochibani Oct 16, 2022
d9e7458
use system theme colors
xlmnxp Oct 18, 2022
a6ca6d3
look like fixed the video and audio merge
xlmnxp Oct 18, 2022
828074a
fix Progress dialog
xlmnxp Oct 18, 2022
336e8e4
hide window selection in wayland
ochibani Oct 18, 2022
71edab6
folder chooser parent
ochibani Oct 19, 2022
cec2d85
folder chooser hide
ochibani Oct 19, 2022
d1c4706
fix FileChooserButton
ochibani Oct 20, 2022
257c5b4
remove progress button
ochibani Oct 20, 2022
ad01c74
remove audio only record code
ochibani Oct 24, 2022
a3dbd29
add delay timer
ochibani Nov 1, 2022
f7c72ff
add recording timer
ochibani Nov 2, 2022
cbcb44d
add hours to timer
ochibani Nov 2, 2022
3e37cc9
minor change
ochibani Nov 4, 2022
258cda8
Edit indicator.rs
ochibani Nov 26, 2022
78ec81d
Working X11 version
ochibani Nov 26, 2022
fb32ebe
use 60fps as default
xlmnxp Feb 22, 2023
86303da
Merge branch 'blue-recorder-gtk4' of https://github.com/ochibani/blue…
xlmnxp Feb 22, 2023
c5189de
bug fixes, force select audio or video to record
xlmnxp Feb 22, 2023
a8f025e
use of Childs instead of kill command (Work cross multiple operating …
xlmnxp Feb 22, 2023
d82d71b
Simplify the implementation of Ffmpeg
xlmnxp Feb 23, 2023
b5b10cf
fix video and audio merges and fix audio recording issue
xlmnxp Feb 28, 2023
2ed389d
include tr.po with migration to GTK4
xlmnxp Mar 1, 2023
af982be
auto detect dark mode and change icons
xlmnxp Mar 1, 2023
3695530
improve style of select buttons
xlmnxp Oct 14, 2023
f857ba5
remove overwrite switch and fix message dialog
xlmnxp Oct 14, 2023
329c4a7
add wayland recorder
xlmnxp Oct 14, 2023
29b0a61
little improvements
xlmnxp Oct 15, 2023
aa9213a
little improvements
xlmnxp Oct 15, 2023
5d8f19f
update ui
ochibani Oct 16, 2023
7688528
update ui
ochibani Oct 17, 2023
8b7343c
add auto hide
ochibani Oct 19, 2023
b959262
add wayland record and mouse toggle
xlmnxp Oct 19, 2023
0e95762
refactor of code
xlmnxp Oct 21, 2023
5f847a0
remove progress dialog
xlmnxp Oct 21, 2023
5f079b8
fix borrow_mut
xlmnxp Oct 21, 2023
75df858
enable recording of window or screen
xlmnxp Oct 21, 2023
6c049e4
remove temporary video file when recording video only
xlmnxp Oct 21, 2023
510a1e5
enable recording of window or screen
xlmnxp Oct 21, 2023
5af98f9
remember last decision to record window or screen
xlmnxp Oct 22, 2023
4e4756e
update ui
ochibani Oct 23, 2023
591a671
remove appid from gtk part
xlmnxp Oct 27, 2023
d10fdf7
upgrade snap packaging
xlmnxp Oct 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add recording timer
  • Loading branch information
ochibani committed Nov 2, 2022
commit f7c72ff8a59b8284636efe87752bc05a90749085
10 changes: 8 additions & 2 deletions interfaces/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<property name="decorated">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="icon-name">blue-recorder</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar2">
<property name="visible">True</property>
Expand Down Expand Up @@ -104,6 +103,7 @@
</child>
</object>
<object class="GtkWindow" id="delay_window">
<property name="name">delay_window</property>
<property name="can-focus">True</property>
<property name="transient-for">main_window</property>
<property name="resizable">False</property>
Expand Down Expand Up @@ -132,7 +132,7 @@
</object>
</child>
<child type="bottom">
<object class="GtkButton" id="delay_window_stopbutton">
<object class="GtkToggleButton" id="delay_window_stopbutton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
Expand Down Expand Up @@ -594,6 +594,12 @@
</child>
</object>
</child>
<child>
<object class="GtkLabel" id="record_time_label">
<property name="visible">False</property>
<property name="can-focus">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="playbutton">
<property name="icon_name">media-playback-start</property>
Expand Down
17 changes: 14 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::ops::Add;
use std::path::Path;
use std::process::{Command, Stdio};
use std::rc::Rc;
use timer::{recording_delay};
use timer::{recording_delay, start_timer, stop_timer};

fn main() {
// Create new application
Expand Down Expand Up @@ -75,7 +75,7 @@ pub fn build_ui(application: &Application) {
let delay_spin: SpinButton = builder.object("delay").unwrap();
let delay_window: Window = builder.object("delay_window").unwrap();
let delay_window_label: Label = builder.object("delay_window_label").unwrap();
let delay_window_button: Button = builder.object("delay_window_stopbutton").unwrap();
let delay_window_button: ToggleButton = builder.object("delay_window_stopbutton").unwrap();
let filename_entry: Entry = builder.object("filename").unwrap();
let folder_chooser_button: Button = builder.object("folder_chooser").unwrap();
let folder_chooser_image: Image = builder.object("folder_chooser_image").unwrap();
Expand All @@ -91,6 +91,7 @@ pub fn build_ui(application: &Application) {
let progress_dialog: MessageDialog = builder.object("progress_dialog").unwrap();
let progressbar: ProgressBar = builder.object("progressbar").unwrap();
let record_button: Button = builder.object("recordbutton").unwrap();
let record_time_label: Label = builder.object("record_time_label").unwrap();
let screen_grab_button: ToggleButton = builder.object("screen_grab_button").unwrap();
let screen_grab_icon: Image = builder.object("screen_grab_icon").unwrap();
let stop_button: Button = builder.object("stopbutton").unwrap();
Expand Down Expand Up @@ -404,12 +405,16 @@ pub fn build_ui(application: &Application) {
}));

let _delay_window = delay_window.clone();
let _delay_window_button = delay_window_button.clone();
let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone();
let _play_button = play_button.clone();
let _record_button = record_button.clone();
let _record_time_label = record_time_label.clone();
let _stop_button = stop_button.clone();
record_button.connect_clicked(move |_| {
_delay_window_button.set_active(false);
if delay_spin.value()as u64 > 0 {
recording_delay(delay_spin.clone(), delay_spin.value()as u64, delay_window.clone(), delay_window_label.clone(), _record_button.clone());
recording_delay(delay_spin.clone(), delay_spin.value()as u64, delay_window.clone(), _delay_window_button.clone(), delay_window_label.clone(), _record_button.clone());
}
if delay_spin.value()as u64 == 0 {
let _area_capture = area_capture.borrow_mut();
Expand All @@ -423,20 +428,26 @@ pub fn build_ui(application: &Application) {
// Do nothing if the start_record function return nothing
}
_ => {
start_timer(record_time_label.clone());
record_time_label.set_visible(true);
_play_button.hide();
_record_button.hide();
_stop_button.show();
}
}
}
});

let _delay_window_button = delay_window_button.clone();
delay_window_button.connect_clicked(move |_| {
});

let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone();
let _play_button = play_button.clone();
let _stop_button = stop_button.clone();
stop_button.connect_clicked(move |_| {
_record_time_label.set_visible(false);
stop_timer(_record_time_label.clone());
_ffmpeg_record_interface.borrow_mut().clone().stop_record();
record_button.show();
_stop_button.hide();
Expand Down
3 changes: 3 additions & 0 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
background: @theme_selected_bg_color;
}

#delay_window {
border: 3px solid @theme_selected_bg_color;
}
#delay_window_label{
font-size: 350%;
font-weight: 250;
Expand Down
40 changes: 33 additions & 7 deletions src/timer.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
extern crate secfmt;

use gtk::glib;
use gtk::{Button, Label, SpinButton, Window};
use gtk::{Button, ToggleButton, Label, SpinButton, Window};
use gtk::prelude::*;

pub fn recording_delay(delay_spin: SpinButton, mut delay_time: u64, delay_window: Window, delay_window_label: Label, record_button: Button) {
pub fn recording_delay(delay_spin: SpinButton, mut delay_time: u64, delay_window: Window, delay_window_button: ToggleButton, delay_window_label: Label, record_button: Button) {
// Keep time label alive and update every 1sec
let default_value = delay_time;
let capture_label = move || {
let capture_delay_label = move || {
// Show delay window if delay time is not zero
delay_window.show();
if delay_time > 0 {
if delay_time > 0 {
delay_window_label.set_text(&current_time(delay_time));
delay_time -= 1;
glib::source::Continue(true)
if delay_window_button.is_active() {
delay_window.hide();
glib::source::Continue(false)
} else {
glib::source::Continue(true)
}
} else {
// Hide delay window and start recording
delay_window.hide();
Expand All @@ -25,10 +30,31 @@ pub fn recording_delay(delay_spin: SpinButton, mut delay_time: u64, delay_window
}
};
// Execute capture_label every 1sec
glib::source::timeout_add_seconds_local(1, capture_label);
glib::source::timeout_add_seconds_local(1, capture_delay_label);
}

pub fn start_timer(record_time_label: Label) {
let mut start_time = 0;
let capture_record_label = move || {
if record_time_label.is_visible() {
record_time_label.set_text(&current_time(start_time));
start_time += 1;
glib::source::Continue(true)
} else {
glib::source::Continue(false)
}
};
// Execute capture_label every 1sec
glib::source::timeout_add_seconds_local(1, capture_record_label);
}

pub fn stop_timer(record_time_label: Label) {
let stop_time = 0;
record_time_label.set_text(&current_time(stop_time));
}


fn current_time(delay_time: u64) -> String {
let delay = secfmt::from(delay_time);
format!("{}:{}", delay.minutes, delay.seconds)
format!("{:02}:{:02}", delay.minutes, delay.seconds)
}