debug: Add more tracing for initial operations
This commit is contained in:
parent
23918bf31e
commit
a7116925bf
5 changed files with 24 additions and 0 deletions
|
|
@ -75,11 +75,13 @@ mod imp {
|
||||||
// Overrides GApplication vfuncs
|
// Overrides GApplication vfuncs
|
||||||
impl ApplicationImpl for LpApplication {
|
impl ApplicationImpl for LpApplication {
|
||||||
fn startup(&self) {
|
fn startup(&self) {
|
||||||
|
log::trace!("Startup");
|
||||||
self.parent_startup();
|
self.parent_startup();
|
||||||
LpShyBin::ensure_type();
|
LpShyBin::ensure_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn activate(&self) {
|
fn activate(&self) {
|
||||||
|
log::trace!("Activate");
|
||||||
let application = self.obj();
|
let application = self.obj();
|
||||||
let window = LpWindow::new(&*application);
|
let window = LpWindow::new(&*application);
|
||||||
window.present();
|
window.present();
|
||||||
|
|
@ -87,6 +89,7 @@ mod imp {
|
||||||
|
|
||||||
// Handles opening files from the command line or other applications
|
// Handles opening files from the command line or other applications
|
||||||
fn open(&self, files: &[gio::File], _hint: &str) {
|
fn open(&self, files: &[gio::File], _hint: &str) {
|
||||||
|
log::trace!("Open {} file(s)", files.len());
|
||||||
let application = self.obj();
|
let application = self.obj();
|
||||||
let win = LpWindow::new(&*application);
|
let win = LpWindow::new(&*application);
|
||||||
win.image_view().set_images_from_files(files.to_vec());
|
win.image_view().set_images_from_files(files.to_vec());
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ impl Glycin {
|
||||||
let (next_frame_send, next_frame_recv) = async_channel::bounded(2);
|
let (next_frame_send, next_frame_recv) = async_channel::bounded(2);
|
||||||
|
|
||||||
updater.clone().spawn_error_handled(async move {
|
updater.clone().spawn_error_handled(async move {
|
||||||
|
log::trace!("Setting up loader");
|
||||||
let mut image_request = glycin::Loader::new(file);
|
let mut image_request = glycin::Loader::new(file);
|
||||||
|
|
||||||
#[cfg(feature = "disable-glycin-sandbox")]
|
#[cfg(feature = "disable-glycin-sandbox")]
|
||||||
|
|
@ -56,6 +57,7 @@ impl Glycin {
|
||||||
image_request.cancellable(cancellable_);
|
image_request.cancellable(cancellable_);
|
||||||
|
|
||||||
let image = image_request.request().await?;
|
let image = image_request.request().await?;
|
||||||
|
log::trace!("Image info received");
|
||||||
|
|
||||||
let mut metadata: Metadata = Metadata::default();
|
let mut metadata: Metadata = Metadata::default();
|
||||||
metadata.set_image_info(image.info().details.clone());
|
metadata.set_image_info(image.info().details.clone());
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,19 @@ fn main() -> glib::ExitCode {
|
||||||
|
|
||||||
log_builder.init();
|
log_builder.init();
|
||||||
|
|
||||||
|
log::debug!("Logger initialized");
|
||||||
|
|
||||||
setlocale(LocaleCategory::LcAll, "");
|
setlocale(LocaleCategory::LcAll, "");
|
||||||
bindtextdomain("loupe", config::LOCALEDIR).unwrap();
|
bindtextdomain("loupe", config::LOCALEDIR).unwrap();
|
||||||
textdomain("loupe").unwrap();
|
textdomain("loupe").unwrap();
|
||||||
|
|
||||||
|
log::trace!("gettext initialized");
|
||||||
|
|
||||||
gio::resources_register(
|
gio::resources_register(
|
||||||
&gio::Resource::from_data(&glib::Bytes::from_static(GRESOURCE_BYTES)).unwrap(),
|
&gio::Resource::from_data(&glib::Bytes::from_static(GRESOURCE_BYTES)).unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log::trace!("Gio resources registered");
|
||||||
|
|
||||||
LpApplication::new().run()
|
LpApplication::new().run()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,9 @@ mod imp {
|
||||||
pub(super) widget_dimensions: Cell<(i32, i32)>,
|
pub(super) widget_dimensions: Cell<(i32, i32)>,
|
||||||
pub(super) scaling: Cell<f64>,
|
pub(super) scaling: Cell<f64>,
|
||||||
pub(super) surface_signals: OnceCell<SignalGroup>,
|
pub(super) surface_signals: OnceCell<SignalGroup>,
|
||||||
|
|
||||||
|
/// Number of snapshots created, debug only
|
||||||
|
pub(super) nth_snapshot: Cell<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[glib::object_subclass]
|
#[glib::object_subclass]
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,12 @@ impl WidgetImpl for imp::LpImage {
|
||||||
|
|
||||||
let applicable_zoom = self.applicable_zoom();
|
let applicable_zoom = self.applicable_zoom();
|
||||||
|
|
||||||
|
let nth_snaphot = self.nth_snapshot.get() + 1;
|
||||||
|
if nth_snaphot < 3 {
|
||||||
|
self.nth_snapshot.set(nth_snaphot);
|
||||||
|
log::trace!("Creating snapshot #{nth_snaphot}");
|
||||||
|
}
|
||||||
|
|
||||||
let scaling_filter = if obj.metadata().is_svg() {
|
let scaling_filter = if obj.metadata().is_svg() {
|
||||||
// Looks better in SVG animations and avoids rendering issues
|
// Looks better in SVG animations and avoids rendering issues
|
||||||
gsk::ScalingFilter::Linear
|
gsk::ScalingFilter::Linear
|
||||||
|
|
@ -125,6 +131,10 @@ impl WidgetImpl for imp::LpImage {
|
||||||
.add_to_snapshot(snapshot, applicable_zoom, &render_options);
|
.add_to_snapshot(snapshot, applicable_zoom, &render_options);
|
||||||
|
|
||||||
snapshot.restore();
|
snapshot.restore();
|
||||||
|
|
||||||
|
if nth_snaphot < 3 {
|
||||||
|
log::trace!("Snapshot #{nth_snaphot} created");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn measure(&self, orientation: gtk::Orientation, _for_size: i32) -> (i32, i32, i32, i32) {
|
fn measure(&self, orientation: gtk::Orientation, _for_size: i32) -> (i32, i32, i32, i32) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue