added aotextarea class and prepared to refactor ooc chats and fix another bug related to hyperlinks

This commit is contained in:
OmniTroid 2017-03-25 02:27:17 +01:00
parent 924d29e46c
commit 332d20c858
4 changed files with 28 additions and 4 deletions

View File

@ -43,7 +43,8 @@ SOURCES += main.cpp\
aoblipplayer.cpp \ aoblipplayer.cpp \
evidence.cpp \ evidence.cpp \
aoevidencebutton.cpp \ aoevidencebutton.cpp \
charselect.cpp charselect.cpp \
aotextarea.cpp
HEADERS += lobby.h \ HEADERS += lobby.h \
aoimage.h \ aoimage.h \
@ -68,7 +69,8 @@ HEADERS += lobby.h \
aosfxplayer.h \ aosfxplayer.h \
aomusicplayer.h \ aomusicplayer.h \
aoblipplayer.h \ aoblipplayer.h \
aoevidencebutton.h aoevidencebutton.h \
aotextarea.h
unix:LIBS += -L$$PWD -lbass unix:LIBS += -L$$PWD -lbass
win32:LIBS += "$$PWD/bass.dll" win32:LIBS += "$$PWD/bass.dll"

6
aotextarea.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "aotextarea.h"
AOTextArea::AOTextArea()
{
}

14
aotextarea.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef AOTEXTAREA_H
#define AOTEXTAREA_H
#include <QTextBrowser>
class AOTextArea : public QTextBrowser
{
public:
AOTextArea();
append_text();
};
#endif // AOTEXTAREA_H

View File

@ -9,6 +9,7 @@
#include <QDebug> #include <QDebug>
#include <QScrollBar> #include <QScrollBar>
#include <QRegExp>
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
{ {
@ -774,13 +775,14 @@ void Courtroom::append_server_chatmessage(QString f_name, QString f_message)
ui_server_chatlog->insertPlainText(f_name + ": "); ui_server_chatlog->insertPlainText(f_name + ": ");
QStringList word_list = f_message.split(" "); QRegExp split_rx("(\\ |\\n)");
QStringList word_list = f_message.split(split_rx);
for (QString i_word : word_list) for (QString i_word : word_list)
{ {
if (i_word.startsWith("http")) if (i_word.startsWith("http"))
{ {
i_word.replace("\n", "").replace("\r", ""); i_word.replace("\r", "");
ui_server_chatlog->insertHtml("<a href=\"" + i_word + "\">" + i_word + "</a> "); ui_server_chatlog->insertHtml("<a href=\"" + i_word + "\">" + i_word + "</a> ");
} }
else else