From ef49b46c37c3d1922db7afcbfd7a715a250a5b4c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 23 Jul 2022 18:18:54 +0300 Subject: Add Emote preview (#774) * Add an emote preview which pops up from right click context menu * rename action names to "preanim/idle/talk" * Improve emote preview window * Preview no longer ignores offsets No longer override stylesheets Add "Preview Selected" option to the dropdown * bruh * Fix "set play once" being ignored when a (c) emote is loaded * Remove useless comments * Implement Salanto suggestions Co-authored-by: stonedDiscord --- include/aoemotepreview.h | 32 ++++++++++++++++++++++++++++++++ include/courtroom.h | 9 +++++++++ 2 files changed, 41 insertions(+) create mode 100644 include/aoemotepreview.h (limited to 'include') diff --git a/include/aoemotepreview.h b/include/aoemotepreview.h new file mode 100644 index 0000000..315371b --- /dev/null +++ b/include/aoemotepreview.h @@ -0,0 +1,32 @@ +#ifndef AOEMOTEPREVIEW_H +#define AOEMOTEPREVIEW_H + +#include "aolayer.h" +#include + +class AOEmotePreview : public QWidget +{ + Q_OBJECT +public: + AOEmotePreview(QWidget *parent = nullptr, + AOApplication *p_ao_app = nullptr); + + void set_widgets(); + void play(QString emote, QString char_name, bool flipped = false, int self_offset = 0, int self_offset_v = 0); +private: + AOApplication *ao_app; + QWidget *ui_viewport; + BackgroundLayer *ui_vp_background; + SplashLayer *ui_vp_speedlines; + CharLayer *ui_vp_player_char; + BackgroundLayer *ui_vp_desk; + + QLabel *ui_size_label; + + QString m_emote = ""; + QString m_char = ""; +protected: + void resizeEvent(QResizeEvent *); +}; + +#endif // AOEMOTEPREVIEW_H diff --git a/include/courtroom.h b/include/courtroom.h index 43cecf3..eee84a6 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -24,6 +24,7 @@ #include "lobby.h" #include "scrolltext.h" #include "eventfilters.h" +#include "aoemotepreview.h" #include #include @@ -690,6 +691,9 @@ private: AOButton *ui_emote_left; AOButton *ui_emote_right; + QMenu *emote_menu; + AOEmotePreview *emote_preview; + QComboBox *ui_emote_dropdown; QComboBox *ui_pos_dropdown; AOButton *ui_pos_remove; @@ -920,6 +924,8 @@ private slots: void on_custom_objection_clicked(); void show_custom_objection_menu(const QPoint &pos); + void show_emote_menu(const QPoint &pos); + void on_realization_clicked(); void on_screenshake_clicked(); @@ -999,6 +1005,9 @@ private slots: // Proceed to parse the oldest chatmessage and remove it from the stack void chatmessage_dequeue(); + + void preview_emote(QString emote); + void update_emote_preview(); }; #endif // COURTROOM_H -- cgit