aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Lbry.hpp2
-rw-r--r--plugins/MediaGeneric.hpp2
-rw-r--r--plugins/Page.hpp6
-rw-r--r--plugins/Peertube.hpp2
-rw-r--r--plugins/Soundcloud.hpp2
-rw-r--r--plugins/Youtube.hpp2
-rw-r--r--src/Entry.cpp2
-rw-r--r--src/ImageViewer.cpp2
-rw-r--r--src/QuickMedia.cpp21
-rw-r--r--src/SearchBar.cpp4
-rw-r--r--src/Tabs.cpp2
-rw-r--r--src/Text.cpp6
-rw-r--r--src/gui/Button.cpp2
-rw-r--r--src/plugins/Lbry.cpp5
-rw-r--r--src/plugins/MediaGeneric.cpp2
-rw-r--r--src/plugins/Peertube.cpp2
-rw-r--r--src/plugins/Soundcloud.cpp9
-rw-r--r--src/plugins/Youtube.cpp2
18 files changed, 46 insertions, 29 deletions
diff --git a/plugins/Lbry.hpp b/plugins/Lbry.hpp
index d21778a..6198a9b 100644
--- a/plugins/Lbry.hpp
+++ b/plugins/Lbry.hpp
@@ -41,7 +41,7 @@ namespace QuickMedia {
std::string get_download_url(int max_height) override;
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;
std::string get_audio_url(std::string &ext) override;
- PluginResult load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
+ PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
private:
std::string title;
std::string streaming_url;
diff --git a/plugins/MediaGeneric.hpp b/plugins/MediaGeneric.hpp
index 68ad22f..d9708aa 100644
--- a/plugins/MediaGeneric.hpp
+++ b/plugins/MediaGeneric.hpp
@@ -96,7 +96,7 @@ namespace QuickMedia {
std::string get_download_url(int max_height) override;
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;
- PluginResult load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
+ PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
private:
MediaGenericSearchPage *search_page;
std::string video_url;
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index 1b8a391..64c24c3 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -24,7 +24,7 @@ namespace QuickMedia {
std::string title;
std::string url;
std::string thumbnail_url;
- void *userdata;
+ void *userdata = nullptr;
std::shared_ptr<BodyItemExtra> extra;
};
@@ -168,8 +168,8 @@ namespace QuickMedia {
virtual std::string url_get_playable_url(const std::string &url) { return url; }
virtual bool video_should_be_skipped(const std::string &url) { (void)url; return false; }
// This needs to be called before the other functions are called
- virtual PluginResult load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) {
- (void)title; (void)duration; (void)channel_url; (void)chapters; (void)err_str;
+ virtual PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) {
+ (void)args; (void)title; (void)duration; (void)channel_url; (void)chapters; (void)err_str;
return PluginResult::OK;
}
virtual void mark_watched() {};
diff --git a/plugins/Peertube.hpp b/plugins/Peertube.hpp
index dfd5601..ac1a06b 100644
--- a/plugins/Peertube.hpp
+++ b/plugins/Peertube.hpp
@@ -81,7 +81,7 @@ namespace QuickMedia {
std::string get_download_url(int max_height) override;
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;
std::string get_audio_url(std::string &ext) override;
- PluginResult load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
+ PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
bool autoplay_next_item() override { return autoplay_next; }
//void get_subtitles(SubtitleData &subtitle_data) override;
private:
diff --git a/plugins/Soundcloud.hpp b/plugins/Soundcloud.hpp
index 0ec0ae4..cf1d7dd 100644
--- a/plugins/Soundcloud.hpp
+++ b/plugins/Soundcloud.hpp
@@ -60,7 +60,7 @@ namespace QuickMedia {
public:
SoundcloudAudioPage(Program *program, std::string title, const std::string &url, std::string permalink_url) : VideoPage(program, url), title(std::move(title)), permalink_url(std::move(permalink_url)) {}
const char* get_title() const override { return ""; }
- PluginResult load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
+ PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
bool autoplay_next_item() override { return true; }
std::string url_get_playable_url(const std::string &url) override;
std::string get_download_url(int max_height) override;
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index 78fc40f..dc604a9 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -151,7 +151,7 @@ namespace QuickMedia {
std::string get_url_timestamp() override;
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;
std::string get_audio_url(std::string &ext) override;
- PluginResult load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
+ PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override;
void mark_watched() override;
void get_subtitles(SubtitleData &subtitle_data) override;
void set_watch_progress(int64_t time_pos_sec, int64_t duration_sec) override;
diff --git a/src/Entry.cpp b/src/Entry.cpp
index c3ecb40..af35de0 100644
--- a/src/Entry.cpp
+++ b/src/Entry.cpp
@@ -110,7 +110,7 @@ namespace QuickMedia {
void Entry::set_position(const mgl::vec2f &pos) {
background.set_position(pos);
text.set_position(pos + mgl::vec2f(background_margin_horizontal, background_margin_vertical));
- placeholder.set_position(pos + mgl::vec2f(background_margin_horizontal, background_margin_vertical + floor(-1.0f * get_config().scale)));
+ placeholder.set_position(pos + mgl::vec2f(background_margin_horizontal, background_margin_vertical + floor(3.0f * get_config().scale)));
}
void Entry::set_max_width(float width) {
diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp
index 064afa4..179669d 100644
--- a/src/ImageViewer.cpp
+++ b/src/ImageViewer.cpp
@@ -432,7 +432,7 @@ namespace QuickMedia {
window->draw(page_text_background);
auto page_text_bounds = page_text.get_bounds();
- page_text.set_position(mgl::vec2f(floor(window_size.x * 0.5f - page_text_bounds.size.x * 0.5f), floor(window_size.y - background_height * 0.5f - font_height * 0.7f)));
+ page_text.set_position(mgl::vec2f(floor(window_size.x * 0.5f - page_text_bounds.size.x * 0.5f), floor(window_size.y - background_height * 0.5f - font_height * 0.55f)));
window->draw(page_text);
// Free pages that are not visible on the screen
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a17b721..3789cc1 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3160,6 +3160,16 @@ namespace QuickMedia {
audio_url.clear();
has_embedded_audio = true;
+ SubmitArgs submit_args;
+ if(parent_body) {
+ BodyItem *selected = parent_body->get_selected();
+ submit_args.title = selected->get_title();
+ submit_args.url = selected->url;
+ submit_args.thumbnail_url = selected->thumbnail_url;
+ submit_args.userdata = selected->userdata;
+ submit_args.extra = selected->extra;
+ }
+
std::string err_str;
const int num_retries = is_youtube ? 3 : 1;
bool load_successful = false;
@@ -3167,7 +3177,7 @@ namespace QuickMedia {
bool cancelled = false;
TaskResult load_result = run_task_with_loading_screen([&]() {
video_duration = 0.0;
- if(video_page->load(new_title, channel_url, video_duration, media_chapters, err_str) != PluginResult::OK)
+ if(video_page->load(submit_args, new_title, channel_url, video_duration, media_chapters, err_str) != PluginResult::OK)
return false;
if(video_duration > 0.001)
@@ -4183,7 +4193,7 @@ namespace QuickMedia {
window.draw(chapter_text_background);
auto text_bounds = chapter_text.get_bounds();
- chapter_text.set_position(vec2f_floor(window_size.x * 0.5f - text_bounds.size.x * 0.5f, window_size.y - bottom_panel_height * 0.5f - font_height * 0.7f));
+ chapter_text.set_position(vec2f_floor(window_size.x * 0.5f - text_bounds.size.x * 0.5f, window_size.y - bottom_panel_height * 0.5f - font_height * 0.55f));
window.draw(chapter_text);
window.display();
@@ -4986,7 +4996,7 @@ namespace QuickMedia {
time_left_text.set_position(time_left_bg.get_position() +
mgl::vec2f(
std::floor(time_left_bg.get_size().x * 0.5f - time_left_text.get_bounds().size.x * 0.5f),
- std::floor(time_left_bg.get_size().y * 0.5f - time_left_text.get_bounds().size.y * 0.5f)));
+ std::floor(time_left_bg.get_size().y * 0.5f - time_left_text.get_bounds().size.y * 0.6f)));
window.draw(time_left_text);
}
}
@@ -7589,7 +7599,8 @@ namespace QuickMedia {
std::vector<MediaChapter> chapters;
filename.clear();
double duration;
- if(youtube_video_page->load(filename, channel_url, duration, chapters, err_str) != PluginResult::OK)
+ SubmitArgs submit_args;
+ if(youtube_video_page->load(submit_args, filename, channel_url, duration, chapters, err_str) != PluginResult::OK)
return false;
std::string ext;
@@ -8003,7 +8014,7 @@ namespace QuickMedia {
body_size.y -= Tabs::get_shade_height();
save_button.set_position(window_size.to_vec2f() - mgl::vec2f(save_button.get_width(), save_button.get_height()) - mgl::vec2f(bottom_panel_padding, bottom_panel_padding));
cancel_button.set_position(save_button.get_position() - mgl::vec2f(cancel_button.get_width() + bottom_panel_spacing, 0.0f));
- file_name_label.set_position(mgl::vec2f(bottom_panel_spacing, std::floor(window_size.y - bottom_panel_padding - file_name_entry.get_height() * 0.5f - file_name_label.get_bounds().size.y * 0.5f - 5.0f * get_config().scale)));
+ file_name_label.set_position(mgl::vec2f(bottom_panel_spacing, std::floor(window_size.y - bottom_panel_padding - file_name_entry.get_height() * 0.5f - file_name_label.get_bounds().size.y * 0.5f - 1.0f * get_config().scale)));
file_name_entry.set_position(mgl::vec2f(file_name_label.get_position().x + file_name_label.get_bounds().size.x + bottom_panel_spacing, window_size.y - file_name_entry.get_height() - bottom_panel_padding));
file_name_entry.set_max_width(std::floor(cancel_button.get_position().x - bottom_panel_spacing - file_name_label.get_bounds().size.x - bottom_panel_spacing - bottom_panel_spacing));
bottom_panel_background.set_position(mgl::vec2f(0.0f, window_size.y - std::floor(bottom_panel_padding * 2.0f + file_name_entry.get_height())));
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 2393823..b10ed6a 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -68,7 +68,7 @@ namespace QuickMedia {
background.draw(window);
- const int caret_offset_y = character_size * 0.4f;
+ const int caret_offset_y = character_size * 0.15f;
const bool show_placeholder = text.get_string().empty();
if(type == SearchBarType::Password && !show_placeholder) {
@@ -192,7 +192,7 @@ namespace QuickMedia {
background.set_position(mgl::vec2f(pos.x + offset_x, pos.y + padding_top));
shade.set_position(pos);
- mgl::vec2f text_position(pos.x + offset_x + background_margin_horizontal + search_padding + search_padding, pos.y + padding_top + background_margin_vertical - character_size * 0.3f);
+ mgl::vec2f text_position(pos.x + offset_x + background_margin_horizontal + search_padding + search_padding, pos.y + padding_top + rect_height * 0.5f - character_size * 0.7f);
text.set_position(text_position.floor());
placeholder_text.set_position(text_position.floor());
diff --git a/src/Tabs.cpp b/src/Tabs.cpp
index 095a62a..a5c371a 100644
--- a/src/Tabs.cpp
+++ b/src/Tabs.cpp
@@ -102,7 +102,7 @@ namespace QuickMedia {
const int num_visible_tabs = std::min((int)tabs.size(), std::max(1, (int)(width / tab_min_width)));
width_per_tab = floor(width / num_visible_tabs);
- const float tab_text_y = floor(pos.y + tab_height*0.5f - tab_text_size);
+ const float tab_text_y = floor(pos.y + tab_height*0.5f - tab_text_size*0.7f);
tab_background_width = floor(width_per_tab - tab_margin_x*2.0f);
background.set_size(mgl::vec2f(tab_background_width, tab_height));
diff --git a/src/Text.cpp b/src/Text.cpp
index 04d0d11..1f34067 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -517,7 +517,7 @@ namespace QuickMedia
int vertexStart = vertices[vertices_index].size();
EmojiRectangle emoji_rec = emoji_get_extents(codepoint);
- const float font_height_offset = floor(-vspace * 0.2f);
+ const float font_height_offset = floor(vspace * 0.6f);
mgl::vec2f vertexTopLeft(glyphPos.x, glyphPos.y + font_height_offset - floor(emoji_rec.height * emoji_scale) * 0.5f);
mgl::vec2f vertexTopRight(glyphPos.x + floor(emoji_rec.width * emoji_scale), glyphPos.y + font_height_offset - floor(emoji_rec.height * emoji_scale) * 0.5f);
mgl::vec2f vertexBottomLeft(glyphPos.x, glyphPos.y + font_height_offset + emoji_rec.height * emoji_scale * 0.5f);
@@ -1118,7 +1118,7 @@ namespace QuickMedia
mgl::Font *latin_font = FontLoader::get_font(latin_font_type, characterSize);
const float vspace = font_get_real_height(latin_font);
- pos.y += floor(vspace); // Origin is at bottom left, we want it to be at top left
+ pos.y += floor(vspace*0.25f); // Origin is at bottom left, we want it to be at top left
const FontLoader::FontType font_types[] = { latin_font_type, FontLoader::FontType::CJK, FontLoader::FontType::SYMBOLS };
for(size_t i = 0; i < FONT_INDEX_EMOJI; ++i) {
@@ -1142,7 +1142,7 @@ namespace QuickMedia
}
if(!editable) return true;
- pos.y -= floor(vspace * 2.0f);
+ pos.y -= floor(vspace*1.25f);
const float caret_margin = floor(2.0f * get_config().scale);
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp
index bf9c174..bf74b8d 100644
--- a/src/gui/Button.cpp
+++ b/src/gui/Button.cpp
@@ -62,7 +62,7 @@ namespace QuickMedia {
background.set_position(pos);
const auto label_bounds = label.get_bounds();
- mgl::vec2f label_pos(pos + background.get_size() * 0.5f - label_bounds.size * 0.5f - mgl::vec2f(0.0f, 5.0f * scale));
+ mgl::vec2f label_pos(pos + background.get_size() * 0.5f - label_bounds.size * 0.5f - mgl::vec2f(0.0f, 1.0f * scale));
label_pos.x = floor(label_pos.x);
label_pos.y = floor(label_pos.y);
label.set_position(label_pos);
diff --git a/src/plugins/Lbry.cpp b/src/plugins/Lbry.cpp
index 92532cb..069bd89 100644
--- a/src/plugins/Lbry.cpp
+++ b/src/plugins/Lbry.cpp
@@ -395,9 +395,10 @@ namespace QuickMedia {
return "";
}
- PluginResult LbryVideoPage::load(std::string &title, std::string&, double &duration, std::vector<MediaChapter>&, std::string &err_str) {
+ PluginResult LbryVideoPage::load(const SubmitArgs &args, std::string &title, std::string&, double &duration, std::vector<MediaChapter>&, std::string &err_str) {
streaming_url.clear();
- title = this->title;
+ title = args.title;
+ //title = this->title;
duration = 0.0;
return video_get_stream_url(this, url, streaming_url, err_str);
}
diff --git a/src/plugins/MediaGeneric.cpp b/src/plugins/MediaGeneric.cpp
index c1044b0..4ff55da 100644
--- a/src/plugins/MediaGeneric.cpp
+++ b/src/plugins/MediaGeneric.cpp
@@ -224,7 +224,7 @@ namespace QuickMedia {
return video_url;
}
- PluginResult MediaGenericVideoPage::load(std::string&, std::string&, double &duration, std::vector<MediaChapter>&, std::string &err_msg) {
+ PluginResult MediaGenericVideoPage::load(const SubmitArgs&, std::string&, std::string&, double &duration, std::vector<MediaChapter>&, std::string &err_msg) {
video_url.clear();
duration = 0.0;
if(!search_page->video_custom_handler) {
diff --git a/src/plugins/Peertube.cpp b/src/plugins/Peertube.cpp
index a9620f2..4e19f1a 100644
--- a/src/plugins/Peertube.cpp
+++ b/src/plugins/Peertube.cpp
@@ -370,7 +370,7 @@ namespace QuickMedia {
}
// TODO: Media chapters
- PluginResult PeertubeVideoPage::load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter>&, std::string &err_str) {
+ PluginResult PeertubeVideoPage::load(const SubmitArgs&, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter>&, std::string &err_str) {
Json::Value json_root;
std::string err_msg;
DownloadResult download_result = download_json(json_root, server + "/api/v1/videos/" + url, {}, true, &err_msg);
diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp
index e088f73..bc89448 100644
--- a/src/plugins/Soundcloud.cpp
+++ b/src/plugins/Soundcloud.cpp
@@ -477,8 +477,13 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult SoundcloudAudioPage::load(std::string &title, std::string&, double &duration, std::vector<MediaChapter>&, std::string&) {
- title = this->title;
+ PluginResult SoundcloudAudioPage::load(const SubmitArgs &args, std::string &title, std::string&, double &duration, std::vector<MediaChapter>&, std::string&) {
+ SoundcloudTrack *track = static_cast<SoundcloudTrack*>(args.extra.get());
+ if(track)
+ permalink_url = track->permalink_url;
+
+ title = args.title;
+ //title = this->title;
duration = 0.0;
return PluginResult::OK;
}
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index 65db3b1..7722f5d 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -2413,7 +2413,7 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) {
+ PluginResult YoutubeVideoPage::load(const SubmitArgs&, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) {
std::string video_id;
if(!youtube_url_extract_id(url, video_id)) {
fprintf(stderr, "Failed to extract youtube id from %s\n", url.c_str());