From b48ca2455a2c7674859b2d3d8be2896cdc0f3739 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:26:39 -0600 Subject: Add the ability for shownames to be outlined (#939) * showname text outline, partial messagebox outline code * your honor i plead oopsie daisies * Focus down code, add config hookups * remove extraneous qDebug calls --- include/aotextboxwidgets.h | 32 ++++++++++++++++++++++++++++++++ include/courtroom.h | 13 ++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 include/aotextboxwidgets.h (limited to 'include') diff --git a/include/aotextboxwidgets.h b/include/aotextboxwidgets.h new file mode 100644 index 0000000..39bf406 --- /dev/null +++ b/include/aotextboxwidgets.h @@ -0,0 +1,32 @@ +#ifndef AOTEXTBOXWIDGETS_H +#define AOTEXTBOXWIDGETS_H + +#include +#include +#include +#include +#include +#include +#include + +class AOChatboxLabel : public QLabel { + Q_OBJECT + +public: + AOChatboxLabel(QWidget *parent); + void paintEvent(QPaintEvent *event); + + void setOutlineColor(QColor color) { outline_color = color; }; + void setOutlineWidth(int width) { outline_width = width; }; + void setTextColor(QColor color) { text_color = color; }; + void setIsOutlined(bool outlined) { is_outlined = outlined; }; + +protected: +private: + QColor outline_color; + QColor text_color; + int outline_width = 1; + bool is_outlined = false; +}; + +#endif // AOTEXTBOXWIDGETS_H diff --git a/include/courtroom.h b/include/courtroom.h index 65ef75a..0b26247 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -7,24 +7,25 @@ #include "aocharbutton.h" #include "aoclocklabel.h" #include "aoemotebutton.h" +#include "aoemotepreview.h" #include "aoevidencebutton.h" #include "aoevidencedisplay.h" #include "aoimage.h" #include "aolayer.h" #include "aomusicplayer.h" -#include "widgets/aooptionsdialog.h" #include "aopacket.h" #include "aosfxplayer.h" #include "aotextarea.h" +#include "aotextboxwidgets.h" #include "chatlogpiece.h" #include "datatypes.h" #include "debug_functions.h" +#include "eventfilters.h" #include "file_functions.h" #include "hardware_functions.h" #include "lobby.h" #include "scrolltext.h" -#include "eventfilters.h" -#include "aoemotepreview.h" +#include "widgets/aooptionsdialog.h" #include #include @@ -145,7 +146,9 @@ public: // actual operation of setting the font on a widget void set_qfont(QWidget *widget, QString class_name, QFont font, - QColor f_color = Qt::black, bool bold = false); + QColor f_color = Qt::black, bool bold = false, + bool outlined = false, QColor outline_color = QColor(0, 0, 0), + int outline_width = 1); // helper function that calls above function on the relevant widgets void set_fonts(QString p_char = ""); @@ -654,7 +657,7 @@ private: BackgroundLayer *ui_vp_desk; AOEvidenceDisplay *ui_vp_evidence_display; AOImage *ui_vp_chatbox; - QLabel *ui_vp_showname; + AOChatboxLabel *ui_vp_showname; InterfaceLayer *ui_vp_chat_arrow; QTextEdit *ui_vp_message; SplashLayer *ui_vp_testimony; -- cgit