aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-14 18:49:55 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-14 18:49:55 +0100
commit267fe47c5fa9902d36ed97b38789081ec4b6da7a (patch)
tree6dc1f0d5a3fa1369927d705af9f278a3ae744852
parent47f96cf0a4efe785389db8a3dad16e17976bc46b (diff)
added evidence button grid
-rw-r--r--aoevidencebutton.cpp5
-rw-r--r--aoevidencebutton.h7
-rw-r--r--evidence.cpp27
3 files changed, 26 insertions, 13 deletions
diff --git a/aoevidencebutton.cpp b/aoevidencebutton.cpp
index d4adce86..f2cd1dd6 100644
--- a/aoevidencebutton.cpp
+++ b/aoevidencebutton.cpp
@@ -2,9 +2,12 @@
#include "file_functions.h"
-AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app) : QPushButton(p_parent)
+AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
{
ao_app = p_ao_app;
+
+ this->move(p_x, p_y);
+ this->resize(70, 70);
}
void AOEvidenceButton::set_image(QString p_image)
diff --git a/aoevidencebutton.h b/aoevidencebutton.h
index 1ac9878b..6409a170 100644
--- a/aoevidencebutton.h
+++ b/aoevidencebutton.h
@@ -8,13 +8,18 @@
class AOEvidenceButton : public QPushButton
{
+ Q_OBJECT
+
public:
- AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app);
+ AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
void set_image(QString p_image);
+ void set_id(int p_id) {m_id = p_id;}
private:
AOApplication *ao_app;
+
+ int m_id;
};
#endif // AOEVIDENCEBUTTON_H
diff --git a/evidence.cpp b/evidence.cpp
index 51a568f8..256a1c25 100644
--- a/evidence.cpp
+++ b/evidence.cpp
@@ -1,39 +1,44 @@
#include "courtroom.h"
+#include <QDebug>
+
void Courtroom::construct_evidence()
{
//constructing evidence button grid
- const int base_x_pos{10};
- const int base_y_pos{0};
+ const int base_x_pos{28};
+ const int base_y_pos{27};
- const int x_modifier{49};
+ const int x_modifier{72};
int x_mod_count{0};
- const int y_modifier{49};
+ const int y_modifier{73};
int y_mod_count{0};
evidence_columns = ui_evidence->width() / x_modifier;
+ qDebug() << "columns: " << evidence_columns;
evidence_rows = ui_evidence->height() / y_modifier;
+ qDebug() << "rows: " << evidence_rows;
max_evidence_on_page = evidence_columns * evidence_rows;
- for (int n = 0 ; n < max_emotes_on_page ; ++n)
+ qDebug() << "max_evidence_on_page: " << max_evidence_on_page;
+
+ for (int n = 0 ; n < max_evidence_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);
- AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos);
+ AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence, ao_app, x_pos, y_pos);
- ui_emote_list.append(f_emote);
+ ui_evidence_list.append(f_evidence);
- f_emote->set_id(n);
+ f_evidence->set_id(n);
- connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int)));
+ //connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int)));
++x_mod_count;
- //if emote number is divisible by columns with rest columns -1 then the next emote button should start on a new line
- if ((n % emote_columns) == (emote_columns - 1) && (n != 0))
+ if (x_mod_count == evidence_columns)
{
++y_mod_count;
x_mod_count = 0;