diff --git a/aoimage.cpp b/aoimage.cpp index dc22591..2139fcc 100644 --- a/aoimage.cpp +++ b/aoimage.cpp @@ -30,10 +30,16 @@ void AOImage::set_image_from_path(QString p_path) { QString default_path = ao_app->get_default_theme_path() + "chatmed.png"; + QString final_path; + if (file_exists(p_path)) - this->setPixmap(p_path); + final_path = p_path; else - this->setPixmap(default_path); + final_path = default_path; + + QPixmap f_pixmap(final_path); + + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); } void AOImage::set_scaled_image(QString p_image) diff --git a/aoscene.cpp b/aoscene.cpp index 126a604..f5e3a69 100644 --- a/aoscene.cpp +++ b/aoscene.cpp @@ -55,6 +55,8 @@ void AOScene::set_legacy_desk(QString p_image) int final_w = w_modifier * f_desk.width(); int final_h = h_modifier * f_desk.height(); - this->resize(final_w, final_h); - this->setPixmap(f_desk.scaled(final_w, final_h)); + //this->resize(final_w, final_h); + //this->setPixmap(f_desk.scaled(final_w, final_h)); + this->resize(vp_width, final_h); + this->setPixmap(f_desk.scaled(vp_width, final_h)); } diff --git a/courtroom.cpp b/courtroom.cpp index 1072e2c..7578c14 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -109,6 +109,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_emotes = new QWidget(this); + ui_emote_left = new AOButton(this, ao_app); + ui_emote_right = new AOButton(this, ao_app); + /////////////////////////////////////// ui_defense_bar = new AOImage(this, ao_app); @@ -297,6 +300,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() //implementation in emotes.cpp construct_emotes(); + + set_char_select(); } void Courtroom::set_mute_list() @@ -340,9 +345,9 @@ void Courtroom::set_widgets() this->resize(m_courtroom_width, m_courtroom_height); this->setFixedSize(m_courtroom_width, m_courtroom_height); - ui_background->set_image("courtroombackground.png"); ui_background->move(0, 0); ui_background->resize(m_courtroom_width, m_courtroom_height); + ui_background->set_scaled_image("courtroombackground.png"); set_size_and_pos(ui_viewport, "viewport"); @@ -448,6 +453,12 @@ void Courtroom::set_widgets() set_size_and_pos(ui_emotes, "emotes"); + set_size_and_pos(ui_emote_left, "emote_left"); + ui_emote_left->set_image("arrow_left.png"); + + set_size_and_pos(ui_emote_right, "emote_right"); + ui_emote_right->set_image("arrow_right.png"); + //emote buttons set_size_and_pos(ui_defense_bar, "defense_bar"); @@ -613,11 +624,39 @@ void Courtroom::done_received() set_mute_list(); + set_char_select(); + show(); ui_spectator->show(); } +void Courtroom::set_char_select() +{ + QString design_ini_path = ao_app->get_theme_path() + "courtroom_design.ini"; + QString default_ini_path = ao_app->get_base_path() + "themes/default/courtroom_design.ini"; + + pos_size_type f_charselect = ao_app->get_pos_and_size("char_select", design_ini_path); + + if (f_charselect.width < 0 || f_charselect.height < 0) + { + f_charselect = ao_app->get_pos_and_size("char_select", default_ini_path); + if (f_charselect.width < 0 || f_charselect.height < 0) + { + qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!"; + } + } + + this->resize(f_charselect.width, f_charselect.height); + this->setFixedSize(f_charselect.width, f_charselect.height); + + ui_char_select_background->resize(f_charselect.width, f_charselect.height); + + ui_char_select_background->set_image("charselect_background.png"); + ui_char_select_background->move(0, 0); + +} + void Courtroom::set_char_select_page() { ui_char_select_background->show(); @@ -758,6 +797,8 @@ void Courtroom::enter_courtroom(int p_cid) testimony_in_progress = false; + set_widgets(); + ui_char_select_background->hide(); ui_ic_chat_message->setEnabled(m_cid != -1); @@ -1047,7 +1088,7 @@ void Courtroom::handle_chatmessage_2() QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); if (chatbox == "") - ui_vp_chatbox->set_image("chatmed.png"); + ui_vp_chatbox->set_scaled_image("chatmed.png"); else { QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + ".png"; @@ -1766,6 +1807,8 @@ void Courtroom::on_change_character_clicked() sfx_player->set_volume(0); blip_player->set_volume(0); + set_char_select(); + ui_char_select_background->show(); ui_spectator->hide(); } diff --git a/courtroom.h b/courtroom.h index 0b1d3c9..6e3d5f8 100644 --- a/courtroom.h +++ b/courtroom.h @@ -47,6 +47,8 @@ public: void set_char_select_page(); void set_background(QString p_background); + void set_char_select(); + void done_received(); void set_mute_list(); diff --git a/emotes.cpp b/emotes.cpp index 2409ff9..34db884 100644 --- a/emotes.cpp +++ b/emotes.cpp @@ -7,7 +7,7 @@ void Courtroom::construct_emotes() { //constructing emote button grid - const int base_x_pos{10}; + const int base_x_pos{0}; const int base_y_pos{0}; const int x_modifier{49}; @@ -44,15 +44,6 @@ void Courtroom::construct_emotes() } } - ui_emote_left = new AOButton(ui_emotes, ao_app); - ui_emote_right = new AOButton(ui_emotes, ao_app); - - set_size_and_pos(ui_emote_left, "emote_left"); - ui_emote_left->set_image("arrow_left.png"); - - set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right.png"); - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); }