aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <Varsash@Gmail.com>2020-07-23 20:28:53 +0300
committerGitHub <noreply@github.com>2020-07-23 19:28:53 +0200
commitb2a5f517d979361c5f04182e602155ed4e6439e1 (patch)
tree6be97f545860be2dc1ea63184c6f6baa86373853
parentbcbc48f9b055e7bd6960fdc7b028e8bf6b14863c (diff)
Add showname alignment option for theme makers (#189)
* Add alignment options for shownames * Make shownames align to the left by default like before * Use this branch as an opportunity to fix showname not being resized according to misc/ folder courtroom_design.ini
-rw-r--r--src/courtroom.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index effef543..943a8f8d 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -84,7 +84,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_vp_chatbox = new AOImage(this, ao_app);
ui_vp_showname = new QLabel(ui_vp_chatbox);
- ui_vp_showname->setAlignment(Qt::AlignHCenter);
+ ui_vp_showname->setAlignment(Qt::AlignLeft);
ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app);
ui_vp_chat_arrow->set_play_once(false);
@@ -1873,7 +1873,7 @@ void Courtroom::handle_chatmessage_2()
{
ui_vp_chatbox->set_image("chatblank");
}
- else // Aw yeah dude do some showname resizing magic
+ else // Aw yeah dude do some showname magic
{
if (!ui_vp_chatbox->set_image("chat"))
ui_vp_chatbox->set_image("chatbox");
@@ -1913,6 +1913,19 @@ void Courtroom::handle_chatmessage_2()
->get_design_element("showname_extra_width", "courtroom_design.ini",
customchar)
.toInt();
+ QString align =
+ ao_app
+ ->get_design_element("showname_align", "courtroom_design.ini",
+ customchar)
+ .toLower();
+ if (align == "right")
+ ui_vp_showname->setAlignment(Qt::AlignRight);
+ else if (align == "center")
+ ui_vp_showname->setAlignment(Qt::AlignHCenter);
+ else if (align == "justify")
+ ui_vp_showname->setAlignment(Qt::AlignHCenter);
+ else
+ ui_vp_showname->setAlignment(Qt::AlignLeft);
if (extra_width > 0) {
if (fm_width > default_width.width &&
@@ -1934,6 +1947,10 @@ void Courtroom::handle_chatmessage_2()
else
ui_vp_showname->resize(default_width.width, ui_vp_showname->height());
}
+ else
+ {
+ ui_vp_showname->resize(default_width.width, ui_vp_showname->height());
+ }
}
ui_vp_message->hide();