fixed evidence description bug and local mute
This commit is contained in:
parent
a8104c9ef2
commit
dc79673bee
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
@ -1689,6 +1695,39 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index)
|
||||
QString f_char = f_item->text();
|
||||
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);
|
||||
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user