diff options
| author | OmniTroid <davidskoland@gmail.com> | 2017-04-05 14:53:49 +0200 |
|---|---|---|
| committer | OmniTroid <davidskoland@gmail.com> | 2017-04-05 14:53:49 +0200 |
| commit | 2dfdf351efb7bfd01fe1327614b27173cb4a8b8e (patch) | |
| tree | 6cb0009499f6f373c185aecdfbc6b8d759f345f5 | |
| parent | e580fd3b29c66b06e2a111411ff24366d5b5ffe8 (diff) | |
added emote spacing
| -rw-r--r-- | charselect.cpp | 2 | ||||
| -rw-r--r-- | courtroom.cpp | 9 | ||||
| -rw-r--r-- | emotes.cpp | 30 |
3 files changed, 20 insertions, 21 deletions
diff --git a/charselect.cpp b/charselect.cpp index 1f18217b..279b7255 100644 --- a/charselect.cpp +++ b/charselect.cpp @@ -54,8 +54,6 @@ void Courtroom::construct_char_select() ++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) { ++y_mod_count; diff --git a/courtroom.cpp b/courtroom.cpp index d8d9d4c1..e838f05b 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -111,7 +111,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() //////////emotes////////////////////// - ui_emotes = new QWidget(this); + construct_emotes(); ui_emote_left = 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_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))); @@ -253,9 +255,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() construct_evidence(); - //implementation in emotes.cpp - construct_emotes(); - set_char_select(); } @@ -6,25 +6,29 @@ void Courtroom::construct_emotes() { - //constructing emote button grid - const int base_x_pos{0}; - const int base_y_pos{0}; + ui_emotes = new QWidget(this); - const int x_modifier{49}; - int x_mod_count{0}; + set_size_and_pos(ui_emotes, "emotes"); - const int y_modifier{49}; - int y_mod_count{0}; + QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); - emote_columns = ui_emotes->width() / x_modifier; - emote_rows = ui_emotes->height() / y_modifier; + const int button_width = 40; + 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; for (int n = 0 ; n < max_emotes_on_page ; ++n) { - int x_pos = base_x_pos + (x_modifier * x_mod_count); - int y_pos = base_y_pos + (y_modifier * y_mod_count); + int x_pos = (button_width + x_spacing) * x_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); @@ -42,9 +46,6 @@ void Courtroom::construct_emotes() 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() @@ -161,6 +162,7 @@ void Courtroom::on_emote_left_clicked() void Courtroom::on_emote_right_clicked() { + qDebug() << "emote right clicked"; ++current_emote_page; set_emote_page(); |
