diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-10-31 22:54:59 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-10-31 22:54:59 +0100 |
commit | 53316e4bada29f1392df2528d8616afde17f570b (patch) | |
tree | 4b687dc2bd2b46da1b2d31648bc40ceb6179972f /include | |
parent | 9540ab168be53f3ec2aec513d855df0194d9cb8a (diff) |
Add ctrl+shift+s to download files without a dialog
Diffstat (limited to 'include')
-rw-r--r-- | include/Config.hpp | 8 | ||||
-rw-r--r-- | include/DownloadUtils.hpp | 2 | ||||
-rw-r--r-- | include/FileAnalyzer.hpp | 1 | ||||
-rw-r--r-- | include/QuickMedia.hpp | 6 |
4 files changed, 13 insertions, 4 deletions
diff --git a/include/Config.hpp b/include/Config.hpp index 4d9fd91..d7bfddf 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -55,6 +55,13 @@ namespace QuickMedia { std::vector<std::string> known_instances; }; + struct Download { + std::string video_directory; + std::string image_directory; + std::string music_directory; + std::string file_directory; + }; + struct Config { Config() = default; Config(const Config&) = delete; @@ -70,6 +77,7 @@ namespace QuickMedia { YoutubeConfig youtube; MatrixConfig matrix; Peertube peertube; + Download download; bool use_system_fonts = false; bool use_system_mpv_config = false; bool enable_shaders = true; diff --git a/include/DownloadUtils.hpp b/include/DownloadUtils.hpp index 48ee309..d8aba2e 100644 --- a/include/DownloadUtils.hpp +++ b/include/DownloadUtils.hpp @@ -32,6 +32,6 @@ namespace QuickMedia { // Note: if |cloudflare_bypass| is set to true then tls is limited to version 1.1 and the user agent is changed. DownloadResult download_to_file(const std::string &url, const std::string &destination_filepath, const std::vector<CommandArg> &additional_args, bool use_browser_useragent = false, bool cloudflare_bypass = false); // Returns false if there was an error trying to create the download process - bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool no_video, const std::string &filename); + bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool no_video, const std::string &filename, bool download_no_dialog); 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/FileAnalyzer.hpp b/include/FileAnalyzer.hpp index 9f3dbb9..4ae95ff 100644 --- a/include/FileAnalyzer.hpp +++ b/include/FileAnalyzer.hpp @@ -41,6 +41,7 @@ namespace QuickMedia { const char* content_type_to_string(ContentType content_type); bool is_image_ext(const char *ext); bool is_video_ext(const char *ext); + bool is_music_ext(const char *ext); // Set |width| or |height| to 0 to disable scaling. // TODO: Make this async diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index d2ca1f3..675fa0e 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -118,7 +118,7 @@ namespace QuickMedia { void set_clipboard(const std::string &str); private: - void init(mgl::WindowHandle parent_window, std::string &program_path); + void init(mgl::WindowHandle parent_window, std::string &program_path, bool no_dialog); void load_plugin_by_name(std::vector<Tab> &tabs, int &start_tab_index, FileManagerMimeType fm_mime_type, FileSelectionHandler file_selection_handler, std::string instance); void common_event_handler(mgl::Event &event); void handle_x11_events(); @@ -134,7 +134,7 @@ namespace QuickMedia { bool page_loop(std::vector<Tab> &tabs, int start_tab_index = 0, PageLoopSubmitHandler after_submit_handler = nullptr, bool go_to_previous_on_escape = true); void redirect_focus_to_video_player_window(mgl::WindowHandle video_player_window); void show_video_player_window(mgl::WindowHandle video_player_window); - void video_page_download_video(const std::string &url, const std::string &filename, mgl::WindowHandle video_player_window = 0); + void video_page_download_video(const std::string &url, const std::string &filename, mgl::WindowHandle video_player_window = 0, bool download_no_dialog = false); bool video_download_if_non_streamable(std::string &video_url, std::string &audio_url, bool &is_audio_only, bool &has_embedded_audio, PageType previous_page); int video_get_max_height(); void video_content_page(Page *parent_page, VideoPage *video_page, std::string video_title, bool download_if_streaming_fails, Body *parent_body, int play_index, int *parent_body_page = nullptr, const std::string &parent_page_search = ""); @@ -147,7 +147,7 @@ namespace QuickMedia { void chat_login_page(); bool chat_page(MatrixChatPage *matrix_chat_page, RoomData *current_room); void after_matrix_login_page(); - void download_page(std::string url, std::string download_filename); + void download_page(std::string url, std::string download_filename, bool no_dialog); // Returns the full path where the file should be saved, or an empty string if the operation was cancelled std::string file_save_page(const std::string &filename); |