aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp12
-rw-r--r--src/Tabs.cpp8
2 files changed, 11 insertions, 9 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 65d6159..709bac5 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1048,7 +1048,7 @@ namespace QuickMedia {
create_launcher_body_item("4chan", "4chan", resources_root + "icons/4chan_launcher.png"),
create_launcher_body_item("AniList", "anilist", resources_root + "images/anilist_logo.png"),
create_launcher_body_item("Hot Examples", "hotexamples", ""),
- create_launcher_body_item("Lbry", "lbry", "icons/lbry_launcher.png"),
+ create_launcher_body_item("Lbry", "lbry", resources_root + "icons/lbry_launcher.png"),
create_launcher_body_item("Manga (all)", "manga", ""),
create_launcher_body_item("Mangadex", "mangadex", resources_root + "icons/mangadex_launcher.png"),
create_launcher_body_item("Mangakatana", "mangakatana", resources_root + "icons/mangakatana_launcher.png"),
@@ -1769,8 +1769,8 @@ namespace QuickMedia {
}
ui_tabs.set_selected(start_tab_index);
- ui_tabs.on_change_tab = [&tabs, &redraw](int selected_tab) {
- tabs[selected_tab].body->clear_cache();
+ ui_tabs.on_change_tab = [&tabs, &redraw](int prev_tab, int) {
+ tabs[prev_tab].body->clear_cache();
redraw = true;
};
@@ -4889,9 +4889,9 @@ namespace QuickMedia {
};
std::thread typing_state_thread(typing_state_handler);
- ui_tabs.on_change_tab = [matrix_chat_page, &redraw, &typing, &typing_state_queue, &read_marker_timer, &tabs, MESSAGES_TAB_INDEX](int selected_tab) {
- tabs[selected_tab].body->clear_cache();
- if(selected_tab == MESSAGES_TAB_INDEX)
+ ui_tabs.on_change_tab = [matrix_chat_page, &redraw, &typing, &typing_state_queue, &read_marker_timer, &tabs, MESSAGES_TAB_INDEX](int prev_tab, int new_tab) {
+ tabs[prev_tab].body->clear_cache();
+ if(new_tab == MESSAGES_TAB_INDEX)
matrix_chat_page->messages_tab_visible = true;
else
matrix_chat_page->messages_tab_visible = false;
diff --git a/src/Tabs.cpp b/src/Tabs.cpp
index 866589b..059a8d8 100644
--- a/src/Tabs.cpp
+++ b/src/Tabs.cpp
@@ -37,7 +37,8 @@ namespace QuickMedia {
}
void Tabs::move_selected_tab(int new_tab) {
- const int tab_diff = new_tab - selected_tab;
+ const int prev_tab = selected_tab;
+ const int tab_diff = new_tab - prev_tab;
if(tab_diff > 0) {
while(selected_tab < new_tab) {
@@ -58,7 +59,7 @@ namespace QuickMedia {
}
if(on_change_tab)
- on_change_tab(selected_tab);
+ on_change_tab(prev_tab, selected_tab);
}
void Tabs::on_event(sf::Event &event) {
@@ -221,7 +222,8 @@ namespace QuickMedia {
}
void Tabs::set_selected(int index) {
- move_selected_tab(index);
+ if(index >= 0 && index < (int)tabs.size())
+ move_selected_tab(index);
}
int Tabs::get_selected() const {