aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp9
-rw-r--r--include/ImageUtils.hpp1
-rw-r--r--include/Page.hpp3
-rw-r--r--include/Path.hpp8
-rw-r--r--include/QuickMedia.hpp2
5 files changed, 20 insertions, 3 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 0bea3c2..4e30684 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -42,11 +42,12 @@ namespace QuickMedia {
// TODO: Use a list of strings instead, not all plugins need all of these fields
std::string url;
std::string thumbnail_url;
- std::string attached_content_url;
+ std::string attached_content_url; // TODO: Remove and use |url| instead
std::string author;
bool visible;
bool dirty;
bool dirty_description;
+ bool thumbnail_is_local;
std::unique_ptr<Text> title_text;
std::unique_ptr<Text> description_text;
// Used by image boards for example. The elements are indices to other body items
@@ -103,13 +104,17 @@ namespace QuickMedia {
std::thread thumbnail_load_thread;
bool draw_thumbnails;
bool wrap_around;
+ // Set to {0, 0} to disable resizing
+ sf::Vector2i thumbnail_resize_target_size;
+ sf::Vector2f thumbnail_fallback_size;
private:
struct ThumbnailData {
bool referenced;
std::shared_ptr<sf::Texture> texture;
+ bool loaded = false;
};
Program *program;
- std::shared_ptr<sf::Texture> load_thumbnail_from_url(const std::string &url);
+ std::shared_ptr<sf::Texture> load_thumbnail_from_url(const std::string &url, bool local, sf::Vector2i thumbnail_resize_target_size);
std::unordered_map<std::string, ThumbnailData> item_thumbnail_textures;
bool loading_thumbnail;
int selected_item;
diff --git a/include/ImageUtils.hpp b/include/ImageUtils.hpp
index f0670d6..58eb197 100644
--- a/include/ImageUtils.hpp
+++ b/include/ImageUtils.hpp
@@ -5,4 +5,5 @@
namespace QuickMedia {
// Works with jpg, png and gif files
bool image_get_resolution(const Path &path, int *width, int *height);
+ bool is_image_ext(const char *ext);
} \ No newline at end of file
diff --git a/include/Page.hpp b/include/Page.hpp
index 5bd8e0d..68c2470 100644
--- a/include/Page.hpp
+++ b/include/Page.hpp
@@ -14,6 +14,7 @@ namespace QuickMedia {
IMAGE_BOARD_THREAD_LIST,
IMAGE_BOARD_THREAD,
CHAT_LOGIN,
- CHAT
+ CHAT,
+ FILE_MANAGER
};
} \ No newline at end of file
diff --git a/include/Path.hpp b/include/Path.hpp
index bd978bc..bdc31c1 100644
--- a/include/Path.hpp
+++ b/include/Path.hpp
@@ -26,6 +26,14 @@ namespace QuickMedia {
return *this;
}
+ // Returns empty string if no extension
+ const char* ext() const {
+ size_t index = data.rfind('.');
+ if(index == std::string::npos)
+ return "";
+ return data.c_str() + index;
+ }
+
std::string data;
};
} \ No newline at end of file
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index 485aeca..6afdfce 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -54,6 +54,7 @@ namespace QuickMedia {
void image_board_thread_page();
void chat_login_page();
void chat_page();
+ void file_manager_page();
bool on_search_suggestion_submit_text(Body *input_body, Body *output_body);
@@ -120,5 +121,6 @@ namespace QuickMedia {
// TODO: Save this to config file when switching modes
ImageViewMode image_view_mode = ImageViewMode::SINGLE;
Body *related_media_body;
+ std::vector<std::string> selected_files;
};
} \ No newline at end of file