aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--src/Body.cpp4
-rw-r--r--src/QuickMedia.cpp10
3 files changed, 13 insertions, 5 deletions
diff --git a/TODO b/TODO
index 5ddbb0e..a823b9f 100644
--- a/TODO
+++ b/TODO
@@ -22,4 +22,6 @@ Add navigation to nyaa.si submitter torrents.
Create a large texture and add downloaded images to it. This will save memory usage because sfml has to use power of two textures (and so does opengl internally) for textures, so if you have multiple textures they will use more memory than one large texture with the same texture data.
Use fallback cjk font for regular sf::Text as well (search, tabs, chapter name when viewing a page, path in file-manager, etc).
Fix some japanese fonts not rendering (full width alphanumeric?).
-Also add support for full chinese and korean range. \ No newline at end of file
+Also add support for full chinese and korean range.
+Resize text vertex arrays to 0 when not visible on screen to reduce memory usage. Text already does this but its done incorrectly (copied from dchat codebase). (Is this really necessary?).
+Speed up thumbnail creating (image resizing). \ No newline at end of file
diff --git a/src/Body.cpp b/src/Body.cpp
index 39f6e01..c53a476 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -271,7 +271,7 @@ namespace QuickMedia {
Path thumbnail_path = get_cache_dir().join("thumbnails").join(base64_url::encode(url));
std::string texture_data;
- if(thumbnail_resize_target_size.x != 0 && thumbnail_resize_target_size.y != 0 && file_get_content(thumbnail_path, texture_data) == 0) {
+ if(file_get_content(thumbnail_path, texture_data) == 0) {
fprintf(stderr, "Loaded %s from thumbnail cache\n", url.c_str());
result->loadFromMemory(texture_data.data(), texture_data.size());
loading_thumbnail = false;
@@ -443,7 +443,7 @@ namespace QuickMedia {
glScissor(scissor_pos.x, (int)window_size.y - (int)scissor_pos.y - (int)scissor_size.y, scissor_size.x, scissor_size.y);
for(int i = first_visible_item + 1; i < num_items; ++i) {
- const auto &item = items[i];
+ auto &item = items[i];
if(pos.y >= start_y + size.y)
break;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 09c6e01..5d8a7e4 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -252,7 +252,7 @@ namespace QuickMedia {
delete body;
if(file_manager)
delete file_manager;
- if(current_plugin)
+ if(current_plugin && current_plugin != file_manager)
delete current_plugin;
if(disp)
XCloseDisplay(disp);
@@ -1097,6 +1097,7 @@ namespace QuickMedia {
if(tabs[selected_tab].body) {
tabs[selected_tab].body->filter_search_fuzzy("");
tabs[selected_tab].body->clamp_selection();
+ tabs[selected_tab].body->clear_thumbnails();
}
selected_tab = std::max(0, selected_tab - 1);
search_bar->clear();
@@ -1104,6 +1105,7 @@ namespace QuickMedia {
if(tabs[selected_tab].body) {
tabs[selected_tab].body->filter_search_fuzzy("");
tabs[selected_tab].body->clamp_selection();
+ tabs[selected_tab].body->clear_thumbnails();
}
selected_tab = std::min((int)tabs.size() - 1, selected_tab + 1);
search_bar->clear();
@@ -1869,11 +1871,13 @@ namespace QuickMedia {
} else if(event.key.code == sf::Keyboard::Left) {
tabs[selected_tab].body->filter_search_fuzzy("");
tabs[selected_tab].body->clamp_selection();
+ tabs[selected_tab].body->clear_thumbnails();
selected_tab = std::max(0, selected_tab - 1);
search_bar->clear();
} else if(event.key.code == sf::Keyboard::Right) {
tabs[selected_tab].body->filter_search_fuzzy("");
tabs[selected_tab].body->clamp_selection();
+ tabs[selected_tab].body->clear_thumbnails();
selected_tab = std::min((int)tabs.size() - 1, selected_tab + 1);
search_bar->clear();
}
@@ -2579,7 +2583,7 @@ namespace QuickMedia {
search_bar->text_autosearch_delay = prev_autosearch_delay;
// We want exit code 1 if the file manager was launched and no files were selected, to know when the user didn't select any file(s)
if(selected_files.empty() && current_page == Page::EXIT)
- exit(1);
+ exit_code = 1;
}
void Program::image_board_thread_list_page() {
@@ -3333,11 +3337,13 @@ namespace QuickMedia {
} else if(event.key.code == sf::Keyboard::Left) {
tabs[selected_tab].body->filter_search_fuzzy("");
tabs[selected_tab].body->clamp_selection();
+ tabs[selected_tab].body->clear_thumbnails();
selected_tab = std::max(0, selected_tab - 1);
chat_input.clear();
} else if(event.key.code == sf::Keyboard::Right) {
tabs[selected_tab].body->filter_search_fuzzy("");
tabs[selected_tab].body->clamp_selection();
+ tabs[selected_tab].body->clear_thumbnails();
selected_tab = std::min((int)tabs.size() - 1, selected_tab + 1);
chat_input.clear();
}