aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmniTroid <davidskoland@gmail.com>2017-06-16 08:16:09 +0200
committerOmniTroid <davidskoland@gmail.com>2017-06-16 08:16:09 +0200
commitdc79673bee14efc6ed422dc37b231490686d8b5b (patch)
treed7cadae41004127b1b2f84e5522bee3dda361bd3
parenta8104c9ef2ef4cf6f92caf32fd52d727a74576c2 (diff)
fixed evidence description bug and local mute
-rw-r--r--aoevidencebutton.cpp18
-rw-r--r--aoevidencebutton.h2
-rw-r--r--courtroom.cpp46
-rw-r--r--courtroom.h8
-rw-r--r--evidence.cpp8
5 files changed, 75 insertions, 7 deletions
diff --git a/aoevidencebutton.cpp b/aoevidencebutton.cpp
index 36f4adf4..96bf5534 100644
--- a/aoevidencebutton.cpp
+++ b/aoevidencebutton.cpp
@@ -25,6 +25,7 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, i
this->move(p_x, p_y);
this->resize(70, 70);
+ this->setAcceptDrops(true);
connect(this, SIGNAL(clicked()), this, SLOT(on_clicked()));
}
@@ -81,11 +82,26 @@ void AOEvidenceButton::on_clicked()
evidence_clicked(m_id);
}
-void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) {
+void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
+{
QPushButton::mouseDoubleClickEvent(e);
evidence_double_clicked(m_id);
}
+void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e)
+{
+ //QWidget::dragLeaveEvent(e);
+
+ qDebug() << "drag leave event";
+}
+
+void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
+{
+ //QWidget::dragEnterEvent(e);
+
+ qDebug() << "drag enter event";
+}
+
void AOEvidenceButton::enterEvent(QEvent * e)
{
ui_selector->show();
diff --git a/aoevidencebutton.h b/aoevidencebutton.h
index 9657f074..ee0a0f64 100644
--- a/aoevidencebutton.h
+++ b/aoevidencebutton.h
@@ -34,6 +34,8 @@ protected:
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
+ void dragLeaveEvent(QMouseEvent *e);
+ void dragEnterEvent(QMouseEvent *e);
signals:
void evidence_clicked(int p_id);
diff --git a/courtroom.cpp b/courtroom.cpp
index 2b151397..137ab728 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -266,6 +266,12 @@ void Courtroom::set_mute_list()
{
mute_map.clear();
+ //maps which characters are muted based on cid, none are muted by default
+ for (int n_cid = 0 ; n_cid < char_list.size() ; n_cid++)
+ {
+ mute_map.insert(n_cid, false);
+ }
+
QStringList sorted_mute_list;
for (char_type i_char : char_list)
@@ -275,7 +281,7 @@ void Courtroom::set_mute_list()
for (QString i_name : sorted_mute_list)
{
- mute_map.insert(i_name, false);
+ //mute_map.insert(i_name, false);
ui_mute_list->addItem(i_name);
}
}
@@ -913,7 +919,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
if (f_char_id < 0 || f_char_id >= char_list.size())
return;
- if (mute_map.value(m_chatmessage[CHAR_NAME]))
+ if (mute_map.value(m_chatmessage[CHAR_ID].toInt()))
return;
QString f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
@@ -1507,7 +1513,7 @@ void Courtroom::handle_song(QStringList *p_contents)
{
QString str_char = char_list.at(n_char).name;
- if (!mute_map.value(str_char))
+ if (!mute_map.value(n_char))
{
append_ic_text(str_char + " has played a song: " + f_song + "\n");
music_player->play(f_song);
@@ -1690,6 +1696,39 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index)
QString real_char;
if (f_char.endsWith(" [x]"))
+ real_char = f_char.left(f_char.size() - 4);
+ else
+ real_char = f_char;
+
+ int f_cid = -1;
+
+ for (int n_char = 0 ; n_char < char_list.size() ; n_char++)
+ {
+ if (char_list.at(n_char).name == real_char)
+ f_cid = n_char;
+ }
+
+ if (f_cid < 0 || f_cid >= char_list.size())
+ {
+ qDebug() << "W: " << real_char << " not present in char_list";
+ return;
+ }
+
+ if (mute_map.value(f_cid))
+ {
+ mute_map.insert(f_cid, false);
+ f_item->setText(real_char);
+ }
+ else
+ {
+ mute_map.insert(f_cid, true);
+ f_item->setText(real_char + " [x]");
+ }
+
+
+
+ /*
+ if (f_char.endsWith(" [x]"))
{
real_char = f_char.left(f_char.size() - 4);
mute_map.remove(real_char);
@@ -1703,6 +1742,7 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index)
mute_map.insert(real_char, true);
f_item->setText(real_char + " [x]");
}
+ */
}
void Courtroom::on_music_list_double_clicked(QModelIndex p_model)
diff --git a/courtroom.h b/courtroom.h
index cd4679f8..8221f009 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -153,10 +153,16 @@ private:
bool testimony_in_progress = false;
+ //in milliseconds
const int testimony_show_time = 1500;
+
+ //in milliseconds
const int testimony_hide_time = 500;
- QMap<QString, bool> mute_map;
+ //char id, muted or not
+ QMap<int, bool> mute_map;
+
+ //QVector<int> muted_cids;
bool is_muted = false;
diff --git a/evidence.cpp b/evidence.cpp
index ba38d61f..a20fd06f 100644
--- a/evidence.cpp
+++ b/evidence.cpp
@@ -214,10 +214,14 @@ void Courtroom::on_evidence_clicked(int p_id)
void Courtroom::on_evidence_double_clicked(int p_id)
{
- if (p_id >= local_evidence_list.size())
+ int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
+
+ if (f_real_id >= local_evidence_list.size())
return;
- evi_type f_evi = local_evidence_list.at(p_id);
+ current_evidence = f_real_id;
+
+ evi_type f_evi = local_evidence_list.at(f_real_id);
ui_evidence_description->clear();
ui_evidence_description->appendPlainText(f_evi.description);