diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index c627350..56efa7b 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -13,7 +13,7 @@ RC_ICONS = logo.ico TARGET = Attorney_Online_remake TEMPLATE = app -VERSION = 2.2.2.0 +VERSION = 2.2.3.0 SOURCES += main.cpp\ lobby.cpp \ diff --git a/aoapplication.h b/aoapplication.h index f25cb01..0509207 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -125,7 +125,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 2; - const int MINOR_VERSION = 2; + const int MINOR_VERSION = 3; QString user_theme = "default"; diff --git a/courtroom.cpp b/courtroom.cpp index 6a8dd49..85ab6f1 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -524,8 +524,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_blip_slider, "blip_slider"); set_size_and_pos(ui_evidence_button, "evidence_button"); - //ui_evidence_button->set_image("evidencebutton.png"); - ui_evidence_button->setText("Evidence"); + ui_evidence_button->set_image("evidencebutton.png"); + //ui_evidence_button->setText("Evidence"); set_size_and_pos(ui_evidence, "evidence_background"); ui_evidence->set_image("evidencebackground.png"); @@ -796,6 +796,8 @@ void Courtroom::enter_courtroom(int p_cid) set_widgets(); + //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); + ui_char_select_background->hide(); ui_ic_chat_message->setEnabled(m_cid != -1); @@ -837,17 +839,17 @@ void Courtroom::append_ms_chatmessage(QString f_message) ui_ms_chatlog->moveCursor(QTextCursor::End); QStringList word_list = f_message.split(" "); - f_message = ""; for (QString i_word : word_list) { if (i_word.startsWith("http")) - i_word = "" + i_word + ""; - - f_message += i_word + " "; + ui_ms_chatlog->insertHtml("" + i_word + " "); + else + ui_ms_chatlog->insertPlainText(i_word + " "); } - ui_ms_chatlog->append(f_message); + //ui_ms_chatlog->append(f_message); + ui_ms_chatlog->insertPlainText("\n"); if (old_cursor.hasSelection() || !is_scrolled_down) { @@ -863,7 +865,7 @@ void Courtroom::append_ms_chatmessage(QString f_message) } } -void Courtroom::append_server_chatmessage(QString f_message) +void Courtroom::append_server_chatmessage(QString f_name, QString f_message) { const QTextCursor old_cursor = ui_server_chatlog->textCursor(); const int old_scrollbar_value = ui_server_chatlog->verticalScrollBar()->value(); @@ -871,18 +873,19 @@ void Courtroom::append_server_chatmessage(QString f_message) ui_server_chatlog->moveCursor(QTextCursor::End); + ui_server_chatlog->insertPlainText(f_name + ": "); + QStringList word_list = f_message.split(" "); - f_message = ""; for (QString i_word : word_list) { if (i_word.startsWith("http")) - i_word = "" + i_word + ""; - - f_message += i_word + " "; + ui_server_chatlog->insertHtml("" + i_word + " "); + else + ui_server_chatlog->insertPlainText(i_word + " "); } - ui_server_chatlog->append(f_message); + ui_server_chatlog->insertPlainText("\n"); if (old_cursor.hasSelection() || !is_scrolled_down) { @@ -1511,11 +1514,18 @@ void Courtroom::handle_song(QStringList *p_contents) if (f_contents.size() < 2) return; - music_player->play(f_contents.at(0)); - int n_char = f_contents.at(1).toInt(); - if (n_char >= 0 && n_char < char_list.size()) + if (n_char >= char_list.size()) + return; + + if (n_char >= 0) + if (mute_map.value(char_list.at(f_contents.at(1).toInt()).name)) + return; + + music_player->play(f_contents.at(0)); + + if (n_char >= 0) append_ic_text(char_list.at(n_char).name + " has played a song: " + f_contents.at(0) + "\n"); } diff --git a/courtroom.h b/courtroom.h index fc0cc25..04b24ea 100644 --- a/courtroom.h +++ b/courtroom.h @@ -77,7 +77,7 @@ public: void list_music(); void append_ms_chatmessage(QString f_message); - void append_server_chatmessage(QString f_message); + void append_server_chatmessage(QString f_name, QString f_message); void handle_chatmessage(QStringList *p_contents); void handle_chatmessage_2(); diff --git a/lobby.cpp b/lobby.cpp index 5e2b120..ec1be20 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -26,7 +26,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_server_list = new QListWidget(this); ui_player_count = new QLabel(this); ui_description = new QPlainTextEdit(this); - ui_chatbox = new QPlainTextEdit(this); + ui_chatbox = new QTextBrowser(this); ui_chatname = new QLineEdit(this); ui_chatname->setPlaceholderText("Name"); ui_chatmessage = new QLineEdit(this); @@ -100,7 +100,7 @@ void Lobby::set_widgets() set_size_and_pos(ui_chatbox, "chatbox"); ui_chatbox->setReadOnly(true); - ui_chatbox->setStyleSheet("QPlainTextEdit{background-color: rgba(0, 0, 0, 0);}"); + ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}"); set_size_and_pos(ui_chatname, "chatname"); ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);" @@ -340,7 +340,18 @@ void Lobby::append_chatmessage(QString f_message) ui_chatbox->moveCursor(QTextCursor::End); - ui_chatbox->appendPlainText(f_message); + QStringList word_list = f_message.split(" "); + + for (QString i_word : word_list) + { + if (i_word.startsWith("http")) + ui_chatbox->insertHtml("" + i_word + " "); + else + ui_chatbox->insertPlainText(i_word + " "); + } + + //ui_ms_chatlog->append(f_message); + ui_chatbox->insertPlainText("\n"); if (old_cursor.hasSelection() || !is_scrolled_down) { diff --git a/lobby.h b/lobby.h index 7743577..83b9cb4 100644 --- a/lobby.h +++ b/lobby.h @@ -11,6 +11,7 @@ #include #include #include +#include class AOApplication; @@ -61,7 +62,7 @@ private: QLabel *ui_player_count; QPlainTextEdit *ui_description; - QPlainTextEdit *ui_chatbox; + QTextBrowser *ui_chatbox; QLineEdit *ui_chatname; QLineEdit *ui_chatmessage; diff --git a/packet_distribution.cpp b/packet_distribution.cpp index d92ff06..e5b2c63 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -170,15 +170,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet) else if (header == "CT") { if (f_contents.size() < 2) - { - qDebug() << "W: malformed packet!"; goto end; - } - - QString message_line = f_contents.at(0) + ": " + f_contents.at(1); if (courtroom_constructed) - w_courtroom->append_server_chatmessage(message_line); + w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1)); } else if (header == "PN") { @@ -465,7 +460,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) } else if (header == "MC") { - if (courtroom_constructed) + if (courtroom_constructed && courtroom_loaded) w_courtroom->handle_song(&p_packet->get_contents()); } else if (header == "RT")