diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-22 15:59:35 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-22 15:59:35 +0200 |
commit | 8b5901000e9073d9ff6a3a86cd7c0e0172de7f5a (patch) | |
tree | 3673b2b9ec7213023a9fdcf72cfb130461cf54e1 /src | |
parent | 92a7a35916b3b3f9abf075ecb0ef4e16da4b3acb (diff) |
show num invites in tab (propagate page title update to tabs)
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 6 | ||||
-rw-r--r-- | src/Tabs.cpp | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 8d4dffb..eb82a54 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1726,6 +1726,12 @@ namespace QuickMedia { } } + for(size_t i = 0; i < tabs.size(); ++i) { + Tab &tab = tabs[i]; + if(tab.page) + ui_tabs.set_text(i, tab.page->get_title()); + } + window.clear(back_color); page_loop_render(window, tabs, selected_tab, tab_associated_data[selected_tab], json_chapters, ui_tabs); window.display(); diff --git a/src/Tabs.cpp b/src/Tabs.cpp index 4437472..01e5d2d 100644 --- a/src/Tabs.cpp +++ b/src/Tabs.cpp @@ -30,6 +30,7 @@ namespace QuickMedia { int Tabs::add_tab(const std::string &title) { tab_texts.push_back(sf::Text(title, *FontLoader::get_font(FontLoader::FontType::LATIN), tab_text_size)); + tab_labels_utf8.push_back(title); return tab_texts.size() - 1; } @@ -180,8 +181,9 @@ namespace QuickMedia { } void Tabs::set_text(int index, const std::string &text) { - if(index < 0 || index >= (int)tab_texts.size()) return; + if(index < 0 || index >= (int)tab_texts.size() || text == tab_labels_utf8[index]) return; tab_texts[index].setString(sf::String::fromUtf8(text.begin(), text.end())); + tab_labels_utf8[index] = text; } void Tabs::set_selected(int index) { |