aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-26 08:18:00 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-26 08:18:00 +0200
commitc3bc6fbd7f4fffff90b40f813418b0dbd030bbd2 (patch)
tree4ee4b493f94e662c3590cbd77b2fc88d137b240c
parent1026360c595818eabe75813bcd02258c4d0dddc7 (diff)
cleanup
-rw-r--r--include/Body.hpp5
-rw-r--r--plugins/NyaaSi.hpp1
-rw-r--r--src/Body.cpp21
3 files changed, 5 insertions, 22 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index de7d940..6977922 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -187,10 +187,10 @@ namespace QuickMedia {
bool select_next_page();
// Select previous item, ignoring invisible items. Returns true if the item was changed or if the item scrolled. This can be used to check if the top was hit when wrap_around is set to false
- bool select_previous_item(bool scroll_page_if_large_item = true, bool reset_select_scroll = true);
+ bool select_previous_item(bool scroll_page_if_large_item = true);
// Select next item, ignoring invisible items. Returns true if the item was changed or if the item scrolled. This can be used to check if the bottom was hit when wrap_around is set to false
- bool select_next_item(bool scroll_page_if_large_item = true, bool reset_select_scroll = true);
+ bool select_next_item(bool scroll_page_if_large_item = true);
void set_selected_item(int item, bool reset_prev_selected_item = true);
void reset_prev_selected_item();
@@ -336,7 +336,6 @@ namespace QuickMedia {
sf::Vector2f body_pos;
sf::Vector2f body_size;
float selected_item_height = 0.0f;
- float selected_scrolled = 0.0f;
std::shared_ptr<BodyItem> clicked_body_item = nullptr;
RoundedRectangle item_background;
RoundedRectangle reaction_background;
diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp
index 45c2f7b..897c5ab 100644
--- a/plugins/NyaaSi.hpp
+++ b/plugins/NyaaSi.hpp
@@ -35,5 +35,6 @@ namespace QuickMedia {
NyaaSiTorrentPage(Program *program) : Page(program) {}
const char* get_title() const override { return "Torrent"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ bool submit_is_async() override { return false; }
};
} \ No newline at end of file
diff --git a/src/Body.cpp b/src/Body.cpp
index 3169b6c..504f0ee 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -161,7 +161,7 @@ namespace QuickMedia {
return true;
}
- bool Body::select_previous_item(bool scroll_page_if_large_item, bool reset_select_scroll) {
+ bool Body::select_previous_item(bool scroll_page_if_large_item) {
if(items.empty())
return false;
@@ -190,9 +190,6 @@ namespace QuickMedia {
break;
}
- if(reset_select_scroll)
- selected_scrolled = 0.0f;
-
if(selected_item == new_selected_item)
return false;
@@ -200,7 +197,7 @@ namespace QuickMedia {
return true;
}
- bool Body::select_next_item(bool scroll_page_if_large_item, bool reset_select_scroll) {
+ bool Body::select_next_item(bool scroll_page_if_large_item) {
if(items.empty())
return false;
@@ -229,9 +226,6 @@ namespace QuickMedia {
break;
}
- if(reset_select_scroll)
- selected_scrolled = 0.0f;
-
if(selected_item == new_selected_item)
return false;
@@ -241,8 +235,6 @@ namespace QuickMedia {
void Body::set_selected_item(int item, bool reset_prev_selected_item) {
//assert(item >= 0 && item < (int)items.size());
- if(item != selected_item)
- selected_scrolled = 0.0f;
selected_item = item;
clamp_selection();
if(reset_prev_selected_item)
@@ -264,7 +256,6 @@ namespace QuickMedia {
}
void Body::select_first_item() {
- selected_scrolled = 0.0f;
selected_item = 0;
if(attach_side == AttachSide::TOP) {
prev_selected_item = selected_item;
@@ -278,7 +269,6 @@ namespace QuickMedia {
void Body::select_last_item(bool reset_prev_select) {
int new_selected_item = std::max(0, (int)items.size() - 1);
- selected_scrolled = 0.0f;
selected_item = new_selected_item;
if(reset_prev_select)
prev_selected_item = selected_item;
@@ -290,8 +280,6 @@ namespace QuickMedia {
}
void Body::clear_items() {
- if(selected_item != 0)
- selected_scrolled = 0.0f;
items.clear();
selected_item = 0;
prev_selected_item = selected_item;
@@ -544,12 +532,10 @@ namespace QuickMedia {
if(items_cut_off) {
if(mouse_left_pressed) {
- selected_scrolled += mouse_pos_raw_diff.y;
page_scroll += mouse_pos_raw_diff.y;
mouse_scroll_accel = sf::Vector2f(mouse_pos_raw_diff.x, mouse_pos_raw_diff.y);
mouse_scroll_accel *= (float)((double)frame_time * 288.0);
} else {
- selected_scrolled += mouse_scroll_accel.y;
page_scroll += mouse_scroll_accel.y;
}
}
@@ -626,8 +612,6 @@ namespace QuickMedia {
double scroll_smooth_diff = extra_scroll_current - prev_extra_scroll;
prev_extra_scroll = extra_scroll_current;
- selected_scrolled += scroll_smooth_diff;
-
if(body_size_changed) {
extra_scroll_current = extra_scroll_target;
prev_extra_scroll = extra_scroll_current;
@@ -1450,7 +1434,6 @@ namespace QuickMedia {
}
void Body::set_page_scroll(float scroll) {
- selected_scrolled = 0.0f;
page_scroll = scroll;
clamp_selected_item_to_body_count = 1;
}