Fix move func making characters slowly move to the left every frame on animated chars which are sized differently from viewport
Add a new get_qfont function Fix message box font being different from every other font due to incorrect font loading scheme Fix ui_evidence_save and ui_evidence_load tooltips being wrong
This commit is contained in:
parent
cfc3312840
commit
9451822e09
@ -127,6 +127,9 @@ public:
|
|||||||
//sets font size based on theme ini files
|
//sets font size based on theme ini files
|
||||||
void set_font(QWidget *widget, QString class_name, QString p_identifier);
|
void set_font(QWidget *widget, QString class_name, QString p_identifier);
|
||||||
|
|
||||||
|
//Get the properly constructed font
|
||||||
|
QFont get_qfont(QString font_name, int f_pointsize);
|
||||||
|
|
||||||
//actual operation of setting the font on a widget
|
//actual operation of setting the font on a widget
|
||||||
void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false);
|
void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ QPixmap AOCharMovie::get_pixmap(QImage image)
|
|||||||
|
|
||||||
f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode);
|
f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode);
|
||||||
this->resize(f_pixmap.size());
|
this->resize(f_pixmap.size());
|
||||||
this->move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically
|
QLabel::move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically
|
||||||
|
|
||||||
return f_pixmap;
|
return f_pixmap;
|
||||||
}
|
}
|
||||||
|
@ -606,6 +606,8 @@ void Courtroom::set_widgets()
|
|||||||
set_size_and_pos(ui_vp_showname, "showname");
|
set_size_and_pos(ui_vp_showname, "showname");
|
||||||
|
|
||||||
set_size_and_pos(ui_vp_message, "message");
|
set_size_and_pos(ui_vp_message, "message");
|
||||||
|
ui_vp_message->hide();
|
||||||
|
|
||||||
//We detached the text as parent from the chatbox so it doesn't get affected by the screenshake.
|
//We detached the text as parent from the chatbox so it doesn't get affected by the screenshake.
|
||||||
ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y());
|
ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y());
|
||||||
ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
|
ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction);
|
||||||
@ -848,37 +850,40 @@ void Courtroom::set_fonts()
|
|||||||
void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifier)
|
void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifier)
|
||||||
{
|
{
|
||||||
QString design_file = "courtroom_fonts.ini";
|
QString design_file = "courtroom_fonts.ini";
|
||||||
int f_weight = ao_app->get_font_size(p_identifier, design_file);
|
int f_pointsize = ao_app->get_font_size(p_identifier, design_file);
|
||||||
QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file);
|
QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file);
|
||||||
QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
|
QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
|
||||||
|
|
||||||
bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not?
|
bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not?
|
||||||
|
|
||||||
|
this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize), f_color, bold);
|
||||||
|
}
|
||||||
|
|
||||||
|
QFont Courtroom::get_qfont(QString font_name, int f_pointsize)
|
||||||
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
if (font_name.isEmpty())
|
if (font_name.isEmpty())
|
||||||
{
|
{
|
||||||
font = QFont("Arial", f_weight);
|
font = QFont("Arial", f_pointsize);
|
||||||
font.setStyleHint(QFont::SansSerif, QFont::NoAntialias);
|
font.setStyleHint(QFont::SansSerif, QFont::NoAntialias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
font = QFont(font_name, f_weight);
|
font = QFont(font_name, f_pointsize);
|
||||||
this->set_qfont(widget, class_name, font, f_color, bold);
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold)
|
void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold)
|
||||||
{
|
{
|
||||||
if(class_name.isEmpty())
|
if(class_name.isEmpty())
|
||||||
class_name = widget->metaObject()->className();
|
class_name = widget->metaObject()->className();
|
||||||
widget->setFont(font);
|
|
||||||
|
|
||||||
QString is_bold = "";
|
font.setBold(bold);
|
||||||
if(bold) is_bold = "font: bold;";
|
widget->setFont(font);
|
||||||
|
|
||||||
QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
|
QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
|
||||||
"color: rgba(" +
|
"color: rgba(" +
|
||||||
QString::number(f_color.red()) + ", " +
|
QString::number(f_color.red()) + ", " +
|
||||||
QString::number(f_color.green()) + ", " +
|
QString::number(f_color.green()) + ", " +
|
||||||
QString::number(f_color.blue()) + ", 255);\n" + is_bold + "}";
|
QString::number(f_color.blue()) + ", 255);}";
|
||||||
widget->setStyleSheet(style_sheet_string);
|
widget->setStyleSheet(style_sheet_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1745,8 +1750,9 @@ void Courtroom::handle_chatmessage_2()
|
|||||||
ui_vp_message->hide();
|
ui_vp_message->hide();
|
||||||
ui_vp_chatbox->hide();
|
ui_vp_chatbox->hide();
|
||||||
|
|
||||||
|
//todo: put this in its own function or update
|
||||||
QString design_file = "courtroom_fonts.ini";
|
QString design_file = "courtroom_fonts.ini";
|
||||||
int f_weight = ao_app->get_font_size("message", design_file);
|
int f_pointsize = ao_app->get_font_size("message", design_file);
|
||||||
QString font_name = ao_app->get_font_name("message_font", design_file);
|
QString font_name = ao_app->get_font_name("message_font", design_file);
|
||||||
QColor f_color = ao_app->get_color("message_color", design_file);
|
QColor f_color = ao_app->get_color("message_color", design_file);
|
||||||
bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not?
|
bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not?
|
||||||
@ -1757,8 +1763,8 @@ void Courtroom::handle_chatmessage_2()
|
|||||||
|
|
||||||
int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]);
|
int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]);
|
||||||
if (chatsize != -1)
|
if (chatsize != -1)
|
||||||
f_weight = chatsize;
|
f_pointsize = chatsize;
|
||||||
this->set_qfont(ui_vp_message, "", QFont(font_name, f_weight), f_color, bold);
|
this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize), f_color, bold);
|
||||||
|
|
||||||
set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]);
|
set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ void Courtroom::initialize_evidence()
|
|||||||
ui_evidence_save = new AOButton(ui_evidence, ao_app);
|
ui_evidence_save = new AOButton(ui_evidence, ao_app);
|
||||||
ui_evidence_save->setToolTip(tr("Save evidence to an .ini file."));
|
ui_evidence_save->setToolTip(tr("Save evidence to an .ini file."));
|
||||||
ui_evidence_load = new AOButton(ui_evidence, ao_app);
|
ui_evidence_load = new AOButton(ui_evidence, ao_app);
|
||||||
ui_evidence_save->setToolTip(tr("Load evidence from an .ini file."));
|
ui_evidence_load->setToolTip(tr("Load evidence from an .ini file."));
|
||||||
|
|
||||||
ui_evidence_overlay = new AOImage(ui_evidence, ao_app);
|
ui_evidence_overlay = new AOImage(ui_evidence, ao_app);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user