From 6f1a252490e7c74f577470616fc5fcaf79716c60 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 12 May 2021 23:02:10 +0200 Subject: Add file and folder icons to file manager --- src/plugins/FileManager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugins/FileManager.cpp') diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp index 6ee7e71..5ca7dc7 100644 --- a/src/plugins/FileManager.cpp +++ b/src/plugins/FileManager.cpp @@ -1,5 +1,6 @@ #include "../../plugins/FileManager.hpp" #include "../../include/FileAnalyzer.hpp" +#include "../../include/ResourceLoader.hpp" #include "../../include/QuickMedia.hpp" namespace QuickMedia { @@ -106,6 +107,15 @@ namespace QuickMedia { if(file_mime_type == FILE_MANAGER_MIME_TYPE_IMAGE || file_mime_type == FILE_MANAGER_MIME_TYPE_VIDEO) { body_item->thumbnail_is_local = true; body_item->thumbnail_url = p.path().string(); + } else { + body_item->thumbnail_is_local = true; + if(is_regular_file) { + body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/file.png"); + body_item->thumbnail_size = sf::Vector2i(18, 24); + } else { + body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/folder.png"); + body_item->thumbnail_size = sf::Vector2i(24, 22); + } } time_t last_modified_time = std::chrono::duration_cast(file_get_last_modified_time(p, std::filesystem::file_time_type::min()).time_since_epoch()).count(); @@ -123,6 +133,8 @@ namespace QuickMedia { if(is_regular_file) { description += "\n"; description += "Size: " + file_size_to_human_readable_string(file_size); + } else { + description += "\nDirectory"; } body_item->set_description(std::move(description)); body_item->set_description_color(sf::Color(179, 179, 179)); -- cgit v1.2.3