added support for bigger themes

This commit is contained in:
David Skoland 2017-02-15 20:04:36 +01:00
parent 16746d7f83
commit 42239ce127
5 changed files with 60 additions and 16 deletions

View File

@ -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 default_path = ao_app->get_default_theme_path() + "chatmed.png";
QString final_path;
if (file_exists(p_path)) if (file_exists(p_path))
this->setPixmap(p_path); final_path = p_path;
else 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) void AOImage::set_scaled_image(QString p_image)

View File

@ -55,6 +55,8 @@ void AOScene::set_legacy_desk(QString p_image)
int final_w = w_modifier * f_desk.width(); int final_w = w_modifier * f_desk.width();
int final_h = h_modifier * f_desk.height(); int final_h = h_modifier * f_desk.height();
this->resize(final_w, final_h); //this->resize(final_w, final_h);
this->setPixmap(f_desk.scaled(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));
} }

View File

@ -109,6 +109,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_emotes = new QWidget(this); 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); ui_defense_bar = new AOImage(this, ao_app);
@ -297,6 +300,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
//implementation in emotes.cpp //implementation in emotes.cpp
construct_emotes(); construct_emotes();
set_char_select();
} }
void Courtroom::set_mute_list() void Courtroom::set_mute_list()
@ -340,9 +345,9 @@ void Courtroom::set_widgets()
this->resize(m_courtroom_width, m_courtroom_height); this->resize(m_courtroom_width, m_courtroom_height);
this->setFixedSize(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->move(0, 0);
ui_background->resize(m_courtroom_width, m_courtroom_height); ui_background->resize(m_courtroom_width, m_courtroom_height);
ui_background->set_scaled_image("courtroombackground.png");
set_size_and_pos(ui_viewport, "viewport"); 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_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 //emote buttons
set_size_and_pos(ui_defense_bar, "defense_bar"); set_size_and_pos(ui_defense_bar, "defense_bar");
@ -613,11 +624,39 @@ void Courtroom::done_received()
set_mute_list(); set_mute_list();
set_char_select();
show(); show();
ui_spectator->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() void Courtroom::set_char_select_page()
{ {
ui_char_select_background->show(); ui_char_select_background->show();
@ -758,6 +797,8 @@ void Courtroom::enter_courtroom(int p_cid)
testimony_in_progress = false; testimony_in_progress = false;
set_widgets();
ui_char_select_background->hide(); ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(m_cid != -1); 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]); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]);
if (chatbox == "") if (chatbox == "")
ui_vp_chatbox->set_image("chatmed.png"); ui_vp_chatbox->set_scaled_image("chatmed.png");
else else
{ {
QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + ".png"; 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); sfx_player->set_volume(0);
blip_player->set_volume(0); blip_player->set_volume(0);
set_char_select();
ui_char_select_background->show(); ui_char_select_background->show();
ui_spectator->hide(); ui_spectator->hide();
} }

View File

@ -47,6 +47,8 @@ public:
void set_char_select_page(); void set_char_select_page();
void set_background(QString p_background); void set_background(QString p_background);
void set_char_select();
void done_received(); void done_received();
void set_mute_list(); void set_mute_list();

View File

@ -7,7 +7,7 @@
void Courtroom::construct_emotes() void Courtroom::construct_emotes()
{ {
//constructing emote button grid //constructing emote button grid
const int base_x_pos{10}; const int base_x_pos{0};
const int base_y_pos{0}; const int base_y_pos{0};
const int x_modifier{49}; 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_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked()));
connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked()));
} }