fixed emote dropdown issues

This commit is contained in:
David Skoland 2017-02-17 16:40:09 +01:00
parent 57d921feb0
commit bcb368efb6
4 changed files with 30 additions and 7 deletions

View File

@ -96,8 +96,15 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
percentage_modifier = 100.0;
}
qDebug() << "% mod: " << percentage_modifier;
play_once = true;
//m_movie->jumpToFrame(m_movie->frameCount() - 1);
if (full_duration < real_duration)
{
play_once = false;
preanim_timer->start(full_duration);
}
else
play_once = true;
m_movie->setSpeed(static_cast<int>(percentage_modifier));
play(p_char, p_emote, "");
}

View File

@ -244,7 +244,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony()));
//emote signals are set in emotes.cpp
connect(ui_emote_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_emote_dropdown_changed(int)));
connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int)));
connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex)));
@ -1211,10 +1211,17 @@ void Courtroom::play_preanim()
QString f_preanim = m_chatmessage[PRE_EMOTE];
//all time values in char.inis are multiplied by a constant(time_mod) to get the actual time
int preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim);
int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60;
int preanim_duration;
if (ao2_duration < 0)
preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
else
preanim_duration = ao2_duration;
sfx_delay_timer->start(sfx_delay);
if (!file_exists(ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif") ||

View File

@ -337,6 +337,8 @@ private slots:
void on_music_search_edited(QString p_text);
void on_music_list_double_clicked(QModelIndex p_model);
void select_emote(int p_id);
void on_emote_clicked(int p_id);
void on_emote_left_clicked();

View File

@ -115,7 +115,7 @@ void Courtroom::set_emote_dropdown()
ui_emote_dropdown->addItems(emote_list);
}
void Courtroom::on_emote_clicked(int p_id)
void Courtroom::select_emote(int p_id)
{
int min = current_emote_page * max_emotes_on_page;
int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
@ -125,7 +125,7 @@ void Courtroom::on_emote_clicked(int p_id)
int old_emote = current_emote;
current_emote = p_id + max_emotes_on_page * current_emote_page;
current_emote = p_id;
if (current_emote >= min && current_emote <= max)
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
@ -141,9 +141,16 @@ void Courtroom::on_emote_clicked(int p_id)
else
ui_pre->setChecked(false);
ui_emote_dropdown->setCurrentIndex(current_emote);
ui_ic_chat_message->setFocus();
}
void Courtroom::on_emote_clicked(int p_id)
{
select_emote(p_id + max_emotes_on_page * current_emote_page);
}
void Courtroom::on_emote_left_clicked()
{
--current_emote_page;
@ -164,5 +171,5 @@ void Courtroom::on_emote_right_clicked()
void Courtroom::on_emote_dropdown_changed(int p_index)
{
on_emote_clicked(p_index);
select_emote(p_index);
}