aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
authorCrystalwarrior <Varsash@Gmail.com>2021-01-19 16:02:28 +0300
committerGitHub <noreply@github.com>2021-01-19 16:02:28 +0300
commit0926f3c15842a71002c0ec374fd54832469036d8 (patch)
treee679c1b6f567f29ae09cbd52fa442dd752107f85 /src/courtroom.cpp
parent8c60fb2fcd32081daae94de62ff1d626192d7fae (diff)
Implement sticker logic with animated image support (#414)
* Implement sticker logic with animated image support (will probably be remade in a much better way for AOLayers) * port to aolayer Co-authored-by: in1tiate <radwoodward@vikings.grayson.edu>
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 8f5ee4b6..7a4cc3b7 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -134,6 +134,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
// todo: filter out \n from showing up as that commonly breaks the chatlog and
// can be spammed to hell
+ ui_vp_sticker = new StickerLayer(ui_viewport, ao_app);
+ ui_vp_sticker->set_play_once(false);
+ ui_vp_sticker->setAttribute(Qt::WA_TransparentForMouseEvents);
+
ui_muted = new AOImage(ui_ic_chat_message, ao_app);
ui_muted->hide();
@@ -534,9 +538,6 @@ void Courtroom::set_widgets()
ui_vp_desk->move(0, 0);
ui_vp_desk->combo_resize(ui_viewport->width(), ui_viewport->height());
- double y_modifier = 147.0 / 192.0;
- int final_y = static_cast<int>(y_modifier * ui_viewport->height());
-
ui_vp_evidence_display->move(0, 0);
ui_vp_evidence_display->combo_resize(ui_viewport->width(),
ui_viewport->height());
@@ -651,7 +652,7 @@ void Courtroom::set_widgets()
ao_app->get_element_dimensions("music_display", "courtroom_design.ini");
if (design_ini_result.width < 0 || design_ini_result.height < 0) {
- qDebug() << "W: could not find \"music_name\" in courtroom_design.ini";
+ qDebug() << "W: could not find \"music_display\" in courtroom_design.ini";
ui_music_display->hide();
}
else {
@@ -661,6 +662,7 @@ void Courtroom::set_widgets()
}
ui_music_display->load_image("music_display", "");
+
if (is_ao2_bg) {
set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
// set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
@@ -691,6 +693,10 @@ void Courtroom::set_widgets()
ui_vp_message->y() + ui_vp_chatbox->y());
ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
+ ui_vp_sticker->move(0, 0);
+ ui_vp_sticker->combo_resize(ui_viewport->width(),
+ ui_viewport->height());
+
ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height());
ui_muted->set_image("muted");
ui_muted->setToolTip(tr("Oops, you're muted!"));
@@ -2223,6 +2229,8 @@ void Courtroom::display_character()
// Hide the message and chatbox and handle the emotes
ui_vp_message->hide();
ui_vp_chatbox->hide();
+ // Hide the face sticker
+ ui_vp_sticker->stop();
// Initialize the correct pos (called SIDE here for some reason) with DESK_MOD to determine if we should hide the desk or not.
switch(m_chatmessage[DESK_MOD].toInt()) {
case 4:
@@ -3177,6 +3185,8 @@ void Courtroom::start_chat_ticking()
ui_vp_chatbox->show();
ui_vp_message->show();
+ ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]);
+
if (m_chatmessage[ADDITIVE] != "1") {
ui_vp_message->clear();
real_tick_pos = 0;