diff options
| author | Rosemary Witchaven <32779090+in1tiate@users.noreply.github.com> | 2022-05-21 09:21:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-21 16:21:34 +0200 |
| commit | 94dbdf73e06c95144efc88fb6a74ddb517613186 (patch) | |
| tree | 8d03f68720cbd99db43132c4535f9873e14d376c /src/aoevidencedisplay.cpp | |
| parent | 8657f7c2a2fbcbce52b744de50159ac5cdcc0ae8 (diff) | |
Feature: Clicking the evidence icon when it's presented by a player will show the details of that evidence (#760)
* Add click-to-view evidence icons
* Fix the clicky icon not being functional if the presented evidence comes from a different page from the first
Co-authored-by: in1tiate <radwoodward@vikings.grayson.edu>
Co-authored-by: Alex Noir <Varsash@gmail.com>
Diffstat (limited to 'src/aoevidencedisplay.cpp')
| -rw-r--r-- | src/aoevidencedisplay.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 0d3eae73..ed27c007 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -8,19 +8,23 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { ao_app = p_ao_app; - evidence_icon = new QLabel(this); + evidence_icon = new QPushButton(this); + evidence_icon->hide(); sfx_player = new AOSfxPlayer(this, ao_app); evidence_movie = new InterfaceLayer(this, ao_app); connect(evidence_movie, &InterfaceLayer::done, this, &AOEvidenceDisplay::show_done); + connect(evidence_icon, &QPushButton::clicked, this, &AOEvidenceDisplay::icon_clicked); } -void AOEvidenceDisplay::show_evidence(QString p_evidence_image, +void AOEvidenceDisplay::show_evidence(int p_index, QString p_evidence_image, bool is_left_side, int p_volume) { this->reset(); + last_evidence_index = p_index; + sfx_player->set_volume(p_volume); QString gif_name; @@ -43,8 +47,11 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height); - evidence_icon->setPixmap(f_pixmap); - evidence_icon->resize(f_pixmap.size()); + QIcon f_icon(f_pixmap); + + evidence_icon->setIcon(f_icon); + evidence_icon->setIconSize(f_pixmap.rect().size()); + evidence_icon->resize(f_pixmap.rect().size()); evidence_icon->move(icon_dimensions.x, icon_dimensions.y); evidence_movie->static_duration = 320; evidence_movie->max_duration = 1000; @@ -63,7 +70,11 @@ void AOEvidenceDisplay::reset() void AOEvidenceDisplay::show_done() { evidence_icon->show(); } -QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; } +void AOEvidenceDisplay::icon_clicked() { + if (last_evidence_index != -1) { + emit show_evidence_details(last_evidence_index - 1); // i dont know why i have to subtract 1 here + } +} void AOEvidenceDisplay::combo_resize(int w, int h) { |
