Skip to content

Commit 440bde3

Browse files
committed
changed default image
1 parent e4fe2c8 commit 440bde3

File tree

6 files changed

+191
-171
lines changed

6 files changed

+191
-171
lines changed

resources/img/default_image.png

1.23 KB
Loading

src/app.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ live_design! {
199199
// Tooltips must be shown in front of all other UI elements,
200200
// since they can be shown as a hover atop any other widget.
201201
app_tooltip = <CalloutTooltip> {}
202-
202+
203203
image_viewer_modal = <ImageViewerModal> {}
204204
}
205205
} // end of body
@@ -248,6 +248,7 @@ impl LiveHook for App {
248248
// Here we set the global singleton for the PopupList widget,
249249
// which is used to access PopupList Widget from anywhere in the app.
250250
crate::shared::popup_list::set_global_popup_list(cx, &self.ui);
251+
crate::shared::image_viewer_modal::set_global_image_viewer_modal(cx, self.ui.image_viewer_modal(id!(image_viewer_modal)));
251252
}
252253
}
253254

@@ -257,7 +258,6 @@ impl MatchEvent for App {
257258
// such that background threads/tasks will be able to can access it.
258259
let _app_data_dir = crate::app_data_dir();
259260
log!("App::handle_startup(): app_data_dir: {:?}", _app_data_dir);
260-
crate::shared::image_viewer_modal::set_global_image_viewer_modal(cx, self.ui.image_viewer_modal(id!(image_viewer_modal)));
261261

262262
if let Err(e) = persistence::load_window_state(self.ui.window(id!(main_window)), cx) {
263263
error!("Failed to load window state: {}", e);
@@ -414,12 +414,6 @@ impl MatchEvent for App {
414414
continue;
415415
}
416416

417-
match action.as_widget_action().cast() {
418-
crate::shared::image_viewer_modal::ImageViewerAction::Clicked(mxc_uri) => {
419-
self.ui.image_viewer_modal(id!(image_viewer_modal)).open(cx, Some(mxc_uri));
420-
}
421-
_ => {}
422-
}
423417
// // message source modal handling.
424418
// match action.as_widget_action().cast() {
425419
// MessageAction::MessageSourceModalOpen { room_id: _, event_id: _, original_json: _ } => {

src/home/room_screen.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::{
3232
user_profile::{AvatarState, ShowUserProfileAction, UserProfile, UserProfileAndRoomId, UserProfilePaneInfo, UserProfileSlidingPaneRef, UserProfileSlidingPaneWidgetExt},
3333
user_profile_cache,
3434
}, shared::{
35-
avatar::AvatarWidgetRefExt, callout_tooltip::TooltipAction, html_or_plaintext::{HtmlOrPlaintextRef, HtmlOrPlaintextWidgetRefExt, RobrixHtmlLinkAction}, image_viewer_modal::ImageViewerModalWidgetExt, jump_to_bottom_button::{JumpToBottomButtonWidgetExt, UnreadMessageCount}, popup_list::{enqueue_popup_notification, PopupItem, PopupKind}, restore_status_view::RestoreStatusViewWidgetExt, styles::COLOR_FG_DANGER_RED, text_or_image::{TextOrImageRef, TextOrImageWidgetRefExt}, timestamp::TimestampWidgetRefExt, typing_animation::TypingAnimationWidgetExt
35+
avatar::AvatarWidgetRefExt, callout_tooltip::TooltipAction, html_or_plaintext::{HtmlOrPlaintextRef, HtmlOrPlaintextWidgetRefExt, RobrixHtmlLinkAction}, jump_to_bottom_button::{JumpToBottomButtonWidgetExt, UnreadMessageCount}, popup_list::{enqueue_popup_notification, PopupItem, PopupKind}, restore_status_view::RestoreStatusViewWidgetExt, styles::COLOR_FG_DANGER_RED, text_or_image::{TextOrImageRef, TextOrImageWidgetRefExt}, timestamp::TimestampWidgetRefExt, typing_animation::TypingAnimationWidgetExt
3636
}, sliding_sync::{get_client, submit_async_request, take_timeline_endpoints, BackwardsPaginateUntilEventRequest, MatrixRequest, PaginationDirection, TimelineRequestSender, UserPowerLevels}, utils::{self, room_name_or_id, unix_time_millis_to_datetime, ImageFormat, MEDIA_THUMBNAIL_FORMAT}
3737
};
3838
use crate::home::event_reaction_list::ReactionListWidgetRefExt;
@@ -753,7 +753,7 @@ live_design! {
753753
// The user profile sliding pane should be displayed on top of other "static" subviews
754754
// (on top of all other views that are always visible).
755755
user_profile_sliding_pane = <UserProfileSlidingPane> { }
756-
image_viewer_modal = <ImageViewerModal> {}
756+
757757
// The loading pane appears while the user is waiting for something in the room screen
758758
// to finish loading, e.g., when loading an older replied-to message.
759759
//loading_pane = <LoadingPane> { }
@@ -870,7 +870,6 @@ impl Widget for RoomScreen {
870870
// and wrap it in a `if let Event::Signal` conditional.
871871
user_profile_cache::process_user_profile_updates(cx);
872872
avatar_cache::process_avatar_updates(cx);
873-
874873
}
875874

876875
if let Event::Actions(actions) = event {
@@ -981,12 +980,6 @@ impl Widget for RoomScreen {
981980
);
982981
}
983982
}
984-
if let Some(crate::shared::image_viewer_modal::ImageViewerAction::Test) = action.downcast_ref() {
985-
println!("test");
986-
self.view.image_viewer_modal(id!(image_viewer_modal)).open(cx, None);
987-
}
988-
989-
990983
}
991984

992985
/*
@@ -1200,8 +1193,6 @@ impl Widget for RoomScreen {
12001193
// Forward the event to the inner timeline view, but capture any actions it produces
12011194
// such that we can handle the ones relevant to only THIS RoomScreen widget right here and now,
12021195
// ensuring they are not mistakenly handled by other RoomScreen widget instances.
1203-
self.view.handle_event(cx, event, &mut room_scope);
1204-
return;
12051196
let mut actions_generated_within_this_room_screen = cx.capture_actions(|cx|
12061197
self.view.handle_event(cx, event, &mut room_scope)
12071198
);
@@ -3556,10 +3547,6 @@ fn populate_image_message_content(
35563547
} else {
35573548
// Add click handler for the image
35583549
let _mxc_uri_clone = mxc_uri.clone();
3559-
// text_or_image_ref.set_image_click_handler(cx, move |cx| {
3560-
// let image_viewer_modal = cx.get_global::<ImageViewerModalRef>();
3561-
// image_viewer_modal.open(cx, mxc_uri_clone.clone());
3562-
// });
35633550
}
35643551

35653552
// We're done drawing the image, so mark it as fully drawn.
@@ -3608,13 +3595,6 @@ fn populate_image_message_content(
36083595
let err_str = format!("{body}\n\nFailed to display image: {e:?}");
36093596
error!("{err_str}");
36103597
text_or_image_ref.show_text(cx, &err_str);
3611-
} else {
3612-
// Add click handler for the blurhash image
3613-
let _mxc_uri_clone = mxc_uri.clone();
3614-
// text_or_image_ref.set_image_click_handler(cx, move |cx| {
3615-
// let image_viewer_modal = cx.get_global::<ImageViewerModalRef>();
3616-
// image_viewer_modal.open(cx, mxc_uri_clone.clone());
3617-
// });
36183598
}
36193599
}
36203600
fully_drawn = false;
@@ -4283,12 +4263,8 @@ impl Widget for Message {
42834263
// clickable or otherwise interactive.
42844264
match event.hits(cx, self.view(id!(replied_to_message)).area()) {
42854265
Hit::FingerDown(fe) => {
4286-
// cx.set_key_focus(self.view(id!(replied_to_message)).area());
4287-
// println!("Opening context menu for replied-to message preview");
4288-
//self.view.image_viewer_modal(id!(image_viewer_modal)).open(cx, None);
4266+
cx.set_key_focus(self.view(id!(replied_to_message)).area());
42894267
if fe.device.mouse_button().is_some_and(|b| b.is_secondary()) {
4290-
println!("Opening context menu for replied-to message preview");
4291-
self.view.image_viewer_modal(id!(image_viewer_modal)).open(cx, None);
42924268
cx.widget_action(
42934269
details.room_screen_widget_uid,
42944270
&scope.path,
@@ -4297,7 +4273,6 @@ impl Widget for Message {
42974273
abs_pos: fe.abs,
42984274
}
42994275
);
4300-
43014276
}
43024277
}
43034278
Hit::FingerLongPress(lp) => {
@@ -4336,11 +4311,8 @@ impl Widget for Message {
43364311
match event.hits(cx, message_view_area) {
43374312
Hit::FingerDown(fe) => {
43384313
cx.set_key_focus(message_view_area);
4339-
43404314
// A right click means we should display the context menu.
43414315
if fe.device.mouse_button().is_some_and(|b| b.is_secondary()) {
4342-
println!("Opening context menu for replied-to message preview");
4343-
cx.action(crate::shared::image_viewer_modal::ImageViewerAction::Test);
43444316
cx.widget_action(
43454317
details.room_screen_widget_uid,
43464318
&scope.path,

src/login/login_screen.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,6 @@ impl MatchEvent for LoginScreen {
330330
|| password_input.returned(actions).is_some()
331331
|| homeserver_input.returned(actions).is_some()
332332
{
333-
// let image_viewer_modal = crate::shared::image_viewer_modal::get_global_image_viewer_modal(cx);
334-
// image_viewer_modal.open(cx, None);
335-
// return;
336333
let user_id = user_id_input.text();
337334
let password = password_input.text();
338335
let homeserver = homeserver_input.text();

0 commit comments

Comments
 (0)