aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-17 16:40:09 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-17 16:40:09 +0100
commitbcb368efb60fa77a71b3b1b2fe6eee5682b02c91 (patch)
tree844a6aee77a5f160be08fb57a368edad970000e0
parent57d921feb0f9f0ab92a1d96b6d60ec148aa2f571 (diff)
fixed emote dropdown issues
-rw-r--r--aocharmovie.cpp11
-rw-r--r--courtroom.cpp11
-rw-r--r--courtroom.h2
-rw-r--r--emotes.cpp13
4 files changed, 30 insertions, 7 deletions
diff --git a/aocharmovie.cpp b/aocharmovie.cpp
index 301b4a90..93d5d58a 100644
--- a/aocharmovie.cpp
+++ b/aocharmovie.cpp
@@ -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, "");
}
diff --git a/courtroom.cpp b/courtroom.cpp
index d6a3738a..e6b6d7a8 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -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") ||
diff --git a/courtroom.h b/courtroom.h
index 5238652c..1154de99 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -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();
diff --git a/emotes.cpp b/emotes.cpp
index 5d777647..21db249b 100644
--- a/emotes.cpp
+++ b/emotes.cpp
@@ -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);
}