diff --git a/include/aoapplication.h b/include/aoapplication.h index cd9f736..2dc8649 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -228,6 +228,9 @@ public: // for settings. bool is_customchat_enabled(); + // Returns the value of characer sticker (avatar) setting + bool is_sticker_enabled(); + // Returns the value of whether continuous playback should be used // from the config.ini. bool is_continuous_enabled(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 31f3d66..e88ce54 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -108,6 +108,9 @@ private: QLabel *ui_customchat_lbl; QCheckBox *ui_customchat_cb; + QLabel *ui_sticker_lbl; + QCheckBox *ui_sticker_cb; + QLabel *ui_continuous_lbl; QCheckBox *ui_continuous_cb; diff --git a/src/aolayer.cpp b/src/aolayer.cpp index 8d2c796..e2a1f07 100644 --- a/src/aolayer.cpp +++ b/src/aolayer.cpp @@ -240,12 +240,11 @@ void InterfaceLayer::load_image(QString p_filename, QString p_miscname) void StickerLayer::load_image(QString p_charname) { - QString p_miscname = ao_app->get_chat(p_charname); + QString p_miscname; + if (ao_app->is_customchat_enabled()) + p_miscname = ao_app->get_chat(p_charname); transform_mode = ao_app->get_misc_scaling(p_miscname); QString final_image = ao_app->get_image("sticker/" + p_charname, ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, p_miscname); - if (!file_exists((final_image))) - final_image = ao_app->get_image_suffix( - ao_app->get_character_path(p_charname, "showname")), // Scuffed DRO way start_playback(final_image); } diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index dfd8555..5817d96 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -485,6 +485,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb); + row += 1; + ui_sticker_lbl = new QLabel(ui_form_layout_widget); + ui_sticker_lbl->setText(tr("Stickers:")); + ui_sticker_lbl->setToolTip( + tr("Turn this on to allow characters to define their own " + "stickers (unique images that show up over the chatbox - like avatars or shownames).")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_sticker_lbl); + + ui_sticker_cb = new QCheckBox(ui_form_layout_widget); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_sticker_cb); + row += 1; ui_continuous_lbl = new QLabel(ui_form_layout_widget); ui_continuous_lbl->setText(tr("Continuous Playback:")); @@ -909,6 +922,7 @@ void AOOptionsDialog::update_values() { ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled()); ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled()); ui_customchat_cb->setChecked(ao_app->is_customchat_enabled()); + ui_sticker_cb->setChecked(ao_app->is_sticker_enabled()); ui_continuous_cb->setChecked(ao_app->is_continuous_enabled()); ui_category_stop_cb->setChecked(ao_app->is_category_stop_enabled()); ui_blank_blips_cb->setChecked(ao_app->get_blank_blip()); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3d67def..183bcba 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3209,7 +3209,8 @@ void Courtroom::start_chat_ticking() ui_vp_chatbox->show(); ui_vp_message->show(); - ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]); + if (ao_app->is_sticker_enabled()) + ui_vp_sticker->load_image(m_chatmessage[CHAR_NAME]); if (m_chatmessage[ADDITIVE] != "1") { ui_vp_message->clear(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 45df30d..4718f74 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -981,6 +981,12 @@ bool AOApplication::is_customchat_enabled() return result.startsWith("true"); } +bool AOApplication::is_sticker_enabled() +{ + QString result = configini->value("sticker", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::is_continuous_enabled() { QString result = configini->value("continuous_playback", "true").value();