From 56acc142c6ef9a65147acdea6737acbfaeb7eca4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 15 Oct 2019 19:57:24 +0200 Subject: Add tor support --- include/Body.hpp | 5 ++++- include/QuickMedia.hpp | 2 ++ include/StringUtils.hpp | 11 +++++++++++ include/VideoPlayer.hpp | 3 ++- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 include/StringUtils.hpp (limited to 'include') diff --git a/include/Body.hpp b/include/Body.hpp index a2db62a..c394519 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -8,6 +8,8 @@ #include namespace QuickMedia { + class Program; + class BodyItem { public: BodyItem(const std::string &_title): title(_title), visible(true) { @@ -24,7 +26,7 @@ namespace QuickMedia { class Body { public: - Body(sf::Font &font); + Body(Program *program, sf::Font &font); // Select previous item, ignoring invisible items void select_previous_item(); @@ -56,6 +58,7 @@ namespace QuickMedia { std::string url; std::shared_ptr texture; }; + Program *program; std::shared_ptr load_thumbnail_from_url(const std::string &url); std::vector item_thumbnail_textures; bool loading_thumbnail; diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index 8479d58..6906036 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -21,6 +21,8 @@ namespace QuickMedia { Program(); ~Program(); int run(int argc, char **argv); + + Plugin* get_current_plugin() { return current_plugin; } private: void base_event_handler(sf::Event &event, Page previous_page); void search_suggestion_page(); diff --git a/include/StringUtils.hpp b/include/StringUtils.hpp new file mode 100644 index 0000000..72210c9 --- /dev/null +++ b/include/StringUtils.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +namespace QuickMedia { + // Return false to stop iterating + using StringSplitCallback = std::function; + + void string_split(const std::string &str, char delimiter, StringSplitCallback callback_func); +} \ No newline at end of file diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp index 3839530..e1763f6 100644 --- a/include/VideoPlayer.hpp +++ b/include/VideoPlayer.hpp @@ -35,7 +35,7 @@ namespace QuickMedia { }; // @event_callback is called from another thread - VideoPlayer(EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback); + VideoPlayer(bool use_tor, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback); ~VideoPlayer(); VideoPlayer(const VideoPlayer&) = delete; VideoPlayer& operator=(const VideoPlayer&) = delete; @@ -65,6 +65,7 @@ namespace QuickMedia { Error launch_video_process(const char *path, sf::WindowHandle parent_window); VideoPlayer::Error read_ipc_func(); private: + bool use_tor; pid_t video_process_id; int ipc_socket; bool connected_to_ipc; -- cgit v1.2.3