Add courtroom_design.ini partial parsing for misc/ folder (only chat_arrow and showname atm)
Initialize chat arrow n stuff this is still pretty gay because you can't ignore size and set pos or something like that
This commit is contained in:
parent
7816c8ab23
commit
8007b1d1b9
@ -248,10 +248,10 @@ public:
|
||||
QPoint get_button_spacing(QString p_identifier, QString p_file);
|
||||
|
||||
//Returns the dimensions of widget with specified identifier from p_file
|
||||
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
|
||||
pos_size_type get_element_dimensions(QString p_identifier, QString p_file, QString p_char="");
|
||||
|
||||
//Returns the value to you
|
||||
QString get_design_element(QString p_identifier, QString p_file);
|
||||
QString get_design_element(QString p_identifier, QString p_file, QString p_char="");
|
||||
|
||||
//Returns the name of the font with p_identifier from p_file
|
||||
QString get_font_name(QString p_identifier, QString p_file);
|
||||
|
@ -1806,10 +1806,22 @@ void Courtroom::handle_chatmessage_2()
|
||||
chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat";
|
||||
if (!ui_vp_chatbox->set_chatbox(chatbox_path))
|
||||
ui_vp_chatbox->set_chatbox(chatbox_path + "box");
|
||||
|
||||
pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]);
|
||||
if (design_ini_result.width < 0 || design_ini_result.height < 0)
|
||||
{
|
||||
qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini";
|
||||
ui_vp_chat_arrow->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y);
|
||||
ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height);
|
||||
}
|
||||
}
|
||||
|
||||
pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini");
|
||||
int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini").toInt();
|
||||
pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]);
|
||||
int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini", m_chatmessage[CHAR_NAME]).toInt();
|
||||
|
||||
if(extra_width > 0)
|
||||
{
|
||||
|
@ -264,11 +264,12 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file)
|
||||
return return_value;
|
||||
}
|
||||
|
||||
pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file)
|
||||
pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file, QString p_char)
|
||||
{
|
||||
QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + p_file;
|
||||
QString design_ini_path = get_theme_path(p_file);
|
||||
QString default_path = get_default_theme_path(p_file);
|
||||
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
||||
QString f_result = read_design_ini(p_identifier, char_ini_path);
|
||||
|
||||
pos_size_type return_value;
|
||||
|
||||
@ -279,10 +280,14 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin
|
||||
|
||||
if (f_result == "")
|
||||
{
|
||||
f_result = read_design_ini(p_identifier, default_path);
|
||||
|
||||
f_result = read_design_ini(p_identifier, design_ini_path);
|
||||
if (f_result == "")
|
||||
return return_value;
|
||||
{
|
||||
f_result = read_design_ini(p_identifier, default_path);
|
||||
|
||||
if (f_result == "")
|
||||
return return_value;
|
||||
}
|
||||
}
|
||||
|
||||
QStringList sub_line_elements = f_result.split(",");
|
||||
@ -297,13 +302,18 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin
|
||||
|
||||
return return_value;
|
||||
}
|
||||
QString AOApplication::get_design_element(QString p_identifier, QString p_file)
|
||||
QString AOApplication::get_design_element(QString p_identifier, QString p_file, QString p_char)
|
||||
{
|
||||
QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + p_file;
|
||||
QString design_ini_path = get_theme_path(p_file);
|
||||
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
||||
QString default_path = get_default_theme_path(p_file);
|
||||
QString f_result = read_design_ini(p_identifier, char_ini_path);
|
||||
if (f_result == "")
|
||||
f_result = read_design_ini(p_identifier, default_path);
|
||||
{
|
||||
f_result = read_design_ini(p_identifier, design_ini_path);
|
||||
if (f_result == "")
|
||||
f_result = read_design_ini(p_identifier, default_path);
|
||||
}
|
||||
return f_result;
|
||||
}
|
||||
QString AOApplication::get_font_name(QString p_identifier, QString p_file)
|
||||
|
Loading…
Reference in New Issue
Block a user