added hyperlinks

This commit is contained in:
OmniTroid 2017-02-19 20:10:28 +01:00
parent 16e72e9023
commit 0044141c14
4 changed files with 37 additions and 12 deletions

View File

@ -13,7 +13,7 @@ RC_ICONS = logo.ico
TARGET = Attorney_Online_remake TARGET = Attorney_Online_remake
TEMPLATE = app TEMPLATE = app
VERSION = 2.2.1.0 VERSION = 2.2.2.0
SOURCES += main.cpp\ SOURCES += main.cpp\
lobby.cpp \ lobby.cpp \

View File

@ -125,7 +125,7 @@ public:
private: private:
const int RELEASE = 2; const int RELEASE = 2;
const int MAJOR_VERSION = 2; const int MAJOR_VERSION = 2;
const int MINOR_VERSION = 1; const int MINOR_VERSION = 2;
QString user_theme = "default"; QString user_theme = "default";

View File

@ -76,12 +76,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_ic_chatlog = new QPlainTextEdit(this); ui_ic_chatlog = new QPlainTextEdit(this);
ui_ic_chatlog->setReadOnly(true); ui_ic_chatlog->setReadOnly(true);
ui_ms_chatlog = new QPlainTextEdit(this); ui_ms_chatlog = new QTextBrowser(this);
ui_ms_chatlog->setReadOnly(true); ui_ms_chatlog->setReadOnly(true);
ui_ms_chatlog->setOpenExternalLinks(true);
ui_ms_chatlog->hide(); ui_ms_chatlog->hide();
ui_server_chatlog = new QPlainTextEdit(this); ui_server_chatlog = new QTextBrowser(this);
ui_server_chatlog->setReadOnly(true); ui_server_chatlog->setReadOnly(true);
ui_server_chatlog->setOpenExternalLinks(true);
ui_mute_list = new QListWidget(this); ui_mute_list = new QListWidget(this);
//ui_area_list = new QListWidget(this); //ui_area_list = new QListWidget(this);
@ -410,10 +412,10 @@ void Courtroom::set_widgets()
"color: white; }"); "color: white; }");
set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); set_size_and_pos(ui_ms_chatlog, "ms_chatlog");
ui_ms_chatlog->setStyleSheet("QPlainTextEdit{ background-color: rgba(0, 0, 0, 0); }"); ui_ms_chatlog->setStyleSheet("QTextBrowser{ background-color: rgba(0, 0, 0, 0); }");
set_size_and_pos(ui_server_chatlog, "server_chatlog"); set_size_and_pos(ui_server_chatlog, "server_chatlog");
ui_server_chatlog->setStyleSheet("QPlainTextEdit{ background-color: rgba(0, 0, 0, 0); }"); ui_server_chatlog->setStyleSheet("QTextBrowser{ background-color: rgba(0, 0, 0, 0); }");
set_size_and_pos(ui_mute_list, "mute_list"); set_size_and_pos(ui_mute_list, "mute_list");
ui_mute_list->hide(); ui_mute_list->hide();
@ -834,7 +836,18 @@ void Courtroom::append_ms_chatmessage(QString f_message)
ui_ms_chatlog->moveCursor(QTextCursor::End); ui_ms_chatlog->moveCursor(QTextCursor::End);
ui_ms_chatlog->appendPlainText(f_message); QStringList word_list = f_message.split(" ");
f_message = "";
for (QString i_word : word_list)
{
if (i_word.startsWith("http"))
i_word = "<a href=\"" + i_word + "\">" + i_word + "</a>";
f_message += i_word + " ";
}
ui_ms_chatlog->append(f_message);
if (old_cursor.hasSelection() || !is_scrolled_down) if (old_cursor.hasSelection() || !is_scrolled_down)
{ {
@ -858,7 +871,18 @@ void Courtroom::append_server_chatmessage(QString f_message)
ui_server_chatlog->moveCursor(QTextCursor::End); ui_server_chatlog->moveCursor(QTextCursor::End);
ui_server_chatlog->appendPlainText(f_message); QStringList word_list = f_message.split(" ");
f_message = "";
for (QString i_word : word_list)
{
if (i_word.startsWith("http"))
i_word = "<a href=\"" + i_word + "\">" + i_word + "</a>";
f_message += i_word + " ";
}
ui_server_chatlog->append(f_message);
if (old_cursor.hasSelection() || !is_scrolled_down) if (old_cursor.hasSelection() || !is_scrolled_down)
{ {
@ -1446,7 +1470,7 @@ void Courtroom::set_ip_list(QString p_list)
{ {
QString f_list = p_list.replace("|", ":").replace("*", "\n"); QString f_list = p_list.replace("|", ":").replace("*", "\n");
ui_server_chatlog->appendPlainText(f_list); ui_server_chatlog->append(f_list);
} }
void Courtroom::set_mute(bool p_muted, int p_cid) void Courtroom::set_mute(bool p_muted, int p_cid)
@ -1533,7 +1557,7 @@ void Courtroom::set_hp_bar(int p_bar, int p_state)
void Courtroom::mod_called(QString p_ip) void Courtroom::mod_called(QString p_ip)
{ {
ui_server_chatlog->appendPlainText(p_ip); ui_server_chatlog->append(p_ip);
if (ui_guard->isChecked()) if (ui_guard->isChecked())
modcall_player->play("sfx-gallery.wav"); modcall_player->play("sfx-gallery.wav");
} }

View File

@ -26,6 +26,7 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <QSignalMapper> #include <QSignalMapper>
#include <QMap> #include <QMap>
#include <QTextBrowser>
class AOApplication; class AOApplication;
@ -221,8 +222,8 @@ private:
QPlainTextEdit *ui_ic_chatlog; QPlainTextEdit *ui_ic_chatlog;
QPlainTextEdit *ui_ms_chatlog; QTextBrowser *ui_ms_chatlog;
QPlainTextEdit *ui_server_chatlog; QTextBrowser *ui_server_chatlog;
QListWidget *ui_mute_list; QListWidget *ui_mute_list;
QListWidget *ui_area_list; QListWidget *ui_area_list;