From e8f413c23669043e93e7ba1adb85911c55c457c5 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 14 Feb 2017 09:58:05 +0100 Subject: [PATCH 1/4] fixed a crash relating to character selection --- courtroom.cpp | 23 ++++++++++++++++++++++- courtroom.h | 2 ++ packet_distribution.cpp | 12 ++++++------ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/courtroom.cpp b/courtroom.cpp index 41945fb..4634442 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -354,8 +354,10 @@ void Courtroom::set_widgets() set_size_and_pos(ui_vp_showname, "showname"); QFont pt_8 = ui_vp_showname->font(); + QFont pt_9 = ui_vp_showname->font(); QFont pt_10 = ui_vp_showname->font(); pt_8.setPointSize(8); + pt_9.setPointSize(9); pt_10.setPointSize(10); ui_vp_showname->setFont(pt_8); ui_vp_showname->setStyleSheet("background-color: rgba(0, 0, 0, 0);" @@ -363,7 +365,11 @@ void Courtroom::set_widgets() set_size_and_pos(ui_vp_message, "message"); ui_vp_message->setReadOnly(true); + #if (defined (_WIN32) || defined (_WIN64)) ui_vp_message->setFont(pt_10); + #else + ui_vp_message->setFont(pt_9); + #endif ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); @@ -384,7 +390,11 @@ void Courtroom::set_widgets() ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height()); set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); + #if (defined (_WIN32) || defined (_WIN64)) ui_ic_chatlog->setFont(pt_10); + #else + ui_ic_chatlog->setFont(pt_9); + #endif ui_ic_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white;"); @@ -554,7 +564,7 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) void Courtroom::set_taken(int n_char, bool p_taken) { - if (n_char >= char_list.size()) + if (n_char > char_list.size()) { qDebug() << "W: set_taken attempted to set an index bigger than char_list size"; return; @@ -568,6 +578,17 @@ void Courtroom::set_taken(int n_char, bool p_taken) char_list.replace(n_char, f_char); } +void Courtroom::done_received() +{ + m_cid = -1; + + set_char_select_page(); + + set_mute_list(); + + show(); +} + void Courtroom::set_char_select_page() { ui_char_select_background->show(); diff --git a/courtroom.h b/courtroom.h index dabbcd7..aefbb24 100644 --- a/courtroom.h +++ b/courtroom.h @@ -46,6 +46,8 @@ public: void set_char_select_page(); void set_background(QString p_background); + void done_received(); + void set_mute_list(); //sets desk and bg based on pos in chatmessage diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 239d079..3a9e786 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -344,6 +344,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet) } else if (header == "CharsCheck") { + if (!courtroom_constructed) + goto end; + for (int n_char = 0 ; n_char < f_contents.size() ; ++n_char) { if (f_contents.at(n_char) == "-1") @@ -425,13 +428,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (!courtroom_constructed) goto end; - w_courtroom->set_char_select_page(); + if (lobby_constructed) + w_courtroom->append_ms_chatmessage(w_lobby->get_chatlog()); - w_courtroom->append_ms_chatmessage(w_lobby->get_chatlog()); - - w_courtroom->set_mute_list(); - - w_courtroom->show(); + w_courtroom->done_received(); destruct_lobby(); } From 30d0df70f6e749c1d5c5ad3fd92ef710bd9d1d7b Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 14 Feb 2017 10:13:58 +0100 Subject: [PATCH 2/4] fixed all-black right-click menus --- courtroom.cpp | 18 +++++++++++------- lobby.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/courtroom.cpp b/courtroom.cpp index 4634442..2534611 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -148,15 +148,15 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_music_slider = new QSlider(Qt::Horizontal, this); ui_music_slider->setRange(0, 100); - ui_music_slider->setValue(0); + ui_music_slider->setValue(50); ui_sfx_slider = new QSlider(Qt::Horizontal, this); ui_sfx_slider->setRange(0, 100); - ui_sfx_slider->setValue(0); + ui_sfx_slider->setValue(50); ui_blip_slider = new QSlider(Qt::Horizontal, this); ui_blip_slider->setRange(0, 100); - ui_blip_slider->setValue(0); + ui_blip_slider->setValue(50); /////////////char select widgets under here/////////////// @@ -564,7 +564,7 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) void Courtroom::set_taken(int n_char, bool p_taken) { - if (n_char > char_list.size()) + if (n_char >= char_list.size()) { qDebug() << "W: set_taken attempted to set an index bigger than char_list size"; return; @@ -707,9 +707,9 @@ void Courtroom::enter_courtroom(int p_cid) list_music(); - ui_music_slider->setValue(50); - ui_sfx_slider->setValue(50); - ui_blip_slider->setValue(50); + music_player->set_volume(ui_music_slider->value()); + sfx_player->set_volume(ui_sfx_slider->value()); + blip_player->set_volume(ui_blip_slider->value()); testimony_in_progress = false; @@ -1706,6 +1706,10 @@ void Courtroom::on_cross_examination_clicked() void Courtroom::on_change_character_clicked() { + music_player->set_volume(0); + sfx_player->set_volume(0); + blip_player->set_volume(0); + ui_char_select_background->show(); } diff --git a/lobby.cpp b/lobby.cpp index c47b673..0416d65 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -95,7 +95,7 @@ void Lobby::set_widgets() set_size_and_pos(ui_chatbox, "chatbox"); ui_chatbox->setReadOnly(true); - ui_chatbox->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + ui_chatbox->setStyleSheet("QPlainTextEdit{background-color: rgba(0, 0, 0, 0);}"); set_size_and_pos(ui_chatname, "chatname"); ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);" From 28c0879e631579273c49d36d36bcc2f1b0e0fb0b Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 14 Feb 2017 10:15:21 +0100 Subject: [PATCH 3/4] incremented version to 2.1.2 --- Attorney_Online_remake.pro | 2 +- aoapplication.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 79d2029..d8c22a8 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.1.0.0 +VERSION = 2.1.2.0 SOURCES += main.cpp\ lobby.cpp \ diff --git a/aoapplication.h b/aoapplication.h index d428776..6a10ff5 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -117,7 +117,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 1; - const int MINOR_VERSION = 0; + const int MINOR_VERSION = 2; QString user_theme = "default"; From 9e601caa568353cbb91b4f6e9b0a7a9159a436ac Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 14 Feb 2017 10:21:56 +0100 Subject: [PATCH 4/4] added version label --- lobby.cpp | 4 ++++ lobby.h | 1 + 2 files changed, 5 insertions(+) diff --git a/lobby.cpp b/lobby.cpp index 0416d65..cfcc8bf 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -21,6 +21,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_refresh = new AOButton(this, ao_app); ui_add_to_fav = new AOButton(this, ao_app); ui_connect = new AOButton(this, ao_app); + ui_version = new QLabel(this); ui_about = new AOButton(this, ao_app); ui_server_list = new QListWidget(this); ui_player_count = new QLabel(this); @@ -75,6 +76,9 @@ void Lobby::set_widgets() ui_connect->set_image("connect.png"); set_size_and_pos(ui_connect, "connect"); + ui_version->setText("Version: " + ao_app->get_version_string()); + set_size_and_pos(ui_version, "version"); + ui_about->set_image("about.png"); set_size_and_pos(ui_about, "about"); diff --git a/lobby.h b/lobby.h index 3bf11b7..7743577 100644 --- a/lobby.h +++ b/lobby.h @@ -53,6 +53,7 @@ private: AOButton *ui_add_to_fav; AOButton *ui_connect; + QLabel *ui_version; AOButton *ui_about; QListWidget *ui_server_list;