added dynamic resolution scaling
This commit is contained in:
parent
051d9dc4dd
commit
de7d25962f
@ -83,6 +83,9 @@ public:
|
|||||||
QString get_sounds_path();
|
QString get_sounds_path();
|
||||||
QString get_music_path();
|
QString get_music_path();
|
||||||
|
|
||||||
|
QString get_background_path();
|
||||||
|
QString get_default_background_path();
|
||||||
|
|
||||||
//implementation in text_file_functions.cpp
|
//implementation in text_file_functions.cpp
|
||||||
QString read_user_theme();
|
QString read_user_theme();
|
||||||
void write_to_serverlist_txt(QString p_line);
|
void write_to_serverlist_txt(QString p_line);
|
||||||
|
17
aoimage.cpp
17
aoimage.cpp
@ -23,3 +23,20 @@ void AOImage::set_image(QString p_image)
|
|||||||
else
|
else
|
||||||
this->setPixmap(default_image_path);
|
this->setPixmap(default_image_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOImage::set_scaled_image(QString p_image)
|
||||||
|
{
|
||||||
|
QString theme_image_path = ao_app->get_theme_path() + p_image;
|
||||||
|
QString default_image_path = ao_app->get_default_theme_path() + p_image;
|
||||||
|
|
||||||
|
QString final_image_path;
|
||||||
|
|
||||||
|
if (file_exists(theme_image_path))
|
||||||
|
final_image_path = theme_image_path;
|
||||||
|
else
|
||||||
|
final_image_path = default_image_path;
|
||||||
|
|
||||||
|
QPixmap f_pixmap(final_image_path);
|
||||||
|
|
||||||
|
this->setPixmap(f_pixmap.scaled(this->width(), this->height()));
|
||||||
|
}
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
void set_image(QString p_image);
|
void set_image(QString p_image);
|
||||||
|
void set_scaled_image(QString p_image);
|
||||||
void set_size_and_pos(QString identifier);
|
void set_size_and_pos(QString identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
40
aoscene.cpp
40
aoscene.cpp
@ -6,23 +6,22 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
AOScene::AOScene(Courtroom *parent) : QLabel(parent)
|
AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
|
||||||
{
|
{
|
||||||
m_courtroom = parent;
|
m_parent = parent;
|
||||||
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOScene::set_image(QString p_image)
|
void AOScene::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
QString background_path = m_courtroom->get_background_path() + p_image;
|
QString background_path = ao_app->get_background_path() + p_image;
|
||||||
QString default_path = m_courtroom->get_default_background_path() + p_image;
|
QString default_path = ao_app->get_default_background_path() + p_image;
|
||||||
|
|
||||||
QPixmap background(background_path);
|
QPixmap background(background_path);
|
||||||
QPixmap default_bg(default_path);
|
QPixmap default_bg(default_path);
|
||||||
|
|
||||||
int w = this->width();
|
int w = this->width();
|
||||||
qDebug() << "AOScene width found to be " << w;
|
|
||||||
int h = this->height();
|
int h = this->height();
|
||||||
qDebug() << "AOScene height found to be " << h;
|
|
||||||
|
|
||||||
if (file_exists(background_path))
|
if (file_exists(background_path))
|
||||||
this->setPixmap(background.scaled(w, h));
|
this->setPixmap(background.scaled(w, h));
|
||||||
@ -35,24 +34,27 @@ void AOScene::set_legacy_desk(QString p_image)
|
|||||||
//vanilla desks vary in both width and height. in order to make that work with viewport rescaling,
|
//vanilla desks vary in both width and height. in order to make that work with viewport rescaling,
|
||||||
//some INTENSE math is needed.
|
//some INTENSE math is needed.
|
||||||
|
|
||||||
QImage f_image(p_image);
|
QString desk_path = ao_app->get_background_path() + p_image;
|
||||||
|
QString default_path = ao_app->get_default_background_path() + p_image;
|
||||||
|
|
||||||
int vp_x = m_courtroom->get_vp_x();
|
QPixmap f_desk;
|
||||||
int vp_y = m_courtroom->get_vp_y();
|
|
||||||
int vp_width = m_courtroom->get_vp_w();
|
|
||||||
int vp_height = m_courtroom->get_vp_h();
|
|
||||||
|
|
||||||
double y_modifier = 147 / 192;
|
if (file_exists(desk_path))
|
||||||
|
f_desk.load(desk_path);
|
||||||
|
else
|
||||||
|
f_desk.load(default_path);
|
||||||
|
|
||||||
|
int vp_width = m_parent->width();
|
||||||
|
int vp_height = m_parent->height();
|
||||||
|
|
||||||
|
//double y_modifier = 147 / 192;
|
||||||
double w_modifier = vp_width / 256;
|
double w_modifier = vp_width / 256;
|
||||||
double h_modifier = vp_height / 192;
|
double h_modifier = vp_height / 192;
|
||||||
|
|
||||||
int final_x = vp_x;
|
//int final_y = y_modifier * vp_height;
|
||||||
int final_y = vp_y + y_modifier * vp_height;
|
int final_w = w_modifier * f_desk.width();
|
||||||
int final_w = w_modifier * f_image.width();
|
int final_h = h_modifier * f_desk.height();
|
||||||
int final_h = h_modifier * f_image.height();
|
|
||||||
|
|
||||||
this->move(final_x, final_y);
|
|
||||||
this->resize(final_w, final_h);
|
this->resize(final_w, final_h);
|
||||||
|
this->setPixmap(f_desk.scaled(final_w, final_h));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,20 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
class Courtroom;
|
class Courtroom;
|
||||||
|
class AOApplication;
|
||||||
|
|
||||||
class AOScene : public QLabel
|
class AOScene : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AOScene(Courtroom *parent);
|
explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
void set_image(QString p_image);
|
void set_image(QString p_image);
|
||||||
void set_legacy_desk(QString p_image);
|
void set_legacy_desk(QString p_image);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Courtroom *m_courtroom;
|
QWidget *m_parent;
|
||||||
|
AOApplication *ao_app;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
courtroom = 0, 0, 714, 668
|
courtroom = 0, 0, 714, 668
|
||||||
viewport = 0, 0, 256, 192
|
viewport = 0, 0, 256, 192
|
||||||
|
chatbox = 0, 96, 256, 78
|
||||||
|
ao2_chatbox = 0, 114, 256, 78
|
||||||
|
showname = 6, 113, 80, 15
|
||||||
|
message = 3, 132, 250, 60
|
||||||
ic_chatlog = 260, 0, 231, 319
|
ic_chatlog = 260, 0, 231, 319
|
||||||
ms_chatlog = 490, 1, 224, 277
|
ms_chatlog = 490, 1, 224, 277
|
||||||
server_chatlog = 490, 1, 224, 277
|
server_chatlog = 490, 1, 224, 277
|
||||||
mute_list = 260, 160, 231, 159
|
mute_list = 260, 160, 231, 159
|
||||||
area_list = 266, 494, 224, 174
|
area_list = 266, 494, 224, 174
|
||||||
music_list = 490, 342, 224, 326
|
music_list = 490, 342, 224, 326
|
||||||
ic_chat_message = 0, 192, 255, 23
|
ic_chat_message = 0, 174, 256, 23
|
||||||
|
ao2_ic_chat_message = 0, 192, 256, 23
|
||||||
ooc_chat_message = 492, 281, 222, 19
|
ooc_chat_message = 492, 281, 222, 19
|
||||||
ooc_chat_name = 492, 300, 85, 19
|
ooc_chat_name = 492, 300, 85, 19
|
||||||
area_password = 266, 471, 224, 23
|
area_password = 266, 471, 224, 23
|
||||||
|
133
courtroom.cpp
133
courtroom.cpp
@ -14,6 +14,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
|
keepalive_timer = new QTimer(this);
|
||||||
|
keepalive_timer->start(60000);
|
||||||
|
|
||||||
chat_tick_timer = new QTimer(this);
|
chat_tick_timer = new QTimer(this);
|
||||||
|
|
||||||
text_delay = new QTimer(this);
|
text_delay = new QTimer(this);
|
||||||
@ -28,17 +31,19 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
|
|
||||||
ui_background = new AOImage(this, ao_app);
|
ui_background = new AOImage(this, ao_app);
|
||||||
|
|
||||||
ui_vp_background = new AOScene(this);
|
ui_viewport = new QWidget(this);
|
||||||
ui_vp_player_char = new AOCharMovie(this, ao_app);
|
ui_vp_background = new AOScene(ui_viewport, ao_app);
|
||||||
ui_vp_desk = new AOScene(this);
|
ui_vp_player_char = new AOCharMovie(ui_viewport, ao_app);
|
||||||
ui_vp_legacy_desk = new AOScene(this);
|
ui_vp_desk = new AOScene(ui_viewport, ao_app);
|
||||||
ui_vp_chatbox = new AOImage(this, ao_app);
|
ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app);
|
||||||
|
//ui_vp_legacy_padding = new AOImage(ui_viewport, ao_app);
|
||||||
|
ui_vp_chatbox = new AOImage(ui_viewport, ao_app);
|
||||||
ui_vp_showname = new QLabel(ui_vp_chatbox);
|
ui_vp_showname = new QLabel(ui_vp_chatbox);
|
||||||
ui_vp_message = new QPlainTextEdit(ui_vp_chatbox);
|
ui_vp_message = new QPlainTextEdit(ui_vp_chatbox);
|
||||||
ui_vp_testimony = new AOImage(this, ao_app);
|
ui_vp_testimony = new AOImage(ui_viewport, ao_app);
|
||||||
ui_vp_realization = new AOImage(this, ao_app);
|
ui_vp_realization = new AOImage(ui_viewport, ao_app);
|
||||||
ui_vp_wtce = new AOMovie(this, ao_app);
|
ui_vp_wtce = new AOMovie(ui_viewport, ao_app);
|
||||||
ui_vp_objection = new AOMovie(this, ao_app);
|
ui_vp_objection = new AOMovie(ui_viewport, ao_app);
|
||||||
|
|
||||||
ui_ic_chatlog = new QPlainTextEdit(this);
|
ui_ic_chatlog = new QPlainTextEdit(this);
|
||||||
ui_ic_chatlog->setReadOnly(true);
|
ui_ic_chatlog->setReadOnly(true);
|
||||||
@ -172,6 +177,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
|
|
||||||
ui_spectator = new AOButton(ui_char_select_background, ao_app);
|
ui_spectator = new AOButton(ui_char_select_background, ao_app);
|
||||||
|
|
||||||
|
connect(keepalive_timer, SIGNAL(timeout()), this, SLOT(ping_server()));
|
||||||
|
|
||||||
connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done()));
|
connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done()));
|
||||||
|
|
||||||
connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed()));
|
connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed()));
|
||||||
@ -200,7 +207,6 @@ void Courtroom::set_widgets()
|
|||||||
QString default_ini_path = ao_app->get_base_path() + "themes/default/courtroom_design.ini";
|
QString default_ini_path = ao_app->get_base_path() + "themes/default/courtroom_design.ini";
|
||||||
|
|
||||||
pos_size_type f_courtroom = ao_app->get_pos_and_size("courtroom", design_ini_path);
|
pos_size_type f_courtroom = ao_app->get_pos_and_size("courtroom", design_ini_path);
|
||||||
pos_size_type f_viewport = ao_app->get_pos_and_size("viewport", design_ini_path);
|
|
||||||
|
|
||||||
if (f_courtroom.width < 0 || f_courtroom.height < 0)
|
if (f_courtroom.width < 0 || f_courtroom.height < 0)
|
||||||
{
|
{
|
||||||
@ -212,68 +218,59 @@ void Courtroom::set_widgets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (f_viewport.width < 0 || f_viewport.height < 0)
|
|
||||||
{
|
|
||||||
f_viewport = ao_app->get_pos_and_size("viewport", default_ini_path);
|
|
||||||
if (f_viewport.width < 0 || f_viewport.height < 0)
|
|
||||||
{
|
|
||||||
qDebug() << "ERROR: did not find viewport width or height in courtroom_design.ini!";
|
|
||||||
//T0D0: same, critical error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_courtroom_width = f_courtroom.width;
|
m_courtroom_width = f_courtroom.width;
|
||||||
m_courtroom_height = f_courtroom.height;
|
m_courtroom_height = f_courtroom.height;
|
||||||
|
|
||||||
m_viewport_x = f_viewport.x;
|
|
||||||
m_viewport_y = f_viewport.y;
|
|
||||||
m_viewport_width = f_viewport.width;
|
|
||||||
m_viewport_height = f_viewport.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->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_vp_background->move(m_viewport_x, m_viewport_y);
|
set_size_and_pos(ui_viewport, "viewport");
|
||||||
ui_vp_background->resize(m_viewport_width, m_viewport_height);
|
|
||||||
|
|
||||||
ui_vp_player_char->move(m_viewport_x, m_viewport_y);
|
ui_vp_background->move(0, 0);
|
||||||
ui_vp_player_char->combo_resize(m_viewport_width, m_viewport_height);
|
ui_vp_background->resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_desk->move(m_viewport_x, m_viewport_y);
|
ui_vp_player_char->move(0, 0);
|
||||||
ui_vp_desk->resize(m_viewport_width, m_viewport_height);
|
ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
qDebug() << "resized ui_vp_desk to " << m_viewport_width << " and " << m_viewport_height;
|
|
||||||
|
|
||||||
ui_vp_chatbox->move(m_viewport_x, m_viewport_y);
|
//the AO2 desk element
|
||||||
ui_vp_chatbox->resize(m_viewport_width, m_viewport_height);
|
ui_vp_desk->move(0, 0);
|
||||||
|
ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
ui_vp_showname->move(m_viewport_x, m_viewport_y);
|
//the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene()
|
||||||
ui_vp_showname->resize(m_viewport_width, m_viewport_height);
|
|
||||||
|
|
||||||
ui_vp_message->move(m_viewport_x, m_viewport_y);
|
double y_modifier = 147.0 / 192.0;
|
||||||
ui_vp_message->resize(m_viewport_width, m_viewport_height);
|
int final_y = y_modifier * ui_viewport->height();
|
||||||
|
ui_vp_legacy_desk->move(0, final_y);
|
||||||
|
ui_vp_legacy_desk->hide();
|
||||||
|
|
||||||
//T0D0: resize it properly
|
//set_size_and_pos(ui_vp_legacy_padding, "legacy_padding");
|
||||||
//D3BUG START
|
//ui_vp_legacy_padding->setStyleSheet("background-color: rgba(89, 89, 89, 255);");
|
||||||
//obscures some things
|
|
||||||
ui_vp_message->hide();
|
|
||||||
//D3BUG END
|
|
||||||
|
|
||||||
ui_vp_testimony->move(m_viewport_x, m_viewport_y);
|
set_size_and_pos(ui_vp_chatbox, "chatbox");
|
||||||
ui_vp_testimony->resize(m_viewport_width, m_viewport_height);
|
ui_vp_chatbox->set_scaled_image("chatmed.png");
|
||||||
|
|
||||||
ui_vp_realization->move(m_viewport_x, m_viewport_y);
|
set_size_and_pos(ui_vp_showname, "showname");
|
||||||
ui_vp_realization->resize(m_viewport_width, m_viewport_height);
|
ui_vp_showname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
|
"color: white;");
|
||||||
|
|
||||||
ui_vp_wtce->move(m_viewport_x, m_viewport_y);
|
set_size_and_pos(ui_vp_message, "message");
|
||||||
ui_vp_wtce->combo_resize(m_viewport_width, m_viewport_height);
|
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
|
"color: white;");
|
||||||
|
|
||||||
ui_vp_objection->move(m_viewport_x, m_viewport_y);
|
ui_vp_testimony->move(0, 0);
|
||||||
ui_vp_objection->combo_resize(m_viewport_width, m_viewport_height);
|
ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
|
ui_vp_realization->move(0, 0);
|
||||||
|
ui_vp_realization->resize(ui_viewport->x(), ui_viewport->y());
|
||||||
|
|
||||||
|
ui_vp_wtce->move(0, 0);
|
||||||
|
ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
|
ui_vp_objection->move(0, 0);
|
||||||
|
ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height());
|
||||||
|
|
||||||
set_size_and_pos(ui_ic_chatlog, "ic_chatlog");
|
set_size_and_pos(ui_ic_chatlog, "ic_chatlog");
|
||||||
ui_ic_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_ic_chatlog->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
@ -295,7 +292,7 @@ void Courtroom::set_widgets()
|
|||||||
ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
||||||
|
|
||||||
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
|
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
|
||||||
ui_ic_chat_message->setStyleSheet("background-color: rgba(89, 89, 89, 0);");
|
ui_ic_chat_message->setStyleSheet("background-color: rgba(89, 89, 89, 255);");
|
||||||
|
|
||||||
set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message");
|
set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message");
|
||||||
ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
||||||
@ -520,7 +517,16 @@ void Courtroom::set_background(QString p_background)
|
|||||||
file_exists(bg_path + "prosecutiondesk.png") &&
|
file_exists(bg_path + "prosecutiondesk.png") &&
|
||||||
file_exists(bg_path + "stand.png");
|
file_exists(bg_path + "stand.png");
|
||||||
|
|
||||||
//T0D0: find some way to compensate for legacy resolution
|
if (is_ao2_bg)
|
||||||
|
{
|
||||||
|
set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
|
||||||
|
set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_size_and_pos(ui_vp_chatbox, "chatbox");
|
||||||
|
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::enter_courtroom(int p_cid)
|
void Courtroom::enter_courtroom(int p_cid)
|
||||||
@ -701,6 +707,13 @@ void Courtroom::handle_chatmessage_2()
|
|||||||
ui_vp_message->clear();
|
ui_vp_message->clear();
|
||||||
ui_vp_chatbox->hide();
|
ui_vp_chatbox->hide();
|
||||||
|
|
||||||
|
//D3BUG START
|
||||||
|
|
||||||
|
ui_vp_chatbox->show();
|
||||||
|
ui_vp_message->appendPlainText(m_chatmessage[MESSAGE]);
|
||||||
|
|
||||||
|
//D3BUG END
|
||||||
|
|
||||||
set_scene();
|
set_scene();
|
||||||
set_text_color();
|
set_text_color();
|
||||||
}
|
}
|
||||||
@ -744,7 +757,6 @@ void Courtroom::set_scene()
|
|||||||
|
|
||||||
if (is_ao2_bg)
|
if (is_ao2_bg)
|
||||||
{
|
{
|
||||||
qDebug() << "found is_ao2_bg to be true";
|
|
||||||
QString desk_image = "stand.png";
|
QString desk_image = "stand.png";
|
||||||
|
|
||||||
if (f_side == "def")
|
if (f_side == "def")
|
||||||
@ -817,7 +829,7 @@ void Courtroom::handle_wtce(QString p_wtce)
|
|||||||
sfx_player->setSource(wt_sfx);
|
sfx_player->setSource(wt_sfx);
|
||||||
|
|
||||||
sfx_player->play();
|
sfx_player->play();
|
||||||
ui_vp_wtce->play("witnesstestimony.gif");
|
ui_vp_wtce->play("witnesstestimony");
|
||||||
}
|
}
|
||||||
//cross examination
|
//cross examination
|
||||||
else if (p_wtce == "testimony2")
|
else if (p_wtce == "testimony2")
|
||||||
@ -829,7 +841,7 @@ void Courtroom::handle_wtce(QString p_wtce)
|
|||||||
sfx_player->setSource(ce_sfx);
|
sfx_player->setSource(ce_sfx);
|
||||||
|
|
||||||
sfx_player->play();
|
sfx_player->play();
|
||||||
ui_vp_wtce->play("crossexamination.gif");
|
ui_vp_wtce->play("crossexamination");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,6 +953,11 @@ void Courtroom::char_clicked(int n_char)
|
|||||||
ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_real_char) + "#" + get_hdid() + "#%"));
|
ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_real_char) + "#" + get_hdid() + "#%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Courtroom::ping_server()
|
||||||
|
{
|
||||||
|
ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%"));
|
||||||
|
}
|
||||||
|
|
||||||
Courtroom::~Courtroom()
|
Courtroom::~Courtroom()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
13
courtroom.h
13
courtroom.h
@ -52,11 +52,6 @@ public:
|
|||||||
QString get_default_background_path();
|
QString get_default_background_path();
|
||||||
|
|
||||||
int get_cid() {return m_cid;}
|
int get_cid() {return m_cid;}
|
||||||
int get_vp_x(){return m_viewport_x;}
|
|
||||||
int get_vp_y(){return m_viewport_y;}
|
|
||||||
int get_vp_w(){return m_viewport_width;}
|
|
||||||
int get_vp_h(){return m_viewport_height;}
|
|
||||||
|
|
||||||
|
|
||||||
void enter_courtroom(int p_cid);
|
void enter_courtroom(int p_cid);
|
||||||
|
|
||||||
@ -88,6 +83,9 @@ private:
|
|||||||
|
|
||||||
QSignalMapper *char_button_mapper;
|
QSignalMapper *char_button_mapper;
|
||||||
|
|
||||||
|
//triggers ping_server() every 60 seconds
|
||||||
|
QTimer *keepalive_timer;
|
||||||
|
|
||||||
//determines how fast messages tick onto screen
|
//determines how fast messages tick onto screen
|
||||||
QTimer *chat_tick_timer;
|
QTimer *chat_tick_timer;
|
||||||
int chat_tick_interval = 60;
|
int chat_tick_interval = 60;
|
||||||
@ -129,10 +127,13 @@ private:
|
|||||||
|
|
||||||
AOImage *ui_background;
|
AOImage *ui_background;
|
||||||
|
|
||||||
|
//ui_viewport is the parent of all the viewport widgets
|
||||||
|
QWidget *ui_viewport;
|
||||||
AOScene *ui_vp_background;
|
AOScene *ui_vp_background;
|
||||||
AOCharMovie *ui_vp_player_char;
|
AOCharMovie *ui_vp_player_char;
|
||||||
AOScene *ui_vp_desk;
|
AOScene *ui_vp_desk;
|
||||||
AOScene *ui_vp_legacy_desk;
|
AOScene *ui_vp_legacy_desk;
|
||||||
|
//AOImage *ui_vp_legacy_padding;
|
||||||
AOImage *ui_vp_chatbox;
|
AOImage *ui_vp_chatbox;
|
||||||
QLabel *ui_vp_showname;
|
QLabel *ui_vp_showname;
|
||||||
QPlainTextEdit *ui_vp_message;
|
QPlainTextEdit *ui_vp_message;
|
||||||
@ -244,6 +245,8 @@ private slots:
|
|||||||
|
|
||||||
void char_clicked(int n_char);
|
void char_clicked(int n_char);
|
||||||
|
|
||||||
|
void ping_server();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COURTROOM_H
|
#endif // COURTROOM_H
|
||||||
|
@ -42,6 +42,19 @@ QString AOApplication::get_music_path()
|
|||||||
return get_base_path() + "sounds/music/";
|
return get_base_path() + "sounds/music/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AOApplication::get_background_path()
|
||||||
|
{
|
||||||
|
if (courtroom_constructed)
|
||||||
|
return w_courtroom->get_background_path();
|
||||||
|
//this function being called when the courtroom isn't constructed makes no sense
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AOApplication::get_default_background_path()
|
||||||
|
{
|
||||||
|
return get_base_path() + "background/gs4/";
|
||||||
|
}
|
||||||
|
|
||||||
QString Courtroom::get_background_path()
|
QString Courtroom::get_background_path()
|
||||||
{
|
{
|
||||||
return ao_app->get_base_path() + "background/" + current_background.toLower() + "/";
|
return ao_app->get_base_path() + "background/" + current_background.toLower() + "/";
|
||||||
|
Loading…
Reference in New Issue
Block a user