mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-04 08:54:21 +01:00
notedeck: include frame history
for debugging. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -2,8 +2,8 @@ use crate::persist::{AppSizeHandler, ZoomHandler};
|
||||
use crate::wallet::GlobalWallet;
|
||||
use crate::zaps::Zaps;
|
||||
use crate::{
|
||||
AccountStorage, Accounts, AppContext, Args, DataPath, DataPathType, Directory, Images,
|
||||
NoteCache, RelayDebugView, ThemeHandler, UnknownIds,
|
||||
frame_history::FrameHistory, AccountStorage, Accounts, AppContext, Args, DataPath,
|
||||
DataPathType, Directory, Images, NoteCache, RelayDebugView, ThemeHandler, UnknownIds,
|
||||
};
|
||||
use egui::ThemePreference;
|
||||
use egui_winit::clipboard::Clipboard;
|
||||
@@ -37,6 +37,7 @@ pub struct Notedeck {
|
||||
unrecognized_args: BTreeSet<String>,
|
||||
clipboard: Clipboard,
|
||||
zaps: Zaps,
|
||||
frame_history: FrameHistory,
|
||||
}
|
||||
|
||||
/// Our chrome, which is basically nothing
|
||||
@@ -79,8 +80,10 @@ fn render_notedeck(notedeck: &mut Notedeck, ctx: &egui::Context) {
|
||||
}
|
||||
|
||||
impl eframe::App for Notedeck {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||
profiling::finish_frame!();
|
||||
self.frame_history
|
||||
.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage);
|
||||
|
||||
// handle account updates
|
||||
self.accounts.update(&mut self.ndb, &mut self.pool, ctx);
|
||||
@@ -227,6 +230,7 @@ impl Notedeck {
|
||||
zoom,
|
||||
app_size,
|
||||
unrecognized_args,
|
||||
frame_history: FrameHistory::default(),
|
||||
clipboard: Clipboard::new(None),
|
||||
zaps,
|
||||
}
|
||||
@@ -251,6 +255,7 @@ impl Notedeck {
|
||||
theme: &mut self.theme,
|
||||
clipboard: &mut self.clipboard,
|
||||
zaps: &mut self.zaps,
|
||||
frame_history: &mut self.frame_history,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
wallet::GlobalWallet, zaps::Zaps, Accounts, Args, DataPath, Images, NoteCache, ThemeHandler,
|
||||
UnknownIds,
|
||||
frame_history::FrameHistory, wallet::GlobalWallet, zaps::Zaps, Accounts, Args, DataPath,
|
||||
Images, NoteCache, ThemeHandler, UnknownIds,
|
||||
};
|
||||
use egui_winit::clipboard::Clipboard;
|
||||
|
||||
@@ -22,4 +22,5 @@ pub struct AppContext<'a> {
|
||||
pub theme: &'a mut ThemeHandler,
|
||||
pub clipboard: &'a mut Clipboard,
|
||||
pub zaps: &'a mut Zaps,
|
||||
pub frame_history: &'a mut FrameHistory,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/*
|
||||
use egui::util::History;
|
||||
|
||||
pub struct FrameHistory {
|
||||
@@ -47,4 +46,3 @@ impl FrameHistory {
|
||||
egui::warn_if_debug_build(ui);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -6,6 +6,7 @@ pub mod debouncer;
|
||||
mod error;
|
||||
pub mod filter;
|
||||
pub mod fonts;
|
||||
mod frame_history;
|
||||
mod imgcache;
|
||||
mod muted;
|
||||
pub mod note;
|
||||
|
||||
@@ -177,18 +177,24 @@ impl Chrome {
|
||||
}
|
||||
};
|
||||
|
||||
if support_button(ui).clicked() {
|
||||
return Some(ChromePanelAction::Support);
|
||||
}
|
||||
let support_resp = support_button(ui);
|
||||
|
||||
if theme_action.is_some() {
|
||||
return theme_action;
|
||||
if ctx.args.debug {
|
||||
ui.weak(format!("{}", ctx.frame_history.fps() as i32));
|
||||
ui.weak(format!(
|
||||
"{:10.1}",
|
||||
ctx.frame_history.mean_frame_time() * 1e3
|
||||
));
|
||||
}
|
||||
|
||||
if pfp_resp.clicked() {
|
||||
Some(ChromePanelAction::Account)
|
||||
} else if settings_resp.clicked() {
|
||||
Some(ChromePanelAction::Settings)
|
||||
} else if theme_action.is_some() {
|
||||
theme_action
|
||||
} else if support_resp.clicked() {
|
||||
Some(ChromePanelAction::Support)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ mod column;
|
||||
mod deck_state;
|
||||
mod decks;
|
||||
mod draft;
|
||||
mod frame_history;
|
||||
mod key_parsing;
|
||||
pub mod login_manager;
|
||||
mod media_upload;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use notedeck_ui::colors::PINK;
|
||||
use egui::{
|
||||
Align, Button, Frame, Image, InnerResponse, Layout, RichText, ScrollArea, Ui, UiBuilder, Vec2,
|
||||
};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::{Accounts, Images};
|
||||
use notedeck_ui::colors::PINK;
|
||||
|
||||
use super::profile::preview::SimpleProfilePreview;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use notedeck_ui::colors::PINK;
|
||||
use crate::relay_pool_manager::{RelayPoolManager, RelayStatus};
|
||||
use crate::ui::{Preview, PreviewConfig, View};
|
||||
use egui::{
|
||||
Align, Button, CornerRadius, Frame, Id, Image, Layout, Margin, Rgba, RichText, Ui, Vec2,
|
||||
};
|
||||
use notedeck_ui::colors::PINK;
|
||||
|
||||
use enostr::RelayPool;
|
||||
use notedeck::{Accounts, NotedeckTextStyle};
|
||||
|
||||
@@ -193,7 +193,11 @@ fn goto_top_button(center: Pos2) -> impl egui::Widget {
|
||||
});
|
||||
|
||||
let painter = ui.painter();
|
||||
painter.circle_filled(center, helper.scale_1d_pos(radius), notedeck_ui::colors::PINK);
|
||||
painter.circle_filled(
|
||||
center,
|
||||
helper.scale_1d_pos(radius),
|
||||
notedeck_ui::colors::PINK,
|
||||
);
|
||||
|
||||
let create_pt = |angle: f32| {
|
||||
let side = radius / 2.0;
|
||||
|
||||
@@ -352,6 +352,7 @@ impl DaveAvatar {
|
||||
.multiply(&z_rotation)
|
||||
.multiply(&self.rotation);
|
||||
|
||||
tracing::trace!("repainting due to avatar rotation");
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
mod anim;
|
||||
pub mod colors;
|
||||
pub mod gif;
|
||||
pub mod icons;
|
||||
pub mod images;
|
||||
pub mod profile;
|
||||
pub mod icons;
|
||||
|
||||
pub use anim::AnimationHelper;
|
||||
pub use profile::ProfilePic;
|
||||
|
||||
Reference in New Issue
Block a user