aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-10 18:49:44 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-10 22:41:04 +0200
commitcdf8d103f1ed6a932eb30b589b578d23ca66a514 (patch)
tree0782751764748be50c4203b8e1af14907046e3d2 /include
parent2eac1e3d3ece90d1c522e15cb57ee41baa3dd822 (diff)
Add downloader, fix room navigation lag
Fix bug where getting next page fails if there is no search bar
Diffstat (limited to 'include')
-rw-r--r--include/DownloadUtils.hpp2
-rw-r--r--include/NetUtils.hpp1
-rw-r--r--include/QuickMedia.hpp3
-rw-r--r--include/Storage.hpp2
-rw-r--r--include/StringUtils.hpp1
5 files changed, 8 insertions, 1 deletions
diff --git a/include/DownloadUtils.hpp b/include/DownloadUtils.hpp
index 0a68069..964e74b 100644
--- a/include/DownloadUtils.hpp
+++ b/include/DownloadUtils.hpp
@@ -27,5 +27,7 @@ namespace QuickMedia {
DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_browser_useragent = false, DownloadErrorHandler error_handler = nullptr, Path cache_path = "");
// Note: This function saves the content to the file atomically
DownloadResult download_to_file(const std::string &url, const std::string &destination_filepath, const std::vector<CommandArg> &additional_args, bool use_browser_useragent = false);
+ // Returns false if there was an error trying to create the download process
+ bool download_async_gui(const std::string &url, bool use_youtube_dl, bool no_video);
DownloadResult download_to_json(const std::string &url, rapidjson::Document &result, const std::vector<CommandArg> &additional_args, bool use_browser_useragent = false, bool fail_on_error = true);
} \ No newline at end of file
diff --git a/include/NetUtils.hpp b/include/NetUtils.hpp
index e719c82..bacafc7 100644
--- a/include/NetUtils.hpp
+++ b/include/NetUtils.hpp
@@ -15,4 +15,5 @@ namespace QuickMedia {
std::vector<Range> extract_urls(const std::string &str);
std::vector<std::string> ranges_get_strings(const std::string &str, const std::vector<Range> &ranges);
void convert_utf8_to_utf32_ranges(const std::string &str, std::vector<Range> &ranges);
+ std::string header_extract_value(const std::string &header, const std::string &type);
} \ No newline at end of file
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index 30836aa..01baf76 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -100,7 +100,7 @@ namespace QuickMedia {
Json::Value load_video_history_json();
private:
- void init(Window parent_window);
+ void init(Window parent_window, std::string &program_path);
void load_plugin_by_name(std::vector<Tab> &tabs, const char *start_dir, int &start_tab_index, FileManagerMimeType fm_mime_type, FileSelectionHandler file_selection_handler);
// Returns true if the window was closed
bool handle_window_close();
@@ -119,6 +119,7 @@ namespace QuickMedia {
void chat_login_page();
bool chat_page(MatrixChatPage *matrix_chat_page, RoomData *current_room, std::vector<Tab> &room_tabs, int room_selected_tab);
void after_matrix_login_page();
+ void download_page(const char *url, bool download_use_youtube_dl);
enum class LoadImageResult {
OK,
diff --git a/include/Storage.hpp b/include/Storage.hpp
index 4dab9b3..93d13ff 100644
--- a/include/Storage.hpp
+++ b/include/Storage.hpp
@@ -36,4 +36,6 @@ namespace QuickMedia {
int rename_atomic(const char *oldpath, const char *newpath);
bool is_program_executable_by_name(const char *name);
+
+ std::string file_size_to_human_readable_string(size_t bytes);
} \ No newline at end of file
diff --git a/include/StringUtils.hpp b/include/StringUtils.hpp
index 6df16db..8a94d2f 100644
--- a/include/StringUtils.hpp
+++ b/include/StringUtils.hpp
@@ -17,4 +17,5 @@ namespace QuickMedia {
std::string strip(const std::string &str);
bool string_starts_with(const std::string &str, const char *sub);
bool string_ends_with(const std::string &str, const std::string &ends_with_str);
+ size_t str_find_case_insensitive(const std::string &str, size_t start_index, const char *substr, size_t substr_len);
} \ No newline at end of file