@@ -437,6 +437,28 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
437437 set_char_select ();
438438}
439439
440+ void Courtroom::set_courtroom_size ()
441+ {
442+ QString filename = " courtroom_design.ini" ;
443+ pos_size_type f_courtroom =
444+ ao_app->get_element_dimensions (" courtroom" , filename);
445+
446+ if (f_courtroom.width < 0 || f_courtroom.height < 0 ) {
447+ qDebug () << " W: did not find courtroom width or height in " << filename;
448+
449+ this ->setFixedSize (714 , 668 );
450+ }
451+ else {
452+ m_courtroom_width = f_courtroom.width ;
453+ m_courtroom_height = f_courtroom.height ;
454+
455+ this ->setFixedSize (f_courtroom.width , f_courtroom.height );
456+ }
457+ ui_background->move (0 , 0 );
458+ ui_background->resize (m_courtroom_width, m_courtroom_height);
459+ ui_background->set_image (" courtroombackground" );
460+ }
461+
440462void Courtroom::set_mute_list ()
441463{
442464 mute_map.clear ();
@@ -480,27 +502,7 @@ void Courtroom::set_widgets()
480502 QSettings settings (ao_app->get_theme_path (filename, ao_app->current_theme ), QSettings::IniFormat);
481503 ao_app->default_theme = settings.value (" default_theme" , " default" ).toString ();
482504
483- pos_size_type f_courtroom =
484- ao_app->get_element_dimensions (" courtroom" , filename);
485-
486- if (f_courtroom.width < 0 || f_courtroom.height < 0 ) {
487- qDebug () << " W: did not find courtroom width or height in " << filename;
488-
489- this ->setFixedSize (714 , 668 );
490- }
491- else {
492- m_courtroom_width = f_courtroom.width ;
493- m_courtroom_height = f_courtroom.height ;
494-
495- this ->setFixedSize (f_courtroom.width , f_courtroom.height );
496- }
497-
498505 set_fonts ();
499-
500- ui_background->move (0 , 0 );
501- ui_background->resize (m_courtroom_width, m_courtroom_height);
502- ui_background->set_image (" courtroombackground" );
503-
504506 set_size_and_pos (ui_viewport, " viewport" );
505507
506508 // If there is a point to it, show all CCCC features.
@@ -680,17 +682,8 @@ void Courtroom::set_widgets()
680682 for (int i = 0 ; i < max_clocks; i++) {
681683 set_size_and_pos (ui_clock[i], " clock_" + QString::number (i));
682684 }
683-
684- if (is_ao2_bg) {
685- set_size_and_pos (ui_ic_chat_message, " ao2_ic_chat_message" );
686- // set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
687- set_size_and_pos (ui_ic_chat_name, " ao2_ic_chat_name" );
688- }
689- else {
690- set_size_and_pos (ui_ic_chat_message, " ic_chat_message" );
691- // set_size_and_pos(ui_vp_chatbox, "chatbox");
692- set_size_and_pos (ui_ic_chat_name, " ic_chat_name" );
693- }
685+ set_size_and_pos (ui_ic_chat_message, " ao2_ic_chat_message" );
686+ set_size_and_pos (ui_ic_chat_name, " ao2_ic_chat_name" );
694687
695688 ui_ic_chat_message->setStyleSheet (
696689 " QLineEdit{background-color: rgba(100, 100, 100, 255);}" );
@@ -1137,30 +1130,12 @@ void Courtroom::set_window_title(QString p_title)
11371130 this ->setWindowTitle (p_title);
11381131}
11391132
1140- void Courtroom::set_size_and_pos (QWidget *p_widget, QString p_identifier)
1133+ void Courtroom::set_size_and_pos (QWidget *p_widget, QString p_identifier, QString p_misc )
11411134{
11421135 QString filename = " courtroom_design.ini" ;
11431136
11441137 pos_size_type design_ini_result =
1145- ao_app->get_element_dimensions (p_identifier, filename);
1146-
1147- if (design_ini_result.width < 0 || design_ini_result.height < 0 ) {
1148- qDebug () << " W: could not find \" " << p_identifier << " \" in " << filename;
1149- p_widget->hide ();
1150- }
1151- else {
1152- p_widget->move (design_ini_result.x , design_ini_result.y );
1153- p_widget->resize (design_ini_result.width , design_ini_result.height );
1154- }
1155- }
1156-
1157- void Courtroom::set_size_and_pos (QWidget *p_widget, QString p_identifier,
1158- QString p_char)
1159- {
1160- QString filename = " courtroom_design.ini" ;
1161-
1162- pos_size_type design_ini_result =
1163- ao_app->get_element_dimensions (p_identifier, filename, ao_app->get_chat (p_char));
1138+ ao_app->get_element_dimensions (p_identifier, filename, p_misc);
11641139
11651140 if (design_ini_result.width < 0 || design_ini_result.height < 0 ) {
11661141 qDebug () << " W: could not find \" " << p_identifier << " \" in " << filename;
@@ -1268,17 +1243,6 @@ void Courtroom::set_background(QString p_background, bool display)
12681243
12691244 set_pos_dropdown (pos_list);
12701245
1271- is_ao2_bg = true ;
1272-
1273- if (is_ao2_bg) {
1274- // set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
1275- set_size_and_pos (ui_ic_chat_message, " ao2_ic_chat_message" );
1276- }
1277- else {
1278- // set_size_and_pos(ui_vp_chatbox, "chatbox");
1279- set_size_and_pos (ui_ic_chat_message, " ic_chat_message" );
1280- }
1281-
12821246 if (display) {
12831247 ui_vp_speedlines->stop ();
12841248 ui_vp_player_char->stop ();
@@ -1461,12 +1425,6 @@ void Courtroom::update_character(int p_cid)
14611425 }
14621426 }
14631427 }
1464- if (is_ao2_bg) {
1465- set_size_and_pos (ui_vp_chatbox, " ao2_chatbox" , f_char);
1466- }
1467- else {
1468- set_size_and_pos (ui_vp_chatbox, " chatbox" , f_char);
1469- }
14701428
14711429 if (m_cid != -1 ) // there is no name at char_list -1, and we crash if we try
14721430 // to find one
@@ -1483,8 +1441,6 @@ void Courtroom::update_character(int p_cid)
14831441
14841442void Courtroom::enter_courtroom ()
14851443{
1486- set_widgets ();
1487-
14881444 current_evidence_page = 0 ;
14891445 current_evidence = 0 ;
14901446
@@ -2546,23 +2502,18 @@ void Courtroom::initialize_chatbox()
25462502 else {
25472503 ui_vp_showname->setText (m_chatmessage[SHOWNAME ]);
25482504 }
2505+ QString customchar;
2506+ if (ao_app->is_customchat_enabled ())
2507+ customchar = m_chatmessage[CHAR_NAME ];
2508+ QString p_misc = ao_app->get_chat (customchar);
25492509
2550- if (is_ao2_bg) {
2551- set_size_and_pos (ui_vp_chatbox, " ao2_chatbox" , m_chatmessage[CHAR_NAME ]);
2552- }
2553- else {
2554- set_size_and_pos (ui_vp_chatbox, " chatbox" , m_chatmessage[CHAR_NAME ]);
2555- }
2556- set_size_and_pos (ui_vp_showname, " showname" , m_chatmessage[CHAR_NAME ]);
2557- set_size_and_pos (ui_vp_message, " message" , m_chatmessage[CHAR_NAME ]);
2510+ set_size_and_pos (ui_vp_chatbox, " ao2_chatbox" , p_misc);
2511+ set_size_and_pos (ui_vp_showname, " showname" , p_misc);
2512+ set_size_and_pos (ui_vp_message, " message" , p_misc);
25582513 ui_vp_message->move (ui_vp_message->x () + ui_vp_chatbox->x (),
25592514 ui_vp_message->y () + ui_vp_chatbox->y ());
25602515 ui_vp_message->setTextInteractionFlags (Qt::NoTextInteraction);
25612516
2562- QString customchar;
2563- if (ao_app->is_customchat_enabled ())
2564- customchar = m_chatmessage[CHAR_NAME ];
2565- QString p_misc = ao_app->get_chat (customchar);
25662517 if (ui_vp_showname->text ().trimmed ().isEmpty ()) // Whitespace showname
25672518 {
25682519 ui_vp_chatbox->set_image (" chatblank" , p_misc);
@@ -5264,8 +5215,10 @@ void Courtroom::on_reload_theme_clicked()
52645215{
52655216 ao_app->reload_theme ();
52665217
5267- enter_courtroom ();
5218+ set_courtroom_size ();
5219+ set_widgets ();
52685220 update_character (m_cid);
5221+ enter_courtroom ();
52695222
52705223 anim_state = 4 ;
52715224 text_state = 3 ;
0 commit comments