finished jud, hlp and hld desks. ready to release 2.3.1
This commit is contained in:
parent
3495dfae3a
commit
b92981ff95
151
courtroom.cpp
151
courtroom.cpp
@ -78,7 +78,7 @@ 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 QTextBrowser(this);
|
ui_ms_chatlog = new AOTextArea(this);
|
||||||
ui_ms_chatlog->setReadOnly(true);
|
ui_ms_chatlog->setReadOnly(true);
|
||||||
ui_ms_chatlog->setOpenExternalLinks(true);
|
ui_ms_chatlog->setOpenExternalLinks(true);
|
||||||
ui_ms_chatlog->hide();
|
ui_ms_chatlog->hide();
|
||||||
@ -723,42 +723,9 @@ void Courtroom::list_music()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::append_ms_chatmessage(QString f_message)
|
void Courtroom::append_ms_chatmessage(QString f_name, QString f_message)
|
||||||
{
|
{
|
||||||
const QTextCursor old_cursor = ui_ms_chatlog->textCursor();
|
ui_ms_chatlog->append_chatmessage(f_name, f_message);
|
||||||
const int old_scrollbar_value = ui_ms_chatlog->verticalScrollBar()->value();
|
|
||||||
const bool is_scrolled_down = old_scrollbar_value == ui_ms_chatlog->verticalScrollBar()->maximum();
|
|
||||||
|
|
||||||
ui_ms_chatlog->moveCursor(QTextCursor::End);
|
|
||||||
|
|
||||||
QStringList word_list = f_message.split(" ");
|
|
||||||
|
|
||||||
for (QString i_word : word_list)
|
|
||||||
{
|
|
||||||
if (i_word.startsWith("http"))
|
|
||||||
{
|
|
||||||
i_word.replace("\n", "").replace("\r", "");
|
|
||||||
ui_ms_chatlog->insertHtml("<a href=\"" + i_word + "\">" + i_word + "</a> ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ui_ms_chatlog->insertPlainText(i_word + " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
//ui_ms_chatlog->append(f_message);
|
|
||||||
ui_ms_chatlog->insertPlainText("\n");
|
|
||||||
|
|
||||||
if (old_cursor.hasSelection() || !is_scrolled_down)
|
|
||||||
{
|
|
||||||
// The user has selected text or scrolled away from the bottom: maintain position.
|
|
||||||
ui_ms_chatlog->setTextCursor(old_cursor);
|
|
||||||
ui_ms_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
|
|
||||||
ui_ms_chatlog->moveCursor(QTextCursor::End);
|
|
||||||
ui_ms_chatlog->verticalScrollBar()->setValue(ui_ms_chatlog->verticalScrollBar()->maximum());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::append_server_chatmessage(QString p_name, QString p_message)
|
void Courtroom::append_server_chatmessage(QString p_name, QString p_message)
|
||||||
@ -775,7 +742,8 @@ void Courtroom::on_chat_return_pressed()
|
|||||||
objection_state == 0)
|
objection_state == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//MS#chat#
|
//MS#
|
||||||
|
//deskmod#
|
||||||
//pre-emote#
|
//pre-emote#
|
||||||
//character#
|
//character#
|
||||||
//emote#
|
//emote#
|
||||||
@ -1288,9 +1256,6 @@ void Courtroom::play_sfx()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
sfx_player->play(sfx_name + ".wav");
|
sfx_player->play(sfx_name + ".wav");
|
||||||
|
|
||||||
//T0D0: add audio implementation
|
|
||||||
//QString sfx_name = m_chatmessage[SFX_NAME];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::set_scene()
|
void Courtroom::set_scene()
|
||||||
@ -1299,66 +1264,74 @@ void Courtroom::set_scene()
|
|||||||
show_testimony();
|
show_testimony();
|
||||||
|
|
||||||
//witness is default if pos is invalid
|
//witness is default if pos is invalid
|
||||||
QString f_image = "witnessempty.png";
|
QString f_background = "witnessempty.png";
|
||||||
|
QString f_desk_image = "stand.png";
|
||||||
QString f_side = m_chatmessage[SIDE];
|
|
||||||
QString f_desk_mod = m_chatmessage[DESK_MOD];
|
QString f_desk_mod = m_chatmessage[DESK_MOD];
|
||||||
|
QString f_side = m_chatmessage[SIDE];
|
||||||
|
|
||||||
if (f_side == "def")
|
if (f_side == "def")
|
||||||
f_image = "defenseempty.png";
|
|
||||||
else if (f_side == "pro")
|
|
||||||
f_image = "prosecutorempty.png";
|
|
||||||
else if (f_side == "jud")
|
|
||||||
f_image = "judgestand.png";
|
|
||||||
else if (f_side == "hld")
|
|
||||||
f_image = "helperstand.png";
|
|
||||||
else if (f_side == "hlp")
|
|
||||||
f_image = "prohelperstand.png";
|
|
||||||
|
|
||||||
ui_vp_background->set_image(f_image);
|
|
||||||
|
|
||||||
//we're done if deskmod is 0 or the deskmod is chat and it's a nondesk side
|
|
||||||
if (f_desk_mod == "0" ||
|
|
||||||
(f_desk_mod == "chat" && (f_side == "hlp" || f_side == "hld" || f_side == "jud")))
|
|
||||||
{
|
{
|
||||||
ui_vp_desk->hide();
|
f_background = "defenseempty.png";
|
||||||
ui_vp_legacy_desk->hide();
|
if (is_ao2_bg)
|
||||||
return;
|
f_desk_image = "defensedesk.png";
|
||||||
}
|
|
||||||
|
|
||||||
if (is_ao2_bg)
|
|
||||||
{
|
|
||||||
QString desk_image = "stand.png";
|
|
||||||
|
|
||||||
if (f_side == "def")
|
|
||||||
desk_image = "defensedesk.png";
|
|
||||||
else if (f_side == "pro")
|
|
||||||
desk_image = "prosecutiondesk.png";
|
|
||||||
|
|
||||||
ui_vp_desk->set_image(desk_image);
|
|
||||||
ui_vp_legacy_desk->hide();
|
|
||||||
ui_vp_desk->show();
|
|
||||||
}
|
|
||||||
else if (f_side == "def" || f_side == "pro")
|
|
||||||
{
|
|
||||||
QString desk_image;
|
|
||||||
|
|
||||||
if (f_side == "def")
|
|
||||||
desk_image = "bancodefensa.png";
|
|
||||||
else
|
else
|
||||||
desk_image = "bancoacusacion.png";
|
f_desk_image = "bancodefensa.png";
|
||||||
|
}
|
||||||
ui_vp_legacy_desk->set_legacy_desk(desk_image);
|
else if (f_side == "pro")
|
||||||
ui_vp_desk->hide();
|
{
|
||||||
ui_vp_legacy_desk->show();
|
f_background = "prosecutorempty.png";
|
||||||
|
if (is_ao2_bg)
|
||||||
|
f_desk_image = "prosecutiondesk.png";
|
||||||
|
else
|
||||||
|
f_desk_image = "bancoacusacion.png";
|
||||||
|
}
|
||||||
|
else if (f_side == "jud")
|
||||||
|
{
|
||||||
|
f_background = "judgestand.png";
|
||||||
|
f_desk_image = "judgedesk.png";
|
||||||
|
}
|
||||||
|
else if (f_side == "hld")
|
||||||
|
{
|
||||||
|
f_background = "helperstand.png";
|
||||||
|
f_desk_image = "helperdesk.png";
|
||||||
|
}
|
||||||
|
else if (f_side == "hlp")
|
||||||
|
{
|
||||||
|
f_background = "prohelperstand.png";
|
||||||
|
f_desk_image = "prohelperdesk.png";
|
||||||
}
|
}
|
||||||
//assume wit or invalid side
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui_vp_desk->set_image("estrado.png");
|
if (is_ao2_bg)
|
||||||
|
f_desk_image = "stand.png";
|
||||||
|
else
|
||||||
|
f_desk_image = "estrado.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_vp_background->set_image(f_background);
|
||||||
|
ui_vp_desk->set_image(f_desk_image);
|
||||||
|
ui_vp_legacy_desk->set_image(f_desk_image);
|
||||||
|
|
||||||
|
if (f_desk_mod == "0" || (f_desk_mod != "1" &&
|
||||||
|
(f_side == "jud" ||
|
||||||
|
f_side == "hld" ||
|
||||||
|
f_side == "hlp")))
|
||||||
|
{
|
||||||
|
ui_vp_desk->hide();
|
||||||
|
ui_vp_legacy_desk->hide();
|
||||||
|
}
|
||||||
|
else if (is_ao2_bg || (f_side == "jud" ||
|
||||||
|
f_side == "hld" ||
|
||||||
|
f_side == "hlp"))
|
||||||
|
{
|
||||||
ui_vp_legacy_desk->hide();
|
ui_vp_legacy_desk->hide();
|
||||||
ui_vp_desk->show();
|
ui_vp_desk->show();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui_vp_desk->hide();
|
||||||
|
ui_vp_legacy_desk->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::set_text_color()
|
void Courtroom::set_text_color()
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
void enter_courtroom(int p_cid);
|
void enter_courtroom(int p_cid);
|
||||||
void list_music();
|
void list_music();
|
||||||
|
|
||||||
void append_ms_chatmessage(QString f_message);
|
void append_ms_chatmessage(QString f_name, QString f_message);
|
||||||
void append_server_chatmessage(QString p_name, QString p_message);
|
void append_server_chatmessage(QString p_name, QString p_message);
|
||||||
|
|
||||||
void handle_chatmessage(QStringList *p_contents);
|
void handle_chatmessage(QStringList *p_contents);
|
||||||
@ -228,7 +228,7 @@ private:
|
|||||||
|
|
||||||
QPlainTextEdit *ui_ic_chatlog;
|
QPlainTextEdit *ui_ic_chatlog;
|
||||||
|
|
||||||
QTextBrowser *ui_ms_chatlog;
|
AOTextArea *ui_ms_chatlog;
|
||||||
AOTextArea *ui_server_chatlog;
|
AOTextArea *ui_server_chatlog;
|
||||||
|
|
||||||
QListWidget *ui_mute_list;
|
QListWidget *ui_mute_list;
|
||||||
|
39
lobby.cpp
39
lobby.cpp
@ -25,7 +25,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 QPlainTextEdit(this);
|
ui_description = new QPlainTextEdit(this);
|
||||||
ui_chatbox = new QTextBrowser(this);
|
ui_chatbox = new AOTextArea(this);
|
||||||
ui_chatbox->setOpenExternalLinks(true);
|
ui_chatbox->setOpenExternalLinks(true);
|
||||||
ui_chatname = new QLineEdit(this);
|
ui_chatname = new QLineEdit(this);
|
||||||
ui_chatname->setPlaceholderText("Name");
|
ui_chatname->setPlaceholderText("Name");
|
||||||
@ -352,42 +352,9 @@ void Lobby::list_favorites()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::append_chatmessage(QString f_message)
|
void Lobby::append_chatmessage(QString f_name, QString f_message)
|
||||||
{
|
{
|
||||||
const QTextCursor old_cursor = ui_chatbox->textCursor();
|
ui_chatbox->append_chatmessage(f_name, f_message);
|
||||||
const int old_scrollbar_value = ui_chatbox->verticalScrollBar()->value();
|
|
||||||
const bool is_scrolled_down = old_scrollbar_value == ui_chatbox->verticalScrollBar()->maximum();
|
|
||||||
|
|
||||||
ui_chatbox->moveCursor(QTextCursor::End);
|
|
||||||
|
|
||||||
QStringList word_list = f_message.split(" ");
|
|
||||||
|
|
||||||
for (QString i_word : word_list)
|
|
||||||
{
|
|
||||||
if (i_word.startsWith("http"))
|
|
||||||
{
|
|
||||||
i_word.replace("\n", "").replace("\r", "");
|
|
||||||
ui_chatbox->insertHtml("<a href=\"" + i_word + "\">" + i_word + "</a> ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ui_chatbox->insertPlainText(i_word + " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
//ui_ms_chatlog->append(f_message);
|
|
||||||
ui_chatbox->insertPlainText("\n");
|
|
||||||
|
|
||||||
if (old_cursor.hasSelection() || !is_scrolled_down)
|
|
||||||
{
|
|
||||||
// The user has selected text or scrolled away from the bottom: maintain position.
|
|
||||||
ui_chatbox->setTextCursor(old_cursor);
|
|
||||||
ui_chatbox->verticalScrollBar()->setValue(old_scrollbar_value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
|
|
||||||
ui_chatbox->moveCursor(QTextCursor::End);
|
|
||||||
ui_chatbox->verticalScrollBar()->setValue(ui_chatbox->verticalScrollBar()->maximum());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::set_player_count(int players_online, int max_players)
|
void Lobby::set_player_count(int players_online, int max_players)
|
||||||
|
5
lobby.h
5
lobby.h
@ -4,6 +4,7 @@
|
|||||||
#include "aoimage.h"
|
#include "aoimage.h"
|
||||||
#include "aobutton.h"
|
#include "aobutton.h"
|
||||||
#include "aopacket.h"
|
#include "aopacket.h"
|
||||||
|
#include "aotextarea.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
@ -25,7 +26,7 @@ public:
|
|||||||
void set_widgets();
|
void set_widgets();
|
||||||
void list_servers();
|
void list_servers();
|
||||||
void list_favorites();
|
void list_favorites();
|
||||||
void append_chatmessage(QString f_message);
|
void append_chatmessage(QString f_name, QString f_message);
|
||||||
void set_player_count(int players_online, int max_players);
|
void set_player_count(int players_online, int max_players);
|
||||||
void set_loading_text(QString p_text);
|
void set_loading_text(QString p_text);
|
||||||
void show_loading_overlay(){ui_loading_background->show();}
|
void show_loading_overlay(){ui_loading_background->show();}
|
||||||
@ -59,7 +60,7 @@ private:
|
|||||||
QLabel *ui_player_count;
|
QLabel *ui_player_count;
|
||||||
QPlainTextEdit *ui_description;
|
QPlainTextEdit *ui_description;
|
||||||
|
|
||||||
QTextBrowser *ui_chatbox;
|
AOTextArea *ui_chatbox;
|
||||||
|
|
||||||
QLineEdit *ui_chatname;
|
QLineEdit *ui_chatname;
|
||||||
QLineEdit *ui_chatmessage;
|
QLineEdit *ui_chatmessage;
|
||||||
|
@ -49,22 +49,28 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
|||||||
}
|
}
|
||||||
else if (header == "CT")
|
else if (header == "CT")
|
||||||
{
|
{
|
||||||
QString message_line;
|
QString f_name, f_message;
|
||||||
|
|
||||||
if (f_contents.size() == 1)
|
if (f_contents.size() == 1)
|
||||||
message_line = f_contents.at(0);
|
{
|
||||||
|
f_name = "";
|
||||||
|
f_message = f_contents.at(0);
|
||||||
|
}
|
||||||
else if (f_contents.size() >= 2)
|
else if (f_contents.size() >= 2)
|
||||||
message_line = f_contents.at(0) + ": " + f_contents.at(1);
|
{
|
||||||
|
f_name = f_contents.at(0);
|
||||||
|
f_message = f_contents.at(1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (lobby_constructed)
|
if (lobby_constructed)
|
||||||
{
|
{
|
||||||
w_lobby->append_chatmessage(message_line);
|
w_lobby->append_chatmessage(f_name, f_message);
|
||||||
}
|
}
|
||||||
if (courtroom_constructed && courtroom_loaded)
|
if (courtroom_constructed && courtroom_loaded)
|
||||||
{
|
{
|
||||||
w_courtroom->append_ms_chatmessage(message_line);
|
w_courtroom->append_ms_chatmessage(f_name, f_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "AO2CHECK")
|
else if (header == "AO2CHECK")
|
||||||
@ -453,7 +459,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (lobby_constructed)
|
if (lobby_constructed)
|
||||||
w_courtroom->append_ms_chatmessage(w_lobby->get_chatlog());
|
w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog());
|
||||||
|
|
||||||
w_courtroom->done_received();
|
w_courtroom->done_received();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user