Allow lobby server descriptions to parse links
Fix bad reference to ui_emote_right image Fix chatbox being part of the viewport (gets cut off if it's outside)
This commit is contained in:
parent
9695c621c2
commit
6747bfdd5e
@ -12,6 +12,7 @@ class AOTextArea : public QTextBrowser
|
|||||||
public:
|
public:
|
||||||
AOTextArea(QWidget *p_parent = nullptr);
|
AOTextArea(QWidget *p_parent = nullptr);
|
||||||
|
|
||||||
|
void append_linked(QString p_message);
|
||||||
void append_chatmessage(QString p_name, QString p_message, QString p_colour);
|
void append_chatmessage(QString p_name, QString p_message, QString p_colour);
|
||||||
void append_error(QString p_message);
|
void append_error(QString p_message);
|
||||||
|
|
||||||
|
@ -5,6 +5,12 @@ AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOTextArea::append_linked(QString p_message)
|
||||||
|
{
|
||||||
|
QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(url_parser_regex, "<a href='\\1'>\\1</a>" );
|
||||||
|
this->insertHtml(result);
|
||||||
|
}
|
||||||
|
|
||||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour)
|
void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour)
|
||||||
{
|
{
|
||||||
const QTextCursor old_cursor = this->textCursor();
|
const QTextCursor old_cursor = this->textCursor();
|
||||||
|
@ -84,7 +84,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
|
|
||||||
ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app);
|
ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app);
|
||||||
|
|
||||||
ui_vp_chatbox = new AOImage(ui_viewport, ao_app);
|
ui_vp_chatbox = new AOImage(this, ao_app);
|
||||||
ui_vp_showname = new QLabel(ui_vp_chatbox);
|
ui_vp_showname = new QLabel(ui_vp_chatbox);
|
||||||
ui_vp_showname->setAlignment(Qt::AlignHCenter);
|
ui_vp_showname->setAlignment(Qt::AlignHCenter);
|
||||||
ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app);
|
ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app);
|
||||||
@ -566,7 +566,7 @@ void Courtroom::set_widgets()
|
|||||||
ui_emote_left->set_image("arrow_left");
|
ui_emote_left->set_image("arrow_left");
|
||||||
|
|
||||||
set_size_and_pos(ui_emote_right, "emote_right");
|
set_size_and_pos(ui_emote_right, "emote_right");
|
||||||
ui_emote_right->set_image("arrow_right.");
|
ui_emote_right->set_image("arrow_right");
|
||||||
|
|
||||||
set_size_and_pos(ui_emote_dropdown, "emote_dropdown");
|
set_size_and_pos(ui_emote_dropdown, "emote_dropdown");
|
||||||
set_size_and_pos(ui_pos_dropdown, "pos_dropdown");
|
set_size_and_pos(ui_pos_dropdown, "pos_dropdown");
|
||||||
|
@ -23,6 +23,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
ui_server_list = new QListWidget(this);
|
ui_server_list = new QListWidget(this);
|
||||||
ui_player_count = new QLabel(this);
|
ui_player_count = new QLabel(this);
|
||||||
ui_description = new AOTextArea(this);
|
ui_description = new AOTextArea(this);
|
||||||
|
ui_description->setOpenExternalLinks(true);
|
||||||
ui_chatbox = new AOTextArea(this);
|
ui_chatbox = new AOTextArea(this);
|
||||||
ui_chatbox->setOpenExternalLinks(true);
|
ui_chatbox->setOpenExternalLinks(true);
|
||||||
ui_chatname = new QLineEdit(this);
|
ui_chatname = new QLineEdit(this);
|
||||||
@ -376,7 +377,7 @@ void Lobby::on_server_list_clicked(QModelIndex p_model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui_description->clear();
|
ui_description->clear();
|
||||||
ui_description->append(f_server.desc);
|
ui_description->append_linked(f_server.desc);
|
||||||
|
|
||||||
ui_description->moveCursor(QTextCursor::Start);
|
ui_description->moveCursor(QTextCursor::Start);
|
||||||
ui_description->ensureCursorVisible();
|
ui_description->ensureCursorVisible();
|
||||||
|
Loading…
Reference in New Issue
Block a user