added emote spacing

This commit is contained in:
OmniTroid 2017-04-05 14:53:49 +02:00
parent e580fd3b29
commit 2dfdf351ef
3 changed files with 20 additions and 21 deletions

View File

@ -54,8 +54,6 @@ void Courtroom::construct_char_select()
++x_mod_count; ++x_mod_count;
//if char number is divisible by ten with rest 9 then the next charicon should start on a new line
//if (n % 10 == 9 && n != 0)
if (x_mod_count == char_columns) if (x_mod_count == char_columns)
{ {
++y_mod_count; ++y_mod_count;

View File

@ -111,7 +111,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
//////////emotes////////////////////// //////////emotes//////////////////////
ui_emotes = new QWidget(this); construct_emotes();
ui_emote_left = new AOButton(this, ao_app); ui_emote_left = new AOButton(this, ao_app);
ui_emote_right = new AOButton(this, ao_app); ui_emote_right = new AOButton(this, ao_app);
@ -198,7 +198,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony())); connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony()));
connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony())); connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony()));
//emote signals are set in emotes.cpp
connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked()));
connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked()));
connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int)));
@ -253,9 +255,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
construct_evidence(); construct_evidence();
//implementation in emotes.cpp
construct_emotes();
set_char_select(); set_char_select();
} }

View File

@ -6,25 +6,29 @@
void Courtroom::construct_emotes() void Courtroom::construct_emotes()
{ {
//constructing emote button grid ui_emotes = new QWidget(this);
const int base_x_pos{0};
const int base_y_pos{0};
const int x_modifier{49}; set_size_and_pos(ui_emotes, "emotes");
int x_mod_count{0};
const int y_modifier{49}; QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini");
int y_mod_count{0};
emote_columns = ui_emotes->width() / x_modifier; const int button_width = 40;
emote_rows = ui_emotes->height() / y_modifier; int x_spacing = f_spacing.x();
int x_mod_count = 0;
const int button_height = 40;
int y_spacing = f_spacing.y();
int y_mod_count = 0;
emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
max_emotes_on_page = emote_columns * emote_rows; max_emotes_on_page = emote_columns * emote_rows;
for (int n = 0 ; n < max_emotes_on_page ; ++n) for (int n = 0 ; n < max_emotes_on_page ; ++n)
{ {
int x_pos = base_x_pos + (x_modifier * x_mod_count); int x_pos = (button_width + x_spacing) * x_mod_count;
int y_pos = base_y_pos + (y_modifier * y_mod_count); int y_pos = (button_height + y_spacing) * y_mod_count;
AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos); AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos);
@ -42,9 +46,6 @@ void Courtroom::construct_emotes()
x_mod_count = 0; x_mod_count = 0;
} }
} }
connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked()));
connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked()));
} }
void Courtroom::set_emote_page() void Courtroom::set_emote_page()
@ -161,6 +162,7 @@ void Courtroom::on_emote_left_clicked()
void Courtroom::on_emote_right_clicked() void Courtroom::on_emote_right_clicked()
{ {
qDebug() << "emote right clicked";
++current_emote_page; ++current_emote_page;
set_emote_page(); set_emote_page();