diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 16 | ||||
-rw-r--r-- | src/plugins/FileManager.cpp | 18 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index e93536b..873bd31 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -319,7 +319,7 @@ namespace QuickMedia { fprintf(stderr, " --use-system-mpv-config Use system mpv config instead of no config. Disabled by default\n"); fprintf(stderr, " --upscale-images Upscale low-resolution manga pages using waifu2x-ncnn-vulkan. Disabled by default\n"); fprintf(stderr, " --upscale-images-always Upscale manga pages using waifu2x-ncnn-vulkan, no matter what the original image resolution is. Disabled by default\n"); - fprintf(stderr, " --dir <directory> Set the start directory when using file-manager. Default is the last accessed directory in QuickMedia or the users home directory\n"); + fprintf(stderr, " --dir <directory> Set the start directory when using file-manager. Default is the the users home directory\n"); fprintf(stderr, " -e <window> Embed QuickMedia into another window\n"); fprintf(stderr, "EXAMPLES:\n"); fprintf(stderr, " quickmedia launcher\n"); @@ -4861,8 +4861,10 @@ namespace QuickMedia { const float logo_padding_x = std::floor(15.0f * get_ui_scale()); const float chat_input_padding_x = std::floor(10.0f * get_ui_scale()); const float chat_input_padding_y = std::floor(10.0f * get_ui_scale()); + + bool avatar_applied = false; - auto launch_url = [this, matrix_chat_page, &video_page, &redraw](const std::string &url) mutable { + auto launch_url = [this, matrix_chat_page, &video_page, &redraw, &avatar_applied](const std::string &url) mutable { if(url.empty()) return; @@ -4876,6 +4878,7 @@ namespace QuickMedia { // TODO: Add title video_content_page(matrix_chat_page, video_page.get(), "", false, next_items, 0); redraw = true; + avatar_applied = false; } else { const char *launch_program = "xdg-open"; if(!is_program_executable_by_name("xdg-open")) { @@ -4933,7 +4936,7 @@ namespace QuickMedia { } }; - auto display_url_or_image = [this, matrix_chat_page, &ui_tabs, &redraw, &video_page, &launch_url, &chat_state, &url_selection_body, PINNED_TAB_INDEX, MESSAGES_TAB_INDEX](BodyItem *selected) { + auto display_url_or_image = [this, matrix_chat_page, &ui_tabs, &redraw, &video_page, &launch_url, &chat_state, &url_selection_body, &avatar_applied, PINNED_TAB_INDEX, MESSAGES_TAB_INDEX](BodyItem *selected) { if(!selected) return false; @@ -4961,6 +4964,7 @@ namespace QuickMedia { video_content_page(matrix_chat_page, video_page.get(), "", message_type == MessageType::VIDEO || message_type == MessageType::AUDIO, next_items, 0); no_video = prev_no_video; redraw = true; + avatar_applied = false; return true; } else if(message_type == MessageType::FILE) { download_async_gui(selected->url, FileManagerPage::get_last_accessed_directory(file_manager_start_dir).string(), false, no_video); @@ -5496,9 +5500,11 @@ namespace QuickMedia { //room_avatar_thumbnail_data->texture.generateMipmap(); room_avatar_thumbnail_data->image.reset(); room_avatar_thumbnail_data->loading_state = LoadingState::APPLIED_TO_TEXTURE; + avatar_applied = false; } - if(room_avatar_thumbnail_data->loading_state == LoadingState::APPLIED_TO_TEXTURE && !room_avatar_sprite.getTexture()) { + if(room_avatar_thumbnail_data->loading_state == LoadingState::APPLIED_TO_TEXTURE && !avatar_applied) { + avatar_applied = true; room_avatar_sprite.setTexture(room_avatar_thumbnail_data->texture, true); auto texture_size = room_avatar_sprite.getTexture()->getSize(); if(texture_size.x > 0 && texture_size.y > 0) { @@ -5671,7 +5677,7 @@ namespace QuickMedia { if(selected_tab == MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX || selected_tab == USERS_TAB_INDEX) { float room_name_text_offset_x = 0.0f; - if(room_avatar_sprite.getTexture() && room_avatar_sprite.getTexture()->getNativeHandle() != 0) { + if(room_avatar_thumbnail_data->loading_state == LoadingState::APPLIED_TO_TEXTURE && room_avatar_sprite.getTexture() && room_avatar_sprite.getTexture()->getNativeHandle() != 0) { auto room_avatar_texture_size = room_avatar_sprite.getTexture()->getSize(); room_avatar_texture_size.x *= room_avatar_sprite.getScale().x; room_avatar_texture_size.y *= room_avatar_sprite.getScale().y; diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp index 2207c65..42c2f9e 100644 --- a/src/plugins/FileManager.cpp +++ b/src/plugins/FileManager.cpp @@ -8,9 +8,9 @@ namespace QuickMedia { static std::filesystem::path last_accessed_dir; static Path last_accessed_dir_path; static void set_last_accessed_dir(const std::filesystem::path &path) { - if(last_accessed_dir_path.data.empty()) - last_accessed_dir_path = get_storage_dir().join("file-manager").join("last_accessed_dir"); - file_overwrite_atomic(last_accessed_dir_path, path.string()); + //if(last_accessed_dir_path.data.empty()) + // last_accessed_dir_path = get_storage_dir().join("file-manager").join("last_accessed_dir"); + //file_overwrite_atomic(last_accessed_dir_path, path.string()); last_accessed_dir = path; } @@ -157,12 +157,12 @@ namespace QuickMedia { // static std::filesystem::path& FileManagerPage::get_last_accessed_directory(std::filesystem::path &fallback) { - if(!last_accessed_dir_loaded) { - last_accessed_dir_loaded = true; - std::string last_accessed_dir_str; - file_get_content(get_storage_dir().join("file-manager").join("last_accessed_dir"), last_accessed_dir_str); - last_accessed_dir = std::move(last_accessed_dir_str); - } + //if(!last_accessed_dir_loaded) { + // last_accessed_dir_loaded = true; + // std::string last_accessed_dir_str; + // file_get_content(get_storage_dir().join("file-manager").join("last_accessed_dir"), last_accessed_dir_str); + // last_accessed_dir = std::move(last_accessed_dir_str); + //} if(last_accessed_dir.empty()) return fallback; |