aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp59
1 files changed, 26 insertions, 33 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index ce5a414..b78ea10 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -35,12 +35,11 @@
#include <GL/glx.h>
static const sf::Color back_color(21, 25, 30);
-static const int DOUBLE_CLICK_TIME = 500;
static const std::string fourchan_google_captcha_api_key = "6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc";
static const float tab_text_size = 18.0f;
static const float tab_height = tab_text_size + 10.0f;
static const sf::Color tab_selected_color(55, 60, 68);
-static const sf::Color tab_unselected_color(32, 36, 42);
+static const float tab_margin_x = 10.0f;
// Prevent writing to broken pipe from exiting the program
static void sigpipe_handler(int) {
@@ -1043,13 +1042,14 @@ namespace QuickMedia {
bool redraw = true;
sf::Event event;
- sf::RectangleShape tab_spacing_rect(sf::Vector2f(0.0f, 0.0f));
- tab_spacing_rect.setFillColor(tab_unselected_color);
const float tab_spacer_height = 0.0f;
sf::RectangleShape tab_drop_shadow;
tab_drop_shadow.setFillColor(sf::Color(23, 25, 27));
+ sf::RoundedRectangleShape tab_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10);
+ tab_background.setFillColor(tab_selected_color);
+
//sf::Clock tt;
//int fps = 0;
while (current_page == Page::SEARCH_SUGGESTION) {
@@ -1154,12 +1154,8 @@ namespace QuickMedia {
window.clear(back_color);
{
- //tab_spacing_rect.setPosition(0.0f, search_bar->getBottomWithoutShadow());
- //tab_spacing_rect.setSize(sf::Vector2f(window_size.x, tab_spacer_height));
- //window.draw(tab_spacing_rect);
-
const float width_per_tab = window_size.x / tabs.size();
- sf::RectangleShape tab_background(sf::Vector2f(std::floor(width_per_tab), tab_height));
+ tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height));
float tab_vertical_offset = search_bar->getBottomWithoutShadow();
if(tabs[selected_tab].body) {
@@ -1175,12 +1171,9 @@ namespace QuickMedia {
int i = 0;
for(Tab &tab : tabs) {
if(i == selected_tab) {
- tab_background.setFillColor(tab_selected_color);
- } else {
- tab_background.setFillColor(tab_unselected_color);
+ tab_background.setPosition(std::floor(i * width_per_tab + tab_margin_x), tab_spacer_height + std::floor(tab_vertical_offset));
+ window.draw(tab_background);
}
- tab_background.setPosition(std::floor(i * width_per_tab), tab_spacer_height + std::floor(tab_vertical_offset));
- window.draw(tab_background);
const float center = (i * width_per_tab) + (width_per_tab * 0.5f);
tab.text->setPosition(std::floor(center - tab.text->getLocalBounds().width * 0.5f), tab_y);
window.draw(*tab.text);
@@ -1825,6 +1818,9 @@ namespace QuickMedia {
sf::RectangleShape tab_drop_shadow;
tab_drop_shadow.setFillColor(sf::Color(23, 25, 27));
+ sf::RoundedRectangleShape tab_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10);
+ tab_background.setFillColor(tab_selected_color);
+
while (current_page == Page::EPISODE_LIST) {
while (window.pollEvent(event)) {
base_event_handler(event, Page::SEARCH_SUGGESTION, false, true);
@@ -1875,7 +1871,7 @@ namespace QuickMedia {
window.clear(back_color);
const float width_per_tab = window_size.x / tabs.size();
- sf::RectangleShape tab_background(sf::Vector2f(std::floor(width_per_tab), tab_height));
+ tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height));
float tab_vertical_offset = search_bar->getBottomWithoutShadow();
if(tabs[selected_tab].type == EpisodeListTabType::CHAPTERS)
@@ -1895,13 +1891,10 @@ namespace QuickMedia {
tab.body->clamp_selection();
}
- if(i == selected_tab)
- tab_background.setFillColor(tab_selected_color);
- else
- tab_background.setFillColor(tab_unselected_color);
-
- tab_background.setPosition(std::floor(i * width_per_tab), tab_spacer_height + std::floor(tab_vertical_offset));
- window.draw(tab_background);
+ if(i == selected_tab) {
+ tab_background.setPosition(std::floor(i * width_per_tab + tab_margin_x), tab_spacer_height + std::floor(tab_vertical_offset));
+ window.draw(tab_background);
+ }
const float center = (i * width_per_tab) + (width_per_tab * 0.5f);
tab.text.setPosition(std::floor(center - tab.text.getLocalBounds().width * 0.5f), tab_y);
window.draw(tab.text);
@@ -3159,7 +3152,7 @@ namespace QuickMedia {
messages_tab.type = ChatTabType::MESSAGES;
messages_tab.body = std::make_unique<Body>(this, &font, &bold_font);
messages_tab.body->draw_thumbnails = true;
- messages_tab.body->line_seperator_color = sf::Color::Transparent;
+ //messages_tab.body->line_seperator_color = sf::Color::Transparent;
messages_tab.text = sf::Text("Messages", font, tab_text_size);
tabs.push_back(std::move(messages_tab));
@@ -3167,7 +3160,7 @@ namespace QuickMedia {
rooms_tab.type = ChatTabType::ROOMS;
rooms_tab.body = std::make_unique<Body>(this, &font, &bold_font);
rooms_tab.body->draw_thumbnails = true;
- rooms_tab.body->line_seperator_color = sf::Color::Transparent;
+ //rooms_tab.body->line_seperator_color = sf::Color::Transparent;
rooms_tab.text = sf::Text("Rooms", font, tab_text_size);
tabs.push_back(std::move(rooms_tab));
@@ -3306,6 +3299,9 @@ namespace QuickMedia {
sf::RectangleShape tab_drop_shadow;
tab_drop_shadow.setFillColor(sf::Color(23, 25, 27));
+ sf::RoundedRectangleShape tab_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10);
+ tab_background.setFillColor(tab_selected_color);
+
while (current_page == Page::CHAT) {
while (window.pollEvent(event)) {
base_event_handler(event, Page::EXIT, false, false, false);
@@ -3415,21 +3411,18 @@ namespace QuickMedia {
window.clear(back_color);
const float width_per_tab = window_size.x / tabs.size();
- sf::RectangleShape tab_background(sf::Vector2f(std::floor(width_per_tab), tab_height));
+ tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height));
- float tab_vertical_offset = 0.0f;
+ float tab_vertical_offset = 10.0f;
tabs[selected_tab].body->draw(window, body_pos, body_size);
const float tab_y = tab_spacer_height + std::floor(tab_vertical_offset + tab_height * 0.5f - (tab_text_size + 5.0f) * 0.5f);
int i = 0;
for(ChatTab &tab : tabs) {
- if(i == selected_tab)
- tab_background.setFillColor(tab_selected_color);
- else
- tab_background.setFillColor(tab_unselected_color);
-
- tab_background.setPosition(std::floor(i * width_per_tab), tab_spacer_height + std::floor(tab_vertical_offset));
- window.draw(tab_background);
+ if(i == selected_tab) {
+ tab_background.setPosition(std::floor(i * width_per_tab + tab_margin_x), tab_spacer_height + std::floor(tab_vertical_offset));
+ window.draw(tab_background);
+ }
const float center = (i * width_per_tab) + (width_per_tab * 0.5f);
tab.text.setPosition(std::floor(center - tab.text.getLocalBounds().width * 0.5f), tab_y);
window.draw(tab.text);