aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2020-05-22 17:13:17 -0500
committeroldmud0 <oldmud0@users.noreply.github.com>2020-05-22 17:13:37 -0500
commit8928aa2718378bc42d20d5bbe6c17be68d65d6f3 (patch)
treebf90d3e73519d58cc89e2135b613e308ac0a0ed8 /src/courtroom.cpp
parent156a760ebab6839c53f9c613881f0937e814414a (diff)
Perform clang-format
If you don't want to see this commit on blames, use the hidden whitespace option on GitHub, or use `-w` in git-blame.
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp2157
1 files changed, 1023 insertions, 1134 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index cd01f64b..25b4826c 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -3,32 +3,29 @@
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
{
ao_app = p_ao_app;
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
// Change the default audio output device to be the one the user has given
// in his config.ini file for now.
unsigned int a = 0;
BASS_DEVICEINFO info;
- if (ao_app->get_audio_output_device() == "default")
- {
- BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
- load_bass_opus_plugin();
- }
- else
- {
- for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
- {
- if (ao_app->get_audio_output_device() == info.name)
- {
- BASS_SetDevice(a);
- BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
- load_bass_opus_plugin();
- qDebug() << info.name << "was set as the default audio output device.";
- break;
- }
+ if (ao_app->get_audio_output_device() == "default") {
+ BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
+ load_bass_opus_plugin();
+ }
+ else {
+ for (a = 0; BASS_GetDeviceInfo(a, &info); a++) {
+ if (ao_app->get_audio_output_device() == info.name) {
+ BASS_SetDevice(a);
+ BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr,
+ nullptr);
+ load_bass_opus_plugin();
+ qDebug() << info.name << "was set as the default audio output device.";
+ break;
}
+ }
}
- #endif
+#endif
keepalive_timer = new QTimer(this);
keepalive_timer->start(60000);
@@ -131,8 +128,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_ooc_chat_name->setMaxLength(30);
ui_ooc_chat_name->setText(p_ao_app->get_default_username());
- //ui_area_password = new QLineEdit(this);
- //ui_area_password->setFrame(false);
+ // ui_area_password = new QLineEdit(this);
+ // ui_area_password->setFrame(false);
ui_music_search = new QLineEdit(this);
ui_music_search->setFrame(false);
ui_music_search->setPlaceholderText(tr("Search"));
@@ -154,7 +151,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_pos_dropdown->addItem("sea");
ui_defense_bar = new AOImage(this, ao_app);
- ui_prosecution_bar = new AOImage(this, ao_app);
+ ui_prosecution_bar = new AOImage(this, ao_app);
ui_music_label = new QLabel(this);
ui_sfx_label = new QLabel(this);
@@ -244,7 +241,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_pair_list = new QListWidget(this);
ui_pair_offset_spinbox = new QSpinBox(this);
- ui_pair_offset_spinbox->setRange(-100,100);
+ ui_pair_offset_spinbox->setRange(-100, 100);
ui_pair_offset_spinbox->setSuffix("% offset");
ui_pair_button = new AOButton(this, ao_app);
@@ -259,81 +256,117 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done()));
connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done()));
- connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking()));
+ connect(text_delay_timer, SIGNAL(timeout()), this,
+ SLOT(start_chat_ticking()));
connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx()));
connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick()));
connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done()));
- connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony()));
- connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony()));
+ connect(testimony_show_timer, SIGNAL(timeout()), this,
+ SLOT(hide_testimony()));
+ connect(testimony_hide_timer, SIGNAL(timeout()), this,
+ SLOT(show_testimony()));
- 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_left, SIGNAL(clicked()), this,
+ SLOT(on_emote_left_clicked()));
+ connect(ui_emote_right, SIGNAL(clicked()), this,
+ SLOT(on_emote_right_clicked()));
- connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int)));
- connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int)));
+ connect(ui_emote_dropdown, SIGNAL(activated(int)), this,
+ SLOT(on_emote_dropdown_changed(int)));
+ connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(on_pos_dropdown_changed(int)));
- connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex)));
+ connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this,
+ SLOT(on_mute_list_clicked(QModelIndex)));
- connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed()));
+ connect(ui_ic_chat_message, SIGNAL(returnPressed()), this,
+ SLOT(on_chat_return_pressed()));
- 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()));
- connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_music_list_double_clicked(QModelIndex)));
- connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex)));
+ connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this,
+ SLOT(on_music_list_double_clicked(QModelIndex)));
+ connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this,
+ SLOT(on_area_list_double_clicked(QModelIndex)));
connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked()));
connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked()));
connect(ui_take_that, SIGNAL(clicked()), this, SLOT(on_take_that_clicked()));
- connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked()));
+ connect(ui_custom_objection, SIGNAL(clicked()), this,
+ SLOT(on_custom_objection_clicked()));
- connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked()));
+ connect(ui_realization, SIGNAL(clicked()), this,
+ SLOT(on_realization_clicked()));
connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked()));
- connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked()));
- connect(ui_defense_plus, SIGNAL(clicked()), this, SLOT(on_defense_plus_clicked()));
- connect(ui_prosecution_minus, SIGNAL(clicked()), this, SLOT(on_prosecution_minus_clicked()));
- connect(ui_prosecution_plus, SIGNAL(clicked()), this, SLOT(on_prosecution_plus_clicked()));
-
- connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, SLOT(on_text_color_changed(int)));
-
- connect(ui_music_slider, SIGNAL(valueChanged(int)), this, SLOT(on_music_slider_moved(int)));
- connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, SLOT(on_sfx_slider_moved(int)));
- connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, SLOT(on_blip_slider_moved(int)));
-
- connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_log_limit_changed(int)));
-
- connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked()));
-
- connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString)));
-
- connect(ui_witness_testimony, SIGNAL(clicked()), this, SLOT(on_witness_testimony_clicked()));
- connect(ui_cross_examination, SIGNAL(clicked()), this, SLOT(on_cross_examination_clicked()));
+ connect(ui_defense_minus, SIGNAL(clicked()), this,
+ SLOT(on_defense_minus_clicked()));
+ connect(ui_defense_plus, SIGNAL(clicked()), this,
+ SLOT(on_defense_plus_clicked()));
+ connect(ui_prosecution_minus, SIGNAL(clicked()), this,
+ SLOT(on_prosecution_minus_clicked()));
+ connect(ui_prosecution_plus, SIGNAL(clicked()), this,
+ SLOT(on_prosecution_plus_clicked()));
+
+ connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(on_text_color_changed(int)));
+
+ connect(ui_music_slider, SIGNAL(valueChanged(int)), this,
+ SLOT(on_music_slider_moved(int)));
+ connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this,
+ SLOT(on_sfx_slider_moved(int)));
+ connect(ui_blip_slider, SIGNAL(valueChanged(int)), this,
+ SLOT(on_blip_slider_moved(int)));
+
+ connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this,
+ SLOT(on_log_limit_changed(int)));
+
+ connect(ui_ooc_toggle, SIGNAL(clicked()), this,
+ SLOT(on_ooc_toggle_clicked()));
+
+ connect(ui_music_search, SIGNAL(textChanged(QString)), this,
+ SLOT(on_music_search_edited(QString)));
+
+ connect(ui_witness_testimony, SIGNAL(clicked()), this,
+ SLOT(on_witness_testimony_clicked()));
+ connect(ui_cross_examination, SIGNAL(clicked()), this,
+ SLOT(on_cross_examination_clicked()));
connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked()));
- connect(ui_not_guilty, SIGNAL(clicked()), this, SLOT(on_not_guilty_clicked()));
+ connect(ui_not_guilty, SIGNAL(clicked()), this,
+ SLOT(on_not_guilty_clicked()));
- connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked()));
- connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked()));
+ connect(ui_change_character, SIGNAL(clicked()), this,
+ SLOT(on_change_character_clicked()));
+ connect(ui_reload_theme, SIGNAL(clicked()), this,
+ SLOT(on_reload_theme_clicked()));
connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked()));
connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked()));
- connect(ui_announce_casing, SIGNAL(clicked()), this, SLOT(on_announce_casing_clicked()));
- connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked()));
+ connect(ui_announce_casing, SIGNAL(clicked()), this,
+ SLOT(on_announce_casing_clicked()));
+ connect(ui_switch_area_music, SIGNAL(clicked()), this,
+ SLOT(on_switch_area_music_clicked()));
connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked()));
connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked()));
- connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked()));
+ connect(ui_showname_enable, SIGNAL(clicked()), this,
+ SLOT(on_showname_enable_clicked()));
connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked()));
- connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex)));
- connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int)));
+ connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this,
+ SLOT(on_pair_list_clicked(QModelIndex)));
+ connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this,
+ SLOT(on_pair_offset_changed(int)));
- connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked()));
+ connect(ui_evidence_button, SIGNAL(clicked()), this,
+ SLOT(on_evidence_button_clicked()));
set_widgets();
@@ -344,9 +377,8 @@ void Courtroom::set_mute_list()
{
mute_map.clear();
- //maps which characters are muted based on cid, none are muted by default
- for (int n_cid = 0 ; n_cid < char_list.size() ; n_cid++)
- {
+ // maps which characters are muted based on cid, none are muted by default
+ for (int n_cid = 0; n_cid < char_list.size(); n_cid++) {
mute_map.insert(n_cid, false);
}
@@ -357,9 +389,8 @@ void Courtroom::set_mute_list()
sorted_mute_list.sort();
- for (QString i_name : sorted_mute_list)
- {
- //mute_map.insert(i_name, false);
+ for (QString i_name : sorted_mute_list) {
+ // mute_map.insert(i_name, false);
ui_mute_list->addItem(i_name);
}
}
@@ -373,8 +404,7 @@ void Courtroom::set_pair_list()
sorted_pair_list.sort();
- for (QString i_name : sorted_pair_list)
- {
+ for (QString i_name : sorted_pair_list) {
ui_pair_list->addItem(i_name);
}
}
@@ -386,16 +416,15 @@ void Courtroom::set_widgets()
QString filename = "courtroom_design.ini";
- pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename);
+ pos_size_type f_courtroom =
+ ao_app->get_element_dimensions("courtroom", filename);
- if (f_courtroom.width < 0 || f_courtroom.height < 0)
- {
+ if (f_courtroom.width < 0 || f_courtroom.height < 0) {
qDebug() << "W: did not find courtroom width or height in " << filename;
this->resize(714, 668);
}
- else
- {
+ else {
m_courtroom_width = f_courtroom.width;
m_courtroom_height = f_courtroom.height;
@@ -411,17 +440,16 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_viewport, "viewport");
// If there is a point to it, show all CCCC features.
- // We also do this this soon so that set_size_and_pos can hide them all later, if needed.
- if (ao_app->cccc_ic_support_enabled)
- {
+ // We also do this this soon so that set_size_and_pos can hide them all later,
+ // if needed.
+ if (ao_app->cccc_ic_support_enabled) {
ui_pair_button->show();
ui_pre_non_interrupt->show();
ui_showname_enable->show();
ui_ic_chat_name->show();
ui_ic_chat_name->setEnabled(true);
}
- else
- {
+ else {
ui_pair_button->hide();
ui_pre_non_interrupt->hide();
ui_showname_enable->hide();
@@ -429,17 +457,16 @@ void Courtroom::set_widgets()
ui_ic_chat_name->setEnabled(false);
}
- if (ao_app->casing_alerts_enabled)
- {
+ if (ao_app->casing_alerts_enabled) {
ui_announce_casing->show();
}
- else
- {
+ else {
ui_announce_casing->hide();
}
// We also show the non-server-dependent client additions.
- // Once again, if the theme can't display it, set_move_and_pos will catch them.
+ // Once again, if the theme can't display it, set_move_and_pos will catch
+ // them.
ui_settings->show();
ui_log_limit_label->show();
ui_log_limit_spinbox->show();
@@ -454,13 +481,15 @@ void Courtroom::set_widgets()
ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
ui_vp_sideplayer_char->move(0, 0);
- ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_sideplayer_char->combo_resize(ui_viewport->width(),
+ ui_viewport->height());
- //the AO2 desk element
+ // the AO2 desk element
ui_vp_desk->move(0, 0);
ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height());
- //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene()
+ // the size of the ui_vp_legacy_desk element relies on various factors and is
+ // set in set_scene()
double y_modifier = 147.0 / 192.0;
int final_y = static_cast<int>(y_modifier * ui_viewport->height());
@@ -514,21 +543,21 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_music_list, "music_list");
- if (is_ao2_bg)
- {
+ if (is_ao2_bg) {
set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name");
}
- else
- {
+ else {
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
set_size_and_pos(ui_vp_chatbox, "chatbox");
set_size_and_pos(ui_ic_chat_name, "ic_chat_name");
}
- ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}");
- ui_ic_chat_name->setStyleSheet("QLineEdit{background-color: rgba(180, 180, 180, 255);}");
+ ui_ic_chat_message->setStyleSheet(
+ "QLineEdit{background-color: rgba(100, 100, 100, 255);}");
+ ui_ic_chat_name->setStyleSheet(
+ "QLineEdit{background-color: rgba(180, 180, 180, 255);}");
ui_vp_chatbox->set_image("chatmed.png");
ui_vp_chatbox->hide();
@@ -542,7 +571,7 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name");
ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
- //set_size_and_pos(ui_area_password, "area_password");
+ // set_size_and_pos(ui_area_password, "area_password");
set_size_and_pos(ui_music_search, "music_search");
set_size_and_pos(ui_emotes, "emotes");
@@ -557,10 +586,12 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_pos_dropdown, "pos_dropdown");
set_size_and_pos(ui_defense_bar, "defense_bar");
- ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + ".png");
+ ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) +
+ ".png");
set_size_and_pos(ui_prosecution_bar, "prosecution_bar");
- ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state) + ".png");
+ ui_prosecution_bar->set_image(
+ "prosecutionbar" + QString::number(prosecution_bar_state) + ".png");
set_size_and_pos(ui_music_label, "music_label");
ui_music_label->setText("Music");
@@ -717,12 +748,13 @@ void Courtroom::set_fonts()
// Set color of labels and checkboxes
const QString design_file = "courtroom_fonts.ini";
QColor f_color = ao_app->get_color("label_color", design_file);
- QString color_string = "color: rgba(" +
- QString::number(f_color.red()) + ", " +
- QString::number(f_color.green()) + ", " +
- QString::number(f_color.blue()) + ", 255); }";
- QString style_sheet_string = "QLabel {" + color_string + "}"
- "QCheckBox {" + color_string + "}";
+ QString color_string = "color: rgba(" + QString::number(f_color.red()) +
+ ", " + QString::number(f_color.green()) + ", " +
+ QString::number(f_color.blue()) + ", 255); }";
+ QString style_sheet_string = "QLabel {" + color_string +
+ "}"
+ "QCheckBox {" +
+ color_string + "}";
setStyleSheet(style_sheet_string);
}
@@ -733,16 +765,14 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier)
QString class_name = widget->metaObject()->className();
QString fontt = ao_app->get_font_name(p_identifier + "_font", design_file);
- widget->setFont(QFont(fontt, f_weight));
-
+ widget->setFont(QFont(fontt, f_weight));
QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
- QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
- "color: rgba(" +
- QString::number(f_color.red()) + ", " +
- QString::number(f_color.green()) + ", " +
- QString::number(f_color.blue()) + ", 255); }";
+ QString style_sheet_string =
+ class_name + " { background-color: rgba(0, 0, 0, 0);\n" + "color: rgba(" +
+ QString::number(f_color.red()) + ", " + QString::number(f_color.green()) +
+ ", " + QString::number(f_color.blue()) + ", 255); }";
widget->setStyleSheet(style_sheet_string);
}
@@ -756,15 +786,14 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
{
QString filename = "courtroom_design.ini";
- pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
+ pos_size_type design_ini_result =
+ ao_app->get_element_dimensions(p_identifier, filename);
- if (design_ini_result.width < 0 || design_ini_result.height < 0)
- {
+ if (design_ini_result.width < 0 || design_ini_result.height < 0) {
qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename;
p_widget->hide();
}
- else
- {
+ else {
p_widget->move(design_ini_result.x, design_ini_result.y);
p_widget->resize(design_ini_result.width, design_ini_result.height);
}
@@ -772,9 +801,9 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
void Courtroom::set_taken(int n_char, bool p_taken)
{
- if (n_char >= char_list.size())
- {
- qDebug() << "W: set_taken attempted to set an index bigger than char_list size";
+ if (n_char >= char_list.size()) {
+ qDebug()
+ << "W: set_taken attempted to set an index bigger than char_list size";
return;
}
@@ -818,32 +847,28 @@ void Courtroom::set_background(QString p_background)
file_exists(ao_app->get_background_path("prosecutiondesk.png")) &&
file_exists(ao_app->get_background_path("stand.png"));
- if (is_ao2_bg)
- {
+ 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
- {
+ 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)
-{
+{
m_cid = p_cid;
QString f_char;
- if (m_cid == -1)
- {
+ if (m_cid == -1) {
if (ao_app->is_discord_enabled())
ao_app->discord->state_spectate();
f_char = "";
}
- else
- {
+ else {
f_char = ao_app->get_char_name(char_list.at(m_cid).name);
if (ao_app->is_discord_enabled())
@@ -870,8 +895,7 @@ void Courtroom::enter_courtroom(int p_cid)
QString side = ao_app->get_char_side(f_char);
- if (side == "jud")
- {
+ if (side == "jud") {
ui_witness_testimony->show();
ui_cross_examination->show();
ui_not_guilty->show();
@@ -881,8 +905,7 @@ void Courtroom::enter_courtroom(int p_cid)
ui_prosecution_minus->show();
ui_prosecution_plus->show();
}
- else
- {
+ else {
ui_witness_testimony->hide();
ui_cross_examination->hide();
ui_guilty->hide();
@@ -895,7 +918,7 @@ void Courtroom::enter_courtroom(int p_cid)
if (ao_app->custom_objection_enabled &&
(file_exists(ao_app->get_character_path(current_char, "custom.gif")) ||
- file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
+ file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
file_exists(ao_app->get_character_path(current_char, "custom.wav")))
ui_custom_objection->show();
else
@@ -923,7 +946,7 @@ void Courtroom::enter_courtroom(int p_cid)
set_widgets();
- //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
+ // ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
ui_char_select_background->hide();
@@ -943,14 +966,12 @@ void Courtroom::list_music()
int n_listed_songs = 0;
- for (int n_song = 0 ; n_song < music_list.size() ; ++n_song)
- {
+ for (int n_song = 0; n_song < music_list.size(); ++n_song) {
QString i_song = music_list.at(n_song);
QString i_song_listname = i_song;
i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf("."));
- if (i_song.toLower().contains(ui_music_search->text().toLower()))
- {
+ if (i_song.toLower().contains(ui_music_search->text().toLower())) {
ui_music_list->addItem(i_song_listname);
music_row_to_number.append(n_song);
@@ -983,8 +1004,7 @@ void Courtroom::list_areas()
int n_listed_areas = 0;
- for (int n_area = 0 ; n_area < area_list.size() ; ++n_area)
- {
+ for (int n_area = 0; n_area < area_list.size(); ++n_area) {
QString i_area = "";
i_area.append("[");
i_area.append(QString::number(n_area));
@@ -992,8 +1012,7 @@ void Courtroom::list_areas()
i_area.append(area_list.at(n_area));
- if (ao_app->arup_enabled)
- {
+ if (ao_app->arup_enabled) {
i_area.append("\n ");
i_area.append(arup_statuses.at(n_area));
@@ -1008,35 +1027,30 @@ void Courtroom::list_areas()
i_area.append(arup_locks.at(n_area));
}
- if (i_area.toLower().contains(ui_music_search->text().toLower()))
- {
+ if (i_area.toLower().contains(ui_music_search->text().toLower())) {
ui_area_list->addItem(i_area);
area_row_to_number.append(n_area);
- if (ao_app->arup_enabled)
- {
+ if (ao_app->arup_enabled) {
// Colouring logic here.
ui_area_list->item(n_listed_areas)->setBackground(free_brush);
- if (arup_locks.at(n_area) == "LOCKED")
- {
- ui_area_list->item(n_listed_areas)->setBackground(locked_brush);
+ if (arup_locks.at(n_area) == "LOCKED") {
+ ui_area_list->item(n_listed_areas)->setBackground(locked_brush);
}
- else
- {
- if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
- ui_area_list->item(n_listed_areas)->setBackground(lfp_brush);
- else if (arup_statuses.at(n_area) == "CASING")
- ui_area_list->item(n_listed_areas)->setBackground(casing_brush);
- else if (arup_statuses.at(n_area) == "RECESS")
- ui_area_list->item(n_listed_areas)->setBackground(recess_brush);
- else if (arup_statuses.at(n_area) == "RP")
- ui_area_list->item(n_listed_areas)->setBackground(rp_brush);
- else if (arup_statuses.at(n_area) == "GAMING")
- ui_area_list->item(n_listed_areas)->setBackground(gaming_brush);
+ else {
+ if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
+ ui_area_list->item(n_listed_areas)->setBackground(lfp_brush);
+ else if (arup_statuses.at(n_area) == "CASING")
+ ui_area_list->item(n_listed_areas)->setBackground(casing_brush);
+ else if (arup_statuses.at(n_area) == "RECESS")
+ ui_area_list->item(n_listed_areas)->setBackground(recess_brush);
+ else if (arup_statuses.at(n_area) == "RP")
+ ui_area_list->item(n_listed_areas)->setBackground(rp_brush);
+ else if (arup_statuses.at(n_area) == "GAMING")
+ ui_area_list->item(n_listed_areas)->setBackground(gaming_brush);
}
}
- else
- {
+ else {
ui_area_list->item(n_listed_areas)->setBackground(free_brush);
}
@@ -1047,17 +1061,22 @@ void Courtroom::list_areas()
void Courtroom::append_ms_chatmessage(QString f_name, QString f_message)
{
- ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
+ ui_ms_chatlog->append_chatmessage(
+ f_name, f_message,
+ ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
}
-void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour)
+void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
+ QString p_colour)
{
QString colour = "#000000";
if (p_colour == "0")
- colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
+ colour =
+ ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
if (p_colour == "1")
- colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
+ colour =
+ ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
ui_server_chatlog->append_chatmessage(p_name, p_message, colour);
}
@@ -1067,33 +1086,32 @@ void Courtroom::on_chat_return_pressed()
if (ui_ic_chat_message->text() == "" || is_muted)
return;
- if ((anim_state < 3 || text_state < 2) &&
- objection_state == 0)
+ if ((anim_state < 3 || text_state < 2) && objection_state == 0)
return;
- //MS#
- //deskmod#
- //pre-emote#
- //character#
- //emote#
- //message#
- //side#
- //sfx-name#
- //emote_modifier#
- //char_id#
- //sfx_delay#
- //objection_modifier#
- //evidence#
- //placeholder#
- //realization#
- //text_color#%
+ // MS#
+ // deskmod#
+ // pre-emote#
+ // character#
+ // emote#
+ // message#
+ // side#
+ // sfx-name#
+ // emote_modifier#
+ // char_id#
+ // sfx_delay#
+ // objection_modifier#
+ // evidence#
+ // placeholder#
+ // realization#
+ // text_color#%
// Additionally, in our case:
- //showname#
- //other_charid#
- //self_offset#
- //noninterrupting_preanim#%
+ // showname#
+ // other_charid#
+ // self_offset#
+ // noninterrupting_preanim#%
QStringList packet_contents;
@@ -1101,9 +1119,9 @@ void Courtroom::on_chat_return_pressed()
QString f_desk_mod = "chat";
- if (ao_app->desk_mod_enabled)
- {
- f_desk_mod = QString::number(ao_app->get_desk_mod(current_char, current_emote));
+ if (ao_app->desk_mod_enabled) {
+ f_desk_mod =
+ QString::number(ao_app->get_desk_mod(current_char, current_emote));
if (f_desk_mod == "-1")
f_desk_mod = "chat";
}
@@ -1124,26 +1142,22 @@ void Courtroom::on_chat_return_pressed()
int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote);
- //needed or else legacy won't understand what we're saying
- if (objection_state > 0)
- {
- if (ui_pre->isChecked())
- {
+ // needed or else legacy won't understand what we're saying
+ if (objection_state > 0) {
+ if (ui_pre->isChecked()) {
if (f_emote_mod == 5)
f_emote_mod = 6;
else
f_emote_mod = 2;
}
}
- else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked())
- {
+ else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) {
if (f_emote_mod == 0)
f_emote_mod = 1;
else if (f_emote_mod == 5 && ao_app->prezoom_enabled)
f_emote_mod = 4;
}
- else
- {
+ else {
if (f_emote_mod == 1)
f_emote_mod = 0;
else if (f_emote_mod == 4)
@@ -1153,12 +1167,13 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(QString::number(f_emote_mod));
packet_contents.append(QString::number(m_cid));
- packet_contents.append(QString::number(ao_app->get_sfx_delay(current_char, current_emote)));
+ packet_contents.append(
+ QString::number(ao_app->get_sfx_delay(current_char, current_emote)));
QString f_obj_state;
if ((objection_state == 4 && !ao_app->custom_objection_enabled) ||
- (objection_state < 0))
+ (objection_state < 0))
f_obj_state = "0";
else
f_obj_state = QString::number(objection_state);
@@ -1166,16 +1181,15 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(f_obj_state);
if (is_presenting_evidence)
- //the evidence index is shifted by 1 because 0 is no evidence per legacy standards
- //besides, older clients crash if we pass -1
+ // the evidence index is shifted by 1 because 0 is no evidence per legacy
+ // standards besides, older clients crash if we pass -1
packet_contents.append(QString::number(current_evidence + 1));
else
packet_contents.append("0");
QString f_flip;
- if (ao_app->flipping_enabled)
- {
+ if (ao_app->flipping_enabled) {
if (ui_flip->isChecked())
f_flip = "1";
else
@@ -1200,38 +1214,32 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(f_text_color);
// If the server we're on supports CCCC stuff, we should use it!
- if (ao_app->cccc_ic_support_enabled)
- {
- // If there is a showname entered, use that -- else, just send an empty packet-part.
- if (!ui_ic_chat_name->text().isEmpty())
- {
+ if (ao_app->cccc_ic_support_enabled) {
+ // If there is a showname entered, use that -- else, just send an empty
+ // packet-part.
+ if (!ui_ic_chat_name->text().isEmpty()) {
packet_contents.append(ui_ic_chat_name->text());
}
- else
- {
+ else {
packet_contents.append("");
}
- // Similarly, we send over whom we're paired with, unless we have chosen ourselves.
- // Or a charid of -1 or lower, through some means.
- if (other_charid > -1 && other_charid != m_cid)
- {
+ // Similarly, we send over whom we're paired with, unless we have chosen
+ // ourselves. Or a charid of -1 or lower, through some means.
+ if (other_charid > -1 && other_charid != m_cid) {
packet_contents.append(QString::number(other_charid));
packet_contents.append(QString::number(offset_with_pair));
}
- else
- {
+ else {
packet_contents.append("-1");
packet_contents.append("0");
}
// Finally, we send over if we want our pres to not interrupt.
- if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked())
- {
+ if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) {
packet_contents.append("1");
}
- else
- {
+ else {
packet_contents.append("0");
}
}
@@ -1247,21 +1255,19 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
if (p_contents->size() < 15)
return;
- for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string)
- {
- //m_chatmessage[n_string] = p_contents->at(n_string);
+ for (int n_string = 0; n_string < chatmessage_size; ++n_string) {
+ // m_chatmessage[n_string] = p_contents->at(n_string);
- // Note that we have added stuff that vanilla clients and servers simply won't send.
- // So now, we have to check if the thing we want even exists amongst the packet's content.
- // We also have to check if the server even supports CCCC's IC features, or if it's just japing us.
- // Also, don't forget! A size 15 message will have indices from 0 to 14.
+ // Note that we have added stuff that vanilla clients and servers simply
+ // won't send. So now, we have to check if the thing we want even exists
+ // amongst the packet's content. We also have to check if the server even
+ // supports CCCC's IC features, or if it's just japing us. Also, don't
+ // forget! A size 15 message will have indices from 0 to 14.
if (n_string < p_contents->size() &&
- (n_string < 15 || ao_app->cccc_ic_support_enabled))
- {
+ (n_string < 15 || ao_app->cccc_ic_support_enabled)) {
m_chatmessage[n_string] = p_contents->at(n_string);
}
- else
- {
+ else {
m_chatmessage[n_string] = "";
}
}
@@ -1275,16 +1281,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
return;
QString f_showname;
- if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
- {
- f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
+ if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) {
+ f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
}
- else
- {
- f_showname = m_chatmessage[SHOWNAME];
+ else {
+ f_showname = m_chatmessage[SHOWNAME];
}
-
QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n';
if (f_message == previous_ic_message)
@@ -1297,10 +1300,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
- chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
+ chatmessage_is_empty =
+ m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
- if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid)
- {
+ if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() &&
+ m_chatmessage[CHAR_ID].toInt() == m_cid) {
ui_ic_chat_message->clear();
objection_state = 0;
realization_state = 0;
@@ -1314,11 +1318,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_evidence_present->set_image("present_disabled.png");
}
- chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false);
+ chatlogpiece *temp =
+ new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name),
+ f_showname, ": " + m_chatmessage[MESSAGE], false);
ic_chatlog_history.append(*temp);
- while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0)
- {
+ while (ic_chatlog_history.size() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
ic_chatlog_history.removeFirst();
}
@@ -1330,11 +1336,9 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
QString f_char = m_chatmessage[CHAR_NAME];
QString f_custom_theme = ao_app->get_char_shouts(f_char);
- //if an objection is used
- if (objection_mod <= 4 && objection_mod >= 1)
- {
- switch (objection_mod)
- {
+ // if an objection is used
+ if (objection_mod <= 4 && objection_mod >= 1) {
+ switch (objection_mod) {
case 1:
ui_vp_objection->play("holdit", f_char, f_custom_theme);
objection_player->play("holdit.wav", f_char, f_custom_theme);
@@ -1347,7 +1351,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_vp_objection->play("takethat", f_char, f_custom_theme);
objection_player->play("takethat.wav", f_char, f_custom_theme);
break;
- //case 4 is AO2 only
+ // case 4 is AO2 only
case 4:
ui_vp_objection->play("custom", f_char, f_custom_theme);
objection_player->play("custom.wav", f_char, f_custom_theme);
@@ -1365,27 +1369,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
handle_chatmessage_2();
}
-void Courtroom::objection_done()
-{
- handle_chatmessage_2();
-}
+void Courtroom::objection_done() { handle_chatmessage_2(); }
void Courtroom::handle_chatmessage_2()
{
ui_vp_speedlines->stop();
ui_vp_player_char->stop();
- if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
- {
- QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
+ if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) {
+ QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
- QString f_showname = ao_app->get_showname(real_name);
+ QString f_showname = ao_app->get_showname(real_name);
- ui_vp_showname->setText(f_showname);
+ ui_vp_showname->setText(f_showname);
}
- else
- {
- ui_vp_showname->setText(m_chatmessage[SHOWNAME]);
+ else {
+ ui_vp_showname->setText(m_chatmessage[SHOWNAME]);
}
ui_vp_message->clear();
@@ -1395,36 +1394,32 @@ void Courtroom::handle_chatmessage_2()
if (chatbox == "")
ui_vp_chatbox->set_image("chatmed.png");
- else
- {
- QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png";
+ else {
+ QString chatbox_path =
+ ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png";
ui_vp_chatbox->set_image_from_path(chatbox_path);
}
- ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }");
+ ui_vp_showname->setStyleSheet(
+ "QLabel { color : " + get_text_color("_showname").name() + "; }");
set_scene();
set_text_color();
// Check if the message needs to be centered.
QString f_message = m_chatmessage[MESSAGE];
- if (f_message.size() >= 2)
- {
- if (f_message.startsWith("~~"))
- {
- message_is_centered = true;
- }
- else
- {
- message_is_centered = false;
- }
+ if (f_message.size() >= 2) {
+ if (f_message.startsWith("~~")) {
+ message_is_centered = true;
+ }
+ else {
+ message_is_centered = false;
+ }
}
- else
- {
- ui_vp_message->setAlignment(Qt::AlignLeft);
+ else {
+ ui_vp_message->setAlignment(Qt::AlignLeft);
}
-
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1)
@@ -1435,98 +1430,91 @@ void Courtroom::handle_chatmessage_2()
QString side = m_chatmessage[SIDE];
// Making the second character appear.
- if (m_chatmessage[OTHER_CHARID].isEmpty())
- {
+ if (m_chatmessage[OTHER_CHARID].isEmpty()) {
// If there is no second character, hide 'em, and center the first.
ui_vp_sideplayer_char->hide();
- ui_vp_sideplayer_char->move(0,0);
+ ui_vp_sideplayer_char->move(0, 0);
- ui_vp_player_char->move(0,0);
+ ui_vp_player_char->move(0, 0);
}
- else
- {
+ else {
bool ok;
int got_other_charid = m_chatmessage[OTHER_CHARID].toInt(&ok);
- if (ok)
- {
- if (got_other_charid > -1)
- {
+ if (ok) {
+ if (got_other_charid > -1) {
// If there is, show them!
ui_vp_sideplayer_char->show();
- // Depending on where we are, we offset the characters, and reorder their stacking.
- if (side == "def")
- {
- // We also move the character down depending on how far the are to the right.
+ // Depending on where we are, we offset the characters, and reorder
+ // their stacking.
+ if (side == "def") {
+ // We also move the character down depending on how far the are to the
+ // right.
int hor_offset = m_chatmessage[SELF_OFFSET].toInt();
int vert_offset = 0;
- if (hor_offset > 0)
- {
+ if (hor_offset > 0) {
vert_offset = hor_offset / 10;
}
- ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100);
+ ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100,
+ ui_viewport->height() * vert_offset / 100);
// We do the same with the second character.
int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt();
int vert2_offset = 0;
- if (hor2_offset > 0)
- {
+ if (hor2_offset > 0) {
vert2_offset = hor2_offset / 10;
}
- ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100);
+ ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100,
+ ui_viewport->height() * vert2_offset /
+ 100);
// Finally, we reorder them based on who is more to the left.
// The person more to the left is more in the front.
- if (hor2_offset >= hor_offset)
- {
+ if (hor2_offset >= hor_offset) {
ui_vp_sideplayer_char->raise();
ui_vp_player_char->raise();
}
- else
- {
+ else {
ui_vp_player_char->raise();
ui_vp_sideplayer_char->raise();
}
ui_vp_desk->raise();
ui_vp_legacy_desk->raise();
}
- else if (side == "pro")
- {
+ else if (side == "pro") {
// Almost the same thing happens here, but in reverse.
int hor_offset = m_chatmessage[SELF_OFFSET].toInt();
int vert_offset = 0;
- if (hor_offset < 0)
- {
+ if (hor_offset < 0) {
// We don't want to RAISE the char off the floor.
vert_offset = -1 * hor_offset / 10;
}
- ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100);
+ ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100,
+ ui_viewport->height() * vert_offset / 100);
// We do the same with the second character.
int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt();
int vert2_offset = 0;
- if (hor2_offset < 0)
- {
+ if (hor2_offset < 0) {
vert2_offset = -1 * hor2_offset / 10;
}
- ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100);
+ ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100,
+ ui_viewport->height() * vert2_offset /
+ 100);
// Finally, we reorder them based on who is more to the right.
- if (hor2_offset <= hor_offset)
- {
+ if (hor2_offset <= hor_offset) {
ui_vp_sideplayer_char->raise();
ui_vp_player_char->raise();
}
- else
- {
+ else {
ui_vp_player_char->raise();
ui_vp_sideplayer_char->raise();
}
ui_vp_desk->raise();
ui_vp_legacy_desk->raise();
}
- else
- {
+ else {
// In every other case, the person more to the left is on top.
// These cases also don't move the characters down.
int hor_offset = m_chatmessage[SELF_OFFSET].toInt();
@@ -1534,17 +1522,16 @@ void Courtroom::handle_chatmessage_2()
// We do the same with the second character.
int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt();
- ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, 0);
+ ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100,
+ 0);
// Finally, we reorder them based on who is more to the left.
// The person more to the left is more in the front.
- if (hor2_offset >= hor_offset)
- {
+ if (hor2_offset >= hor_offset) {
ui_vp_sideplayer_char->raise();
ui_vp_player_char->raise();
}
- else
- {
+ else {
ui_vp_player_char->raise();
ui_vp_sideplayer_char->raise();
}
@@ -1556,26 +1543,28 @@ void Courtroom::handle_chatmessage_2()
ui_vp_sideplayer_char->set_flipped(true);
else
ui_vp_sideplayer_char->set_flipped(false);
- ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]);
+ ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME],
+ m_chatmessage[OTHER_EMOTE]);
}
- else
- {
- // If the server understands other characters, but there
- // really is no second character, hide 'em, and center the first.
- ui_vp_sideplayer_char->hide();
- ui_vp_sideplayer_char->move(0,0);
+ else {
+ // If the server understands other characters, but there
+ // really is no second character, hide 'em, and center the first.
+ ui_vp_sideplayer_char->hide();
+ ui_vp_sideplayer_char->move(0, 0);
- ui_vp_player_char->move(0,0);
+ ui_vp_player_char->move(0, 0);
}
}
}
- switch (emote_mod)
- {
- case 1: case 2: case 6:
+ switch (emote_mod) {
+ case 1:
+ case 2:
+ case 6:
play_preanim(false);
break;
- case 0: case 5:
+ case 0:
+ case 5:
if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0)
handle_chatmessage_3();
else
@@ -1593,51 +1582,45 @@ void Courtroom::handle_chatmessage_3()
int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt();
QString f_side = m_chatmessage[SIDE];
- if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size())
- {
- //shifted by 1 because 0 is no evidence per legacy standards
+ if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) {
+ // shifted by 1 because 0 is no evidence per legacy standards
QString f_image = local_evidence_list.at(f_evi_id - 1).image;
- //def jud and hlp should display the evidence icon on the RIGHT side
- bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud" || f_side == "jur");
- ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value());
+ // def jud and hlp should display the evidence icon on the RIGHT side
+ bool is_left_side = !(f_side == "def" || f_side == "hlp" ||
+ f_side == "jud" || f_side == "jur");
+ ui_vp_evidence_display->show_evidence(f_image, is_left_side,
+ ui_sfx_slider->value());
}
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
QString side = m_chatmessage[SIDE];
- if (emote_mod == 5 ||
- emote_mod == 6)
- {
+ if (emote_mod == 5 || emote_mod == 6) {
ui_vp_desk->hide();
ui_vp_legacy_desk->hide();
// Since we're zooming, hide the second character, and centre the first.
- ui_vp_sideplayer_char->hide();
- ui_vp_player_char->move(0,0);
+ ui_vp_sideplayer_char->hide();
+ ui_vp_player_char->move(0, 0);
- if (side == "pro" ||
- side == "hlp" ||
- side == "wit")
+ if (side == "pro" || side == "hlp" || side == "wit")
ui_vp_speedlines->play("prosecution_speedlines");
else
ui_vp_speedlines->play("defense_speedlines");
-
}
int f_anim_state = 0;
- //BLUE is from an enum in datatypes.h
+ // BLUE is from an enum in datatypes.h
bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE;
- if (!text_is_blue && text_state == 1)
- {
- //talking
+ if (!text_is_blue && text_state == 1) {
+ // talking
f_anim_state = 2;
entire_message_is_blue = false;
}
- else
- {
- //idle
+ else {
+ // idle
f_anim_state = 3;
entire_message_is_blue = true;
}
@@ -1653,8 +1636,7 @@ void Courtroom::handle_chatmessage_3()
ui_vp_player_char->play_talking(f_char, f_emote);
anim_state = 2;
}
- else
- {
+ else {
ui_vp_player_char->play_idle(f_char, f_emote);
anim_state = 3;
}
@@ -1662,31 +1644,27 @@ void Courtroom::handle_chatmessage_3()
QString f_message = m_chatmessage[MESSAGE];
QStringList call_words = ao_app->get_call_words();
- for (QString word : call_words)
- {
- if (f_message.contains(word, Qt::CaseInsensitive))
- {
+ for (QString word : call_words) {
+ if (f_message.contains(word, Qt::CaseInsensitive)) {
modcall_player->play(ao_app->get_sfx("word_call"));
ao_app->alert(this);
break;
}
}
-
}
QString Courtroom::filter_ic_text(QString p_text)
{
// Get rid of centering.
- if(p_text.startsWith(": ~~"))
- {
- // Don't forget, the p_text part actually everything after the name!
- // Hence why we check for ': ~~'.
+ if (p_text.startsWith(": ~~")) {
+ // Don't forget, the p_text part actually everything after the name!
+ // Hence why we check for ': ~~'.
- // Let's remove those two tildes, then.
- // : _ ~ ~
- // 0 1 2 3
- p_text.remove(2,2);
+ // Let's remove those two tildes, then.
+ // : _ ~ ~
+ // 0 1 2 3
+ p_text.remove(2, 2);
}
// Get rid of the inline-colouring.
@@ -1696,123 +1674,101 @@ QString Courtroom::filter_ic_text(QString p_text)
bool ic_next_is_not_special = false;
QString f_character = p_text.at(trick_check_pos);
std::stack<INLINE_COLOURS> ic_colour_stack;
- while (trick_check_pos < p_text.size())
- {
- f_character = p_text.at(trick_check_pos);
-
- // Escape character.
- if (f_character == "\\" and !ic_next_is_not_special)
- {
- ic_next_is_not_special = true;
- p_text.remove(trick_check_pos,1);
- }
+ while (trick_check_pos < p_text.size()) {
+ f_character = p_text.at(trick_check_pos);
- // Text speed modifier.
- else if (f_character == "{" and !ic_next_is_not_special)
- {
- p_text.remove(trick_check_pos,1);
- }
- else if (f_character == "}" and !ic_next_is_not_special)
- {
- p_text.remove(trick_check_pos,1);
- }
+ // Escape character.
+ if (f_character == "\\" and !ic_next_is_not_special) {
+ ic_next_is_not_special = true;
+ p_text.remove(trick_check_pos, 1);
+ }
- // Orange inline colourisation.
- else if (f_character == "|" and !ic_next_is_not_special)
- {
- if (!ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_ORANGE)
- {
- ic_colour_stack.pop();
- p_text.remove(trick_check_pos,1);
- }
- else
- {
- ic_colour_stack.push(INLINE_ORANGE);
- p_text.remove(trick_check_pos,1);
- }
- }
- else
- {
- ic_colour_stack.push(INLINE_ORANGE);
- p_text.remove(trick_check_pos,1);
- }
+ // Text speed modifier.
+ else if (f_character == "{" and !ic_next_is_not_special) {
+ p_text.remove(trick_check_pos, 1);
+ }
+ else if (f_character == "}" and !ic_next_is_not_special) {
+ p_text.remove(trick_check_pos, 1);
+ }
+
+ // Orange inline colourisation.
+ else if (f_character == "|" and !ic_next_is_not_special) {
+ if (!ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_ORANGE) {
+ ic_colour_stack.pop();
+ p_text.remove(trick_check_pos, 1);
+ }
+ else {
+ ic_colour_stack.push(INLINE_ORANGE);
+ p_text.remove(trick_check_pos, 1);
+ }
+ }
+ else {
+ ic_colour_stack.push(INLINE_ORANGE);
+ p_text.remove(trick_check_pos, 1);
}
+ }
- // Blue inline colourisation.
- else if (f_character == "(" and !ic_next_is_not_special)
- {
- ic_colour_stack.push(INLINE_BLUE);
- trick_check_pos++;
+ // Blue inline colourisation.
+ else if (f_character == "(" and !ic_next_is_not_special) {
+ ic_colour_stack.push(INLINE_BLUE);
+ trick_check_pos++;
+ }
+ else if (f_character == ")" and !ic_next_is_not_special and
+ !ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_BLUE) {
+ ic_colour_stack.pop();
+ trick_check_pos++;
}
- else if (f_character == ")" and !ic_next_is_not_special
- and !ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_BLUE)
- {
- ic_colour_stack.pop();
- trick_check_pos++;
- }
- else
- {
- ic_next_is_not_special = true;
- }
+ else {
+ ic_next_is_not_special = true;
}
+ }
- // Grey inline colourisation.
- else if (f_character == "[" and !ic_next_is_not_special)
- {
- ic_colour_stack.push(INLINE_GREY);
- trick_check_pos++;
+ // Grey inline colourisation.
+ else if (f_character == "[" and !ic_next_is_not_special) {
+ ic_colour_stack.push(INLINE_GREY);
+ trick_check_pos++;
+ }
+ else if (f_character == "]" and !ic_next_is_not_special and
+ !ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_GREY) {
+ ic_colour_stack.pop();
+ trick_check_pos++;
}
- else if (f_character == "]" and !ic_next_is_not_special
- and !ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_GREY)
- {
- ic_colour_stack.pop();
- trick_check_pos++;
- }
- else
- {
- ic_next_is_not_special = true;
- }
+ else {
+ ic_next_is_not_special = true;
}
+ }
- // Green inline colourisation.
- else if (f_character == "`" and !ic_next_is_not_special)
- {
- if (!ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_GREEN)
- {
- ic_colour_stack.pop();
- p_text.remove(trick_check_pos,1);
- }
- else
- {
- ic_colour_stack.push(INLINE_GREEN);
- p_text.remove(trick_check_pos,1);
- }
- }
- else
- {
- ic_colour_stack.push(INLINE_GREEN);
- p_text.remove(trick_check_pos,1);
- }
+ // Green inline colourisation.
+ else if (f_character == "`" and !ic_next_is_not_special) {
+ if (!ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_GREEN) {
+ ic_colour_stack.pop();
+ p_text.remove(trick_check_pos, 1);
+ }
+ else {
+ ic_colour_stack.push(INLINE_GREEN);
+ p_text.remove(trick_check_pos, 1);
+ }
}
- else
- {
- trick_check_pos++;
- ic_next_is_not_special = false;
+ else {
+ ic_colour_stack.push(INLINE_GREEN);
+ p_text.remove(trick_check_pos, 1);
}
+ }
+ else {
+ trick_check_pos++;
+ ic_next_is_not_special = false;
+ }
}
return p_text;
}
-void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange)
+void Courtroom::append_ic_text(QString p_text, QString p_name,
+ bool is_songchange)
{
QTextCharFormat bold;
QTextCharFormat normal;
@@ -1826,95 +1782,94 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang
if (!is_songchange)
p_text = filter_ic_text(p_text);
- if (log_goes_downwards)
- {
- const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
+ if (log_goes_downwards) {
+ const bool is_scrolled_down =
+ old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
- ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
- if (!first_message_sent)
- {
- ui_ic_chatlog->textCursor().insertText(p_name, bold);
- first_message_sent = true;
- }
- else
- {
- ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold);
- }
+ if (!first_message_sent) {
+ ui_ic_chatlog->textCursor().insertText(p_name, bold);
+ first_message_sent = true;
+ }
+ else {
+ ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold);
+ }
- if (is_songchange)
- {
- ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
- ui_ic_chatlog->textCursor().insertText(p_text + ".", italics);
- }
- else
- {
- ui_ic_chatlog->textCursor().insertText(p_text, normal);
- }
+ if (is_songchange) {
+ ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
+ ui_ic_chatlog->textCursor().insertText(p_text + ".", italics);
+ }
+ else {
+ ui_ic_chatlog->textCursor().insertText(p_text, normal);
+ }
- // If we got too many blocks in the current log, delete some from the top.
- while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
- ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
- ui_ic_chatlog->textCursor().removeSelectedText();
- ui_ic_chatlog->textCursor().deleteChar();
- //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks;
- }
+ // If we got too many blocks in the current log, delete some from the top.
+ while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
+ ui_ic_chatlog->textCursor().removeSelectedText();
+ ui_ic_chatlog->textCursor().deleteChar();
+ // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " <<
+ // log_maximum_blocks;
+ }
- if (old_cursor.hasSelection() || !is_scrolled_down)
- {
- // The user has selected text or scrolled away from the bottom: maintain position.
- ui_ic_chatlog->setTextCursor(old_cursor);
- ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
- ui_ic_chatlog->moveCursor(QTextCursor::End);
- ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum());
- }
+ if (old_cursor.hasSelection() || !is_scrolled_down) {
+ // The user has selected text or scrolled away from the bottom: maintain
+ // position.
+ ui_ic_chatlog->setTextCursor(old_cursor);
+ ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
+ }
+ else {
+ // The user hasn't selected any text and the scrollbar is at the bottom:
+ // scroll to the bottom.
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->verticalScrollBar()->setValue(
+ ui_ic_chatlog->verticalScrollBar()->maximum());
+ }
}
- else
- {
- const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum();
+ else {
+ const bool is_scrolled_up =
+ old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum();
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
- ui_ic_chatlog->textCursor().insertText(p_name, bold);
+ ui_ic_chatlog->textCursor().insertText(p_name, bold);
- if (is_songchange)
- {
- ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
- ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics);
- }
- else
- {
- ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
- }
+ if (is_songchange) {
+ ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
+ ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics);
+ }
+ else {
+ ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
+ }
- // If we got too many blocks in the current log, delete some from the bottom.
- while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::End);
- ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
- ui_ic_chatlog->textCursor().removeSelectedText();
- ui_ic_chatlog->textCursor().deletePreviousChar();
- //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks;
- }
+ // If we got too many blocks in the current log, delete some from the
+ // bottom.
+ while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
+ ui_ic_chatlog->textCursor().removeSelectedText();
+ ui_ic_chatlog->textCursor().deletePreviousChar();
+ // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " <<
+ // log_maximum_blocks;
+ }
- if (old_cursor.hasSelection() || !is_scrolled_up)
- {
- // The user has selected text or scrolled away from the top: maintain position.
- ui_ic_chatlog->setTextCursor(old_cursor);
- ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
- ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum());
- }
+ if (old_cursor.hasSelection() || !is_scrolled_up) {
+ // The user has selected text or scrolled away from the top: maintain
+ // position.
+ ui_ic_chatlog->setTextCursor(old_cursor);
+ ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
+ }
+ else {
+ // The user hasn't selected any text and the scrollbar is at the top:
+ // scroll to the top.
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->verticalScrollBar()->setValue(
+ ui_ic_chatlog->verticalScrollBar()->minimum());
+ }
}
}
@@ -1923,7 +1878,8 @@ void Courtroom::play_preanim(bool noninterrupting)
QString f_char = m_chatmessage[CHAR_NAME];
QString f_preanim = m_chatmessage[PRE_EMOTE];
- //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time
+ // all time values in char.inis are multiplied by a constant(time_mod) to get
+ // the actual time
int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim);
int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60;
@@ -1936,10 +1892,9 @@ void Courtroom::play_preanim(bool noninterrupting)
preanim_duration = ao2_duration;
sfx_delay_timer->start(sfx_delay);
- QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
- if (!file_exists(anim_to_find) ||
- preanim_duration < 0)
- {
+ QString anim_to_find =
+ ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
+ if (!file_exists(anim_to_find) || preanim_duration < 0) {
if (noninterrupting)
anim_state = 4;
else
@@ -1969,19 +1924,16 @@ void Courtroom::preanim_done()
handle_chatmessage_3();
}
-void Courtroom::realization_done()
-{
- ui_vp_realization->hide();
-}
+void Courtroom::realization_done() { ui_vp_realization->hide(); }
void Courtroom::start_chat_ticking()
{
- //we need to ensure that the text isn't already ticking because this function can be called by two logic paths
+ // we need to ensure that the text isn't already ticking because this function
+ // can be called by two logic paths
if (text_state != 0)
return;
- if (m_chatmessage[REALIZATION] == "1")
- {
+ if (m_chatmessage[REALIZATION] == "1") {
realization_timer->start(60);
ui_vp_realization->show();
sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME]));
@@ -1991,18 +1943,16 @@ void Courtroom::start_chat_ticking()
set_text_color();
rainbow_counter = 0;
- if (chatmessage_is_empty)
- {
- //since the message is empty, it's technically done ticking
+ if (chatmessage_is_empty) {
+ // since the message is empty, it's technically done ticking
text_state = 2;
return;
}
// At this point, we'd do well to clear the inline colour stack.
// This stops it from flowing into next messages.
- while (!inline_colour_stack.empty())
- {
- inline_colour_stack.pop();
+ while (!inline_colour_stack.empty()) {
+ inline_colour_stack.pop();
}
ui_vp_chatbox->show();
@@ -2010,8 +1960,8 @@ void Courtroom::start_chat_ticking()
tick_pos = 0;
blip_pos = 0;
- // Just in case we somehow got inline blue text left over from a previous message,
- // let's set it to false.
+ // Just in case we somehow got inline blue text left over from a previous
+ // message, let's set it to false.
inline_blue_depth = 0;
// At the start of every new message, we set the text speed to the default.
@@ -2022,14 +1972,14 @@ void Courtroom::start_chat_ticking()
blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender));
- //means text is currently ticking
+ // means text is currently ticking
text_state = 1;
}
void Courtroom::chat_tick()
{
- //note: this is called fairly often(every 60 ms when char is talking)
- //do not perform heavy operations here
+ // note: this is called fairly often(every 60 ms when char is talking)
+ // do not perform heavy operations here
QString f_message = m_chatmessage[MESSAGE];
f_message.remove(0, tick_pos);
@@ -2042,23 +1992,20 @@ void Courtroom::chat_tick()
// If previously, we have detected that the message is centered, now
// is the time to remove those two tildes at the start.
- if (message_is_centered)
- {
- f_message.remove(0,2);
+ if (message_is_centered) {
+ f_message.remove(0, 2);
}
- if (f_message.size() == 0)
- {
+ if (f_message.size() == 0) {
text_state = 2;
- if (anim_state != 4)
- {
+ if (anim_state != 4) {
anim_state = 3;
- ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]);
+ ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME],
+ m_chatmessage[EMOTE]);
}
}
- else
- {
+ else {
QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message);
QString f_character;
int f_char_length;
@@ -2073,174 +2020,163 @@ void Courtroom::chat_tick()
f_char_length = f_character.length();
f_character = f_character.toHtmlEscaped();
-
if (f_character == " ")
ui_vp_message->insertPlainText(" ");
// Escape character.
- else if (f_character == "\\" and !next_character_is_not_special)
- {
- next_character_is_not_special = true;
- formatting_char = true;
+ else if (f_character == "\\" and !next_character_is_not_special) {
+ next_character_is_not_special = true;
+ formatting_char = true;
}
// Text speed modifier.
- else if (f_character == "{" and !next_character_is_not_special)
- {
- // ++, because it INCREASES delay!
- current_display_speed++;
- formatting_char = true;
+ else if (f_character == "{" and !next_character_is_not_special) {
+ // ++, because it INCREASES delay!
+ current_display_speed++;
+ formatting_char = true;
}
- else if (f_character == "}" and !next_character_is_not_special)
- {
- current_display_speed--;
- formatting_char = true;
+ else if (f_character == "}" and !next_character_is_not_special) {
+ current_display_speed--;
+ formatting_char = true;
}
// Orange inline colourisation.
- else if (f_character == "|" and !next_character_is_not_special)
- {
- if (!inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_ORANGE)
- {
- inline_colour_stack.pop();
- }
- else
- {
- inline_colour_stack.push(INLINE_ORANGE);
- }
+ else if (f_character == "|" and !next_character_is_not_special) {
+ if (!inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_ORANGE) {
+ inline_colour_stack.pop();
}
- else
- {
- inline_colour_stack.push(INLINE_ORANGE);
+ else {
+ inline_colour_stack.push(INLINE_ORANGE);
}
- formatting_char = true;
+ }
+ else {
+ inline_colour_stack.push(INLINE_ORANGE);
+ }
+ formatting_char = true;
}
// Blue inline colourisation.
- else if (f_character == "(" and !next_character_is_not_special)
- {
- inline_colour_stack.push(INLINE_BLUE);
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(BLUE)).name() +"\">" + f_character + "</font>");
-
- // Increase how deep we are in inline blues.
- inline_blue_depth++;
-
- // Here, we check if the entire message is blue.
- // If it isn't, we stop talking.
- if (!entire_message_is_blue and anim_state != 4)
- {
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_emote = m_chatmessage[EMOTE];
- ui_vp_player_char->play_idle(f_char, f_emote);
- }
+ else if (f_character == "(" and !next_character_is_not_special) {
+ inline_colour_stack.push(INLINE_BLUE);
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color(QString::number(BLUE)).name() +
+ "\">" + f_character + "</font>");
+
+ // Increase how deep we are in inline blues.
+ inline_blue_depth++;
+
+ // Here, we check if the entire message is blue.
+ // If it isn't, we stop talking.
+ if (!entire_message_is_blue and anim_state != 4) {
+ QString f_char = m_chatmessage[CHAR_NAME];
+ QString f_emote = m_chatmessage[EMOTE];
+ ui_vp_player_char->play_idle(f_char, f_emote);
+ }
}
- else if (f_character == ")" and !next_character_is_not_special
- and !inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_BLUE)
- {
- inline_colour_stack.pop();
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(BLUE)).name() +"\">" + f_character + "</font>");
-
- // Decrease how deep we are in inline blues.
- // Just in case, we do a check if we're above zero, but we should be.
- if (inline_blue_depth > 0)
- {
- inline_blue_depth--;
- // Here, we check if the entire message is blue.
- // If it isn't, we start talking if we have completely climbed out of inline blues.
- if (!entire_message_is_blue)
- {
- // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character.
- if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size()))
- {
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_emote = m_chatmessage[EMOTE];
- ui_vp_player_char->play_talking(f_char, f_emote);
- }
- }
+ else if (f_character == ")" and !next_character_is_not_special and
+ !inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_BLUE) {
+ inline_colour_stack.pop();
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color(QString::number(BLUE)).name() +
+ "\">" + f_character + "</font>");
+
+ // Decrease how deep we are in inline blues.
+ // Just in case, we do a check if we're above zero, but we should be.
+ if (inline_blue_depth > 0) {
+ inline_blue_depth--;
+ // Here, we check if the entire message is blue.
+ // If it isn't, we start talking if we have completely climbed out of
+ // inline blues.
+ if (!entire_message_is_blue) {
+ // We should only go back to talking if we're out of inline blues,
+ // not during a non. int. pre, and not on the last character.
+ if (inline_blue_depth == 0 and anim_state != 4 and
+ !(tick_pos + 1 >= f_message.size())) {
+ QString f_char = m_chatmessage[CHAR_NAME];
+ QString f_emote = m_chatmessage[EMOTE];
+ ui_vp_player_char->play_talking(f_char, f_emote);
}
+ }
}
- else
- {
- next_character_is_not_special = true;
- tick_pos -= f_char_length;
- }
+ }
+ else {
+ next_character_is_not_special = true;
+ tick_pos -= f_char_length;
+ }
}
// Grey inline colourisation.
- else if (f_character == "[" and !next_character_is_not_special)
- {
- inline_colour_stack.push(INLINE_GREY);
- ui_vp_message->insertHtml("<font color=\""+ get_text_color("_inline_grey").name() +"\">" + f_character + "</font>");
- }
- else if (f_character == "]" and !next_character_is_not_special
- and !inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_GREY)
- {
- inline_colour_stack.pop();
- ui_vp_message->insertHtml("<font color=\""+ get_text_color("_inline_grey").name() +"\">" + f_character + "</font>");
- }
- else
- {
- next_character_is_not_special = true;
- tick_pos -= f_char_length;
- }
+ else if (f_character == "[" and !next_character_is_not_special) {
+ inline_colour_stack.push(INLINE_GREY);
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color("_inline_grey").name() + "\">" +
+ f_character + "</font>");
+ }
+ else if (f_character == "]" and !next_character_is_not_special and
+ !inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_GREY) {
+ inline_colour_stack.pop();
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color("_inline_grey").name() +
+ "\">" + f_character + "</font>");
+ }
+ else {
+ next_character_is_not_special = true;
+ tick_pos -= f_char_length;
+ }
}
// Green inline colourisation.
- else if (f_character == "`" and !next_character_is_not_special)
- {
- if (!inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_GREEN)
- {
- inline_colour_stack.pop();
- formatting_char = true;
- }
- else
- {
- inline_colour_stack.push(INLINE_GREEN);
- formatting_char = true;
- }
+ else if (f_character == "`" and !next_character_is_not_special) {
+ if (!inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_GREEN) {
+ inline_colour_stack.pop();
+ formatting_char = true;
}
- else
- {
- inline_colour_stack.push(INLINE_GREEN);
- formatting_char = true;
+ else {
+ inline_colour_stack.push(INLINE_GREEN);
+ formatting_char = true;
}
+ }
+ else {
+ inline_colour_stack.push(INLINE_GREEN);
+ formatting_char = true;
+ }
}
- else
- {
+ else {
next_character_is_not_special = false;
- if (!inline_colour_stack.empty())
- {
- switch (inline_colour_stack.top()) {
- case INLINE_ORANGE:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(ORANGE)).name() +"\">" + f_character + "</font>");
- break;
- case INLINE_BLUE:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(BLUE)).name() +"\">" + f_character + "</font>");
- break;
- case INLINE_GREEN:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(GREEN)).name() +"\">" + f_character + "</font>");
- break;
- case INLINE_GREY:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color("_inline_grey").name() +"\">" + f_character + "</font>");
- break;
- }
+ if (!inline_colour_stack.empty()) {
+ switch (inline_colour_stack.top()) {
+ case INLINE_ORANGE:
+ ui_vp_message->insertHtml(
+ "<font color=\"" +
+ get_text_color(QString::number(ORANGE)).name() + "\">" +
+ f_character + "</font>");
+ break;
+ case INLINE_BLUE:
+ ui_vp_message->insertHtml(
+ "<font color=\"" + get_text_color(QString::number(BLUE)).name() +
+ "\">" + f_character + "</font>");
+ break;
+ case INLINE_GREEN:
+ ui_vp_message->insertHtml(
+ "<font color=\"" + get_text_color(QString::number(GREEN)).name() +
+ "\">" + f_character + "</font>");
+ break;
+ case INLINE_GREY:
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color("_inline_grey").name() +
+ "\">" + f_character + "</font>");
+ break;
+ }
}
- else
- {
- if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW)
- {
+ else {
+ if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) {
QString html_color;
- switch (rainbow_counter)
- {
+ switch (rainbow_counter) {
case 0:
html_color = get_text_color(QString::number(RED)).name();
break;
@@ -2260,33 +2196,30 @@ void Courtroom::chat_tick()
++rainbow_counter;
- ui_vp_message->insertHtml("<font color=\"" + html_color + "\">" + f_character + "</font>");
+ ui_vp_message->insertHtml("<font color=\"" + html_color + "\">" +
+ f_character + "</font>");
}
else
ui_vp_message->insertHtml(f_character);
}
- if (message_is_centered)
- {
- ui_vp_message->setAlignment(Qt::AlignCenter);
+ if (message_is_centered) {
+ ui_vp_message->setAlignment(Qt::AlignCenter);
}
- else
- {
- ui_vp_message->setAlignment(Qt::AlignLeft);
+ else {
+ ui_vp_message->setAlignment(Qt::AlignLeft);
}
}
QScrollBar *scroll = ui_vp_message->verticalScrollBar();
scroll->setValue(scroll->maximum());
- if(blank_blip)
+ if (blank_blip)
qDebug() << "blank_blip found true";
- if (f_character != ' ' || blank_blip)
- {
+ if (f_character != ' ' || blank_blip) {
- if (blip_pos % blip_rate == 0 && !formatting_char)
- {
+ if (blip_pos % blip_rate == 0 && !formatting_char) {
blip_pos = 0;
blip_player->blip_tick();
}
@@ -2296,32 +2229,27 @@ void Courtroom::chat_tick()
tick_pos += f_char_length;
- // Restart the timer, but according to the newly set speeds, if there were any.
- // Keep the speed at bay.
- if (current_display_speed < 0)
- {
- current_display_speed = 0;
+ // Restart the timer, but according to the newly set speeds, if there were
+ // any. Keep the speed at bay.
+ if (current_display_speed < 0) {
+ current_display_speed = 0;
}
- if (current_display_speed > 6)
- {
- current_display_speed = 6;
+ if (current_display_speed > 6) {
+ current_display_speed = 6;
}
- // If we had a formatting char, we shouldn't wait so long again, as it won't appear!
- if (formatting_char)
- {
- chat_tick_timer->start(1);
+ // If we had a formatting char, we shouldn't wait so long again, as it won't
+ // appear!
+ if (formatting_char) {
+ chat_tick_timer->start(1);
}
- else
- {
- chat_tick_timer->start(message_display_speed[current_display_speed]);
+ else {
+ chat_tick_timer->start(message_display_speed[current_display_speed]);
}
-
}
}
-
void Courtroom::show_testimony()
{
if (!testimony_in_progress || m_chatmessage[SIDE] != "wit")
@@ -2357,57 +2285,51 @@ void Courtroom::set_scene()
if (testimony_in_progress)
show_testimony();
- //witness is default if pos is invalid
+ // witness is default if pos is invalid
QString f_background = "witnessempty";
QString f_desk_image = "stand";
QString f_desk_mod = m_chatmessage[DESK_MOD];
QString f_side = m_chatmessage[SIDE];
- if (f_side == "def")
- {
+ if (f_side == "def") {
f_background = "defenseempty";
if (is_ao2_bg)
f_desk_image = "defensedesk";
else
f_desk_image = "bancodefensa";
}
- else if (f_side == "pro")
- {
+ else if (f_side == "pro") {
f_background = "prosecutorempty";
if (is_ao2_bg)
f_desk_image = "prosecutiondesk";
else
f_desk_image = "bancoacusacion";
}
- else if (f_side == "jud")
- {
+ else if (f_side == "jud") {
f_background = "judgestand";
f_desk_image = "judgedesk";
}
- else if (f_side == "hld")
- {
+ else if (f_side == "hld") {
f_background = "helperstand";
f_desk_image = "helperdesk";
}
- else if (f_side == "hlp")
- {
+ else if (f_side == "hlp") {
f_background = "prohelperstand";
f_desk_image = "prohelperdesk";
}
- else if (f_side == "jur" && (file_exists(ao_app->get_background_path("jurystand.png")) ||
- file_exists(ao_app->get_background_path("jurystand.gif"))))
- {
+ else if (f_side == "jur" &&
+ (file_exists(ao_app->get_background_path("jurystand.png")) ||
+ file_exists(ao_app->get_background_path("jurystand.gif")))) {
f_background = "jurystand";
f_desk_image = "jurydesk";
}
- else if (f_side == "sea" && (file_exists(ao_app->get_background_path("seancestand.png")) ||
- file_exists(ao_app->get_background_path("seancestand.gif"))))
- {
+ else if (f_side == "sea" &&
+ (file_exists(ao_app->get_background_path("seancestand.png")) ||
+ file_exists(ao_app->get_background_path("seancestand.gif")))) {
f_background = "seancestand";
f_desk_image = "seancedesk";
}
- else
- {
+ else {
if (is_ao2_bg)
f_desk_image = "stand";
else
@@ -2418,30 +2340,23 @@ void Courtroom::set_scene()
ui_vp_desk->set_image(f_desk_image);
ui_vp_legacy_desk->set_legacy_desk(f_desk_image);
- if (f_desk_mod == "0" || (f_desk_mod != "1" &&
- (f_side == "jud" ||
- f_side == "hld" ||
- f_side == "hlp")))
- {
+ if (f_desk_mod == "0" ||
+ (f_desk_mod != "1" &&
+ (f_side == "jud" || f_side == "hld" || f_side == "hlp"))) {
ui_vp_desk->hide();
ui_vp_legacy_desk->hide();
}
- else if (is_ao2_bg || (f_side == "jud" ||
- f_side == "hld" ||
- f_side == "hlp"))
- {
+ else if (is_ao2_bg ||
+ (f_side == "jud" || f_side == "hld" || f_side == "hlp")) {
ui_vp_legacy_desk->hide();
ui_vp_desk->show();
}
- else
- {
- if (f_side == "wit")
- {
+ else {
+ if (f_side == "wit") {
ui_vp_desk->show();
ui_vp_legacy_desk->hide();
}
- else
- {
+ else {
ui_vp_desk->hide();
ui_vp_legacy_desk->show();
}
@@ -2450,9 +2365,10 @@ void Courtroom::set_scene()
void Courtroom::set_text_color()
{
- QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
+ QColor textcolor = ao_app->get_chat_color(
+ m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
- ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0));
+ ui_vp_message->setTextBackgroundColor(QColor(0, 0, 0, 0));
ui_vp_message->setTextColor(textcolor);
QString style = "background-color: rgba(0, 0, 0, 0);";
@@ -2469,7 +2385,8 @@ void Courtroom::set_text_color()
QColor Courtroom::get_text_color(QString color)
{
- return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME]));
+ return ao_app->get_chat_color(color,
+ ao_app->get_chat(m_chatmessage[CHAR_NAME]));
}
void Courtroom::set_ip_list(QString p_list)
@@ -2486,8 +2403,7 @@ void Courtroom::set_mute(bool p_muted, int p_cid)
if (p_muted)
ui_muted->show();
- else
- {
+ else {
ui_muted->hide();
ui_ic_chat_message->setFocus();
}
@@ -2522,27 +2438,23 @@ void Courtroom::handle_song(QStringList *p_contents)
f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf("."));
int n_char = f_contents.at(1).toInt();
- if (n_char < 0 || n_char >= char_list.size())
- {
+ if (n_char < 0 || n_char >= char_list.size()) {
music_player->play(f_song);
}
- else
- {
+ else {
QString str_char = char_list.at(n_char).name;
QString str_show = char_list.at(n_char).name;
- if (p_contents->length() > 2)
- {
- str_show = p_contents->at(2);
+ if (p_contents->length() > 2) {
+ str_show = p_contents->at(2);
}
- if (!mute_map.value(n_char))
- {
- chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true);
+ if (!mute_map.value(n_char)) {
+ chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true);
ic_chatlog_history.append(*temp);
- while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0)
- {
+ while (ic_chatlog_history.size() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
ic_chatlog_history.removeFirst();
}
@@ -2556,33 +2468,29 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
{
QString sfx_file = "courtroom_sounds.ini";
- //witness testimony
- if (p_wtce == "testimony1")
- {
+ // witness testimony
+ if (p_wtce == "testimony1") {
sfx_player->play(ao_app->get_sfx("witness_testimony"));
ui_vp_wtce->play("witnesstestimony");
testimony_in_progress = true;
show_testimony();
}
- //cross examination
- else if (p_wtce == "testimony2")
- {
+ // cross examination
+ else if (p_wtce == "testimony2") {
sfx_player->play(ao_app->get_sfx("cross_examination"));
ui_vp_wtce->play("crossexamination");
testimony_in_progress = false;
}
- else if (p_wtce == "judgeruling")
- {
- if (variant == 0)
- {
- sfx_player->play(ao_app->get_sfx("not_guilty"));
- ui_vp_wtce->play("notguilty");
- testimony_in_progress = false;
+ else if (p_wtce == "judgeruling") {
+ if (variant == 0) {
+ sfx_player->play(ao_app->get_sfx("not_guilty"));
+ ui_vp_wtce->play("notguilty");
+ testimony_in_progress = false;
}
else if (variant == 1) {
- sfx_player->play(ao_app->get_sfx("guilty"));
- ui_vp_wtce->play("guilty");
- testimony_in_progress = false;
+ sfx_player->play(ao_app->get_sfx("guilty"));
+ ui_vp_wtce->play("guilty");
+ testimony_in_progress = false;
}
}
}
@@ -2592,22 +2500,20 @@ void Courtroom::set_hp_bar(int p_bar, int p_state)
if (p_state < 0 || p_state > 10)
return;
- if (p_bar == 1)
- {
+ if (p_bar == 1) {
ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png");
defense_bar_state = p_state;
}
- else if (p_bar == 2)
- {
- ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png");
+ else if (p_bar == 2) {
+ ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) +
+ ".png");
prosecution_bar_state = p_state;
}
}
void Courtroom::toggle_judge_buttons(bool is_on)
{
- if (is_on)
- {
+ if (is_on) {
ui_witness_testimony->show();
ui_cross_examination->show();
ui_guilty->show();
@@ -2617,8 +2523,7 @@ void Courtroom::toggle_judge_buttons(bool is_on)
ui_prosecution_minus->show();
ui_prosecution_plus->show();
}
- else
- {
+ else {
ui_witness_testimony->hide();
ui_cross_examination->hide();
ui_guilty->hide();
@@ -2633,26 +2538,24 @@ void Courtroom::toggle_judge_buttons(bool is_on)
void Courtroom::mod_called(QString p_ip)
{
ui_server_chatlog->append(p_ip);
- if (ui_guard->isChecked())
- {
+ if (ui_guard->isChecked()) {
modcall_player->play(ao_app->get_sfx("mod_call"));
ao_app->alert(this);
}
}
-void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur,
+ bool steno)
{
- if (ui_casing->isChecked())
- {
+ if (ui_casing->isChecked()) {
ui_server_chatlog->append(msg);
if ((ao_app->get_casing_defence_enabled() && def) ||
(ao_app->get_casing_prosecution_enabled() && pro) ||
(ao_app->get_casing_judge_enabled() && jud) ||
(ao_app->get_casing_juror_enabled() && jur) ||
- (ao_app->get_casing_steno_enabled() && steno))
- {
- modcall_player->play(ao_app->get_sfx("case_call"));
- ao_app->alert(this);
+ (ao_app->get_casing_steno_enabled() && steno)) {
+ modcall_player->play(ao_app->get_sfx("case_call"));
+ ao_app->alert(this);
}
}
}
@@ -2664,104 +2567,100 @@ void Courtroom::on_ooc_return_pressed()
if (ooc_message == "" || ui_ooc_chat_name->text() == "")
return;
- if (ooc_message.startsWith("/pos"))
- {
- if (ooc_message == "/pos jud")
- {
+ if (ooc_message.startsWith("/pos")) {
+ if (ooc_message == "/pos jud") {
toggle_judge_buttons(true);
}
- else
- {
+ else {
toggle_judge_buttons(false);
}
}
- else if (ooc_message.startsWith("/login"))
- {
+ else if (ooc_message.startsWith("/login")) {
ui_guard->show();
- append_server_chatmessage("CLIENT", "You were granted the Guard button.", "1");
+ append_server_chatmessage("CLIENT", "You were granted the Guard button.",
+ "1");
}
- else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended)
- {
- //ui_text_color->addItem("Rainbow");
+ else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled &&
+ !rainbow_appended) {
+ // ui_text_color->addItem("Rainbow");
ui_ooc_chat_message->clear();
- //rainbow_appended = true;
- append_server_chatmessage("CLIENT", "This does nohing, but there you go.", "1");
+ // rainbow_appended = true;
+ append_server_chatmessage("CLIENT", "This does nohing, but there you go.",
+ "1");
return;
}
- else if (ooc_message.startsWith("/settings"))
- {
+ else if (ooc_message.startsWith("/settings")) {
ui_ooc_chat_message->clear();
ao_app->call_settings_menu();
append_server_chatmessage("CLIENT", "You opened the settings menu.", "1");
return;
}
- else if (ooc_message.startsWith("/pair"))
- {
+ else if (ooc_message.startsWith("/pair")) {
ui_ooc_chat_message->clear();
- ooc_message.remove(0,6);
-
+ ooc_message.remove(0, 6);
+
bool ok;
int whom = ooc_message.toInt(&ok);
- if (ok)
- {
- if (whom > -1)
- {
+ if (ok) {
+ if (whom > -1) {
other_charid = whom;
QString msg = "You will now pair up with ";
msg.append(char_list.at(whom).name);
msg.append(" if they also choose your character in return.");
append_server_chatmessage("CLIENT", msg, "1");
}
- else
- {
+ else {
other_charid = -1;
- append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1");
+ append_server_chatmessage("CLIENT",
+ "You are no longer paired with anyone.", "1");
}
}
- else
- {
- append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.", "1");
+ else {
+ append_server_chatmessage("CLIENT",
+ "Are you sure you typed that well? The char ID "
+ "could not be recognised.",
+ "1");
}
return;
}
- else if (ooc_message.startsWith("/offset"))
- {
+ else if (ooc_message.startsWith("/offset")) {
ui_ooc_chat_message->clear();
- ooc_message.remove(0,8);
-
+ ooc_message.remove(0, 8);
+
bool ok;
int off = ooc_message.toInt(&ok);
- if (ok)
- {
- if (off >= -100 && off <= 100)
- {
+ if (ok) {
+ if (off >= -100 && off <= 100) {
offset_with_pair = off;
QString msg = "You have set your offset to ";
msg.append(QString::number(off));
msg.append("%.");
append_server_chatmessage("CLIENT", msg, "1");
}
- else
- {
- append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!", "1");
+ else {
+ append_server_chatmessage(
+ "CLIENT", "Your offset must be between -100% and 100%!", "1");
}
}
- else
- {
- append_server_chatmessage("CLIENT", "That offset does not look like one.", "1");
+ else {
+ append_server_chatmessage("CLIENT", "That offset does not look like one.",
+ "1");
}
return;
}
- else if (ooc_message.startsWith("/switch_am"))
- {
- append_server_chatmessage("CLIENT", "You switched your music and area list.", "1");
- on_switch_area_music_clicked();
- ui_ooc_chat_message->clear();
- return;
+ else if (ooc_message.startsWith("/switch_am")) {
+ append_server_chatmessage("CLIENT",
+ "You switched your music and area list.", "1");
+ on_switch_area_music_clicked();
+ ui_ooc_chat_message->clear();
+ return;
}
- else if (ooc_message.startsWith("/enable_blocks"))
- {
- append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1");
+ else if (ooc_message.startsWith("/enable_blocks")) {
+ append_server_chatmessage(
+ "CLIENT",
+ "You have forcefully enabled features that the server may not support. "
+ "You may not be able to talk IC, or worse, because of this.",
+ "1");
ao_app->cccc_ic_support_enabled = true;
ao_app->arup_enabled = true;
ao_app->modcall_reason_enabled = true;
@@ -2769,23 +2668,24 @@ void Courtroom::on_ooc_return_pressed()
ui_ooc_chat_message->clear();
return;
}
- else if (ooc_message.startsWith("/non_int_pre"))
- {
+ else if (ooc_message.startsWith("/non_int_pre")) {
if (ui_pre_non_interrupt->isChecked())
- append_server_chatmessage("CLIENT", "Your pre-animations interrupt again.", "1");
+ append_server_chatmessage("CLIENT",
+ "Your pre-animations interrupt again.", "1");
else
- append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.", "1");
+ append_server_chatmessage(
+ "CLIENT", "Your pre-animations will not interrupt text.", "1");
ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked());
ui_ooc_chat_message->clear();
return;
}
- else if (ooc_message.startsWith("/save_chatlog"))
- {
+ else if (ooc_message.startsWith("/save_chatlog")) {
QFile file("chatlog.txt");
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
- {
- append_server_chatmessage("CLIENT", "Couldn't open chatlog.txt to write into.", "1");
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text |
+ QIODevice::Truncate)) {
+ append_server_chatmessage(
+ "CLIENT", "Couldn't open chatlog.txt to write into.", "1");
ui_ooc_chat_message->clear();
return;
}
@@ -2793,8 +2693,8 @@ void Courtroom::on_ooc_return_pressed()
QTextStream out(&file);
foreach (chatlogpiece item, ic_chatlog_history) {
- out << item.get_full() << '\n';
- }
+ out << item.get_full() << '\n';
+ }
file.close();
@@ -2802,39 +2702,49 @@ void Courtroom::on_ooc_return_pressed()
ui_ooc_chat_message->clear();
return;
}
- else if (ooc_message.startsWith("/load_case"))
- {
+ else if (ooc_message.startsWith("/load_case")) {
QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
QDir casefolder("base/cases");
- if (!casefolder.exists())
- {
- QDir::current().mkdir("base/" + casefolder.dirName());
- append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1");
- ui_ooc_chat_message->clear();
- return;
+ if (!casefolder.exists()) {
+ QDir::current().mkdir("base/" + casefolder.dirName());
+ append_server_chatmessage(
+ "CLIENT",
+ "You don't have a `base/cases/` folder! It was just made for you, "
+ "but seeing as it WAS just made for you, it's likely the case file "
+ "you're looking for can't be found in there.",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
}
QStringList caseslist = casefolder.entryList();
caseslist.removeOne(".");
caseslist.removeOne("..");
- caseslist.replaceInStrings(".ini","");
-
- if (command.size() < 2)
- {
- append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.\nCases you can load: " + caseslist.join(", "), "1");
+ caseslist.replaceInStrings(".ini", "");
+
+ if (command.size() < 2) {
+ append_server_chatmessage(
+ "CLIENT",
+ "You need to give a filename to load (extension not needed)! Make "
+ "sure that it is in the `base/cases/` folder, and that it is a "
+ "correctly formatted ini.\nCases you can load: " +
+ caseslist.join(", "),
+ "1");
ui_ooc_chat_message->clear();
return;
}
-
- if (command.size() > 2)
- {
- append_server_chatmessage("CLIENT", "Too many arguments to load a case! You only need one filename, without extension.", "1");
+ if (command.size() > 2) {
+ append_server_chatmessage("CLIENT",
+ "Too many arguments to load a case! You only "
+ "need one filename, without extension.",
+ "1");
ui_ooc_chat_message->clear();
return;
}
- QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat);
+ QSettings casefile("base/cases/" + command[1] + ".ini",
+ QSettings::IniFormat);
QString caseauth = casefile.value("author", "").value<QString>();
QString casedoc = casefile.value("doc", "").value<QString>();
@@ -2842,88 +2752,108 @@ void Courtroom::on_ooc_return_pressed()
QString casestatus = casefile.value("status", "").value<QString>();
if (!caseauth.isEmpty())
- append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".", "1");
+ append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".",
+ "1");
if (!casedoc.isEmpty())
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%"));
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() +
+ "#/doc " + casedoc + "#%"));
if (!casestatus.isEmpty())
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status " + casestatus + "#%"));
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() +
+ "#/status " + casestatus + "#%"));
if (!cmdoc.isEmpty())
- append_server_chatmessage("CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1");
+ append_server_chatmessage(
+ "CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1");
for (int i = local_evidence_list.size() - 1; i >= 0; i--) {
- ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("DE#" + QString::number(i) + "#%"));
}
foreach (QString evi, casefile.childGroups()) {
- if (evi == "General")
- continue;
+ if (evi == "General")
+ continue;
- QStringList f_contents;
+ QStringList f_contents;
- f_contents.append(casefile.value(evi + "/name", "UNKNOWN").value<QString>());
- f_contents.append(casefile.value(evi + "/description", "UNKNOWN").value<QString>());
- f_contents.append(casefile.value(evi + "/image", "UNKNOWN.png").value<QString>());
+ f_contents.append(
+ casefile.value(evi + "/name", "UNKNOWN").value<QString>());
+ f_contents.append(
+ casefile.value(evi + "/description", "UNKNOWN").value<QString>());
+ f_contents.append(
+ casefile.value(evi + "/image", "UNKNOWN.png").value<QString>());
- ao_app->send_server_packet(new AOPacket("PE", f_contents));
- }
+ ao_app->send_server_packet(new AOPacket("PE", f_contents));
+ }
- append_server_chatmessage("CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1");
+ append_server_chatmessage(
+ "CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1");
ui_ooc_chat_message->clear();
return;
}
- else if(ooc_message.startsWith("/save_case"))
- {
- QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
-
- QDir casefolder("base/cases");
- if (!casefolder.exists())
- {
- QDir::current().mkdir("base/" + casefolder.dirName());
- append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1");
- ui_ooc_chat_message->clear();
- return;
- }
- QStringList caseslist = casefolder.entryList();
- caseslist.removeOne(".");
- caseslist.removeOne("..");
- caseslist.replaceInStrings(".ini","");
-
- if (command.size() < 3)
- {
- append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1");
- ui_ooc_chat_message->clear();
- return;
- }
-
+ else if (ooc_message.startsWith("/save_case")) {
+ QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
- if (command.size() > 3)
- {
- append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1");
- ui_ooc_chat_message->clear();
- return;
- }
- QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat);
- casefile.setValue("author",ui_ooc_chat_name->text());
- casefile.setValue("cmdoc","");
- casefile.setValue("doc", "");
- casefile.setValue("status",command[2]);
- casefile.sync();
- for(int i = local_evidence_list.size() - 1; i >= 0; i--)
- {
- QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("<owner = ...>..."), "");
- clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, "");
- casefile.beginGroup(QString::number(i));
- casefile.sync();
- casefile.setValue("name",local_evidence_list[i].name);
- casefile.setValue("description",local_evidence_list[i].description);
- casefile.setValue("image",local_evidence_list[i].image);
- casefile.endGroup();
- }
- casefile.sync();
- append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1");
+ QDir casefolder("base/cases");
+ if (!casefolder.exists()) {
+ QDir::current().mkdir("base/" + casefolder.dirName());
+ append_server_chatmessage(
+ "CLIENT",
+ "You don't have a `base/cases/` folder! It was just made for you, "
+ "but seeing as it WAS just made for you, it's likely that you "
+ "somehow deleted it.",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+ QStringList caseslist = casefolder.entryList();
+ caseslist.removeOne(".");
+ caseslist.removeOne("..");
+ caseslist.replaceInStrings(".ini", "");
+
+ if (command.size() < 3) {
+ append_server_chatmessage(
+ "CLIENT",
+ "You need to give a filename to save (extension not needed) and the "
+ "courtroom status!",
+ "1");
ui_ooc_chat_message->clear();
return;
+ }
+ if (command.size() > 3) {
+ append_server_chatmessage(
+ "CLIENT",
+ "Too many arguments to save a case! You only need a filename without "
+ "extension and the courtroom status!",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+ QSettings casefile("base/cases/" + command[1] + ".ini",
+ QSettings::IniFormat);
+ casefile.setValue("author", ui_ooc_chat_name->text());
+ casefile.setValue("cmdoc", "");
+ casefile.setValue("doc", "");
+ casefile.setValue("status", command[2]);
+ casefile.sync();
+ for (int i = local_evidence_list.size() - 1; i >= 0; i--) {
+ QString clean_evidence_dsc = local_evidence_list[i].description.replace(
+ QRegularExpression("<owner = ...>..."), "");
+ clean_evidence_dsc = clean_evidence_dsc.replace(
+ clean_evidence_dsc.lastIndexOf(">"), 1, "");
+ casefile.beginGroup(QString::number(i));
+ casefile.sync();
+ casefile.setValue("name", local_evidence_list[i].name);
+ casefile.setValue("description", local_evidence_list[i].description);
+ casefile.setValue("image", local_evidence_list[i].image);
+ casefile.endGroup();
+ }
+ casefile.sync();
+ append_server_chatmessage(
+ "CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
}
QStringList packet_contents;
@@ -2944,16 +2874,14 @@ void Courtroom::on_ooc_return_pressed()
void Courtroom::on_ooc_toggle_clicked()
{
- if (server_ooc)
- {
+ if (server_ooc) {
ui_ms_chatlog->show();
ui_server_chatlog->hide();
ui_ooc_toggle->setText("Master");
server_ooc = false;
}
- else
- {
+ else {
ui_ms_chatlog->hide();
ui_server_chatlog->show();
ui_ooc_toggle->setText("Server");
@@ -2964,7 +2892,7 @@ void Courtroom::on_ooc_toggle_clicked()
void Courtroom::on_music_search_edited(QString p_text)
{
- //preventing compiler warnings
+ // preventing compiler warnings
p_text += "a";
list_music();
list_areas();
@@ -2981,8 +2909,7 @@ void Courtroom::on_pos_dropdown_changed(int p_index)
QString f_pos;
- switch (p_index)
- {
+ switch (p_index) {
case 0:
f_pos = "wit";
break;
@@ -3009,7 +2936,8 @@ void Courtroom::on_pos_dropdown_changed(int p_index)
if (f_pos == "" || ui_ooc_chat_name->text() == "")
return;
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%"));
}
void Courtroom::on_mute_list_clicked(QModelIndex p_index)
@@ -3025,25 +2953,21 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index)
int f_cid = -1;
- for (int n_char = 0 ; n_char < char_list.size() ; n_char++)
- {
+ for (int n_char = 0; n_char < char_list.size(); n_char++) {
if (char_list.at(n_char).name == real_char)
f_cid = n_char;
}
- if (f_cid < 0 || f_cid >= char_list.size())
- {
+ if (f_cid < 0 || f_cid >= char_list.size()) {
qDebug() << "W: " << real_char << " not present in char_list";
return;
}
- if (mute_map.value(f_cid))
- {
+ if (mute_map.value(f_cid)) {
mute_map.insert(f_cid, false);
f_item->setText(real_char);
}
- else
- {
+ else {
mute_map.insert(f_cid, true);
f_item->setText(real_char + " [x]");
}
@@ -3056,26 +2980,19 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
QString real_char;
int f_cid = -1;
- if (f_char.endsWith(" [x]"))
- {
+ if (f_char.endsWith(" [x]")) {
real_char = f_char.left(f_char.size() - 4);
f_item->setText(real_char);
}
- else
- {
- real_char = f_char;
- for (int n_char = 0 ; n_char < char_list.size() ; n_char++)
- {
- if (char_list.at(n_char).name == real_char)
- f_cid = n_char;
- }
+ else {
+ real_char = f_char;
+ for (int n_char = 0; n_char < char_list.size(); n_char++) {
+ if (char_list.at(n_char).name == real_char)
+ f_cid = n_char;
+ }
}
-
-
-
- if (f_cid < -2 || f_cid >= char_list.size())
- {
+ if (f_cid < -2 || f_cid >= char_list.size()) {
qDebug() << "W: " << real_char << " not present in char_list";
return;
}
@@ -3093,9 +3010,8 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
for (int i = 0; i < ui_pair_list->count(); i++) {
ui_pair_list->item(i)->setText(sorted_pair_list.at(i));
}
- if(other_charid != -1)
- {
- f_item->setText(real_char + " [x]");
+ if (other_charid != -1) {
+ f_item->setText(real_char + " [x]");
}
}
@@ -3106,31 +3022,34 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model)
QString p_song = music_list.at(music_row_to_number.at(p_model.row()));
- if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled)
- {
- ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false);
+ if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) {
+ ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" +
+ QString::number(m_cid) + "#" +
+ ui_ic_chat_name->text() + "#%"),
+ false);
}
- else
- {
- ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false);
+ else {
+ ao_app->send_server_packet(
+ new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"),
+ false);
}
}
void Courtroom::on_area_list_double_clicked(QModelIndex p_model)
{
- QString p_area = area_list.at(area_row_to_number.at(p_model.row()));
- ao_app->send_server_packet(new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), false);
+ QString p_area = area_list.at(area_row_to_number.at(p_model.row()));
+ ao_app->send_server_packet(
+ new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"),
+ false);
}
void Courtroom::on_hold_it_clicked()
{
- if (objection_state == 1)
- {
+ if (objection_state == 1) {
ui_hold_it->set_image("holdit.png");
objection_state = 0;
}
- else
- {
+ else {
ui_objection->set_image("objection.png");
ui_take_that->set_image("takethat.png");
ui_custom_objection->set_image("custom.png");
@@ -3144,13 +3063,11 @@ void Courtroom::on_hold_it_clicked()
void Courtroom::on_objection_clicked()
{
- if (objection_state == 2)
- {
+ if (objection_state == 2) {
ui_objection->set_image("objection.png");
objection_state = 0;
}
- else
- {
+ else {
ui_hold_it->set_image("holdit.png");
ui_take_that->set_image("takethat.png");
ui_custom_objection->set_image("custom.png");
@@ -3164,13 +3081,11 @@ void Courtroom::on_objection_clicked()
void Courtroom::on_take_that_clicked()
{
- if (objection_state == 3)
- {
+ if (objection_state == 3) {
ui_take_that->set_image("takethat.png");
objection_state = 0;
}
- else
- {
+ else {
ui_objection->set_image("objection.png");
ui_hold_it->set_image("holdit.png");
ui_custom_objection->set_image("custom.png");
@@ -3184,13 +3099,11 @@ void Courtroom::on_take_that_clicked()
void Courtroom::on_custom_objection_clicked()
{
- if (objection_state == 4)
- {
+ if (objection_state == 4) {
ui_custom_objection->set_image("custom.png");
objection_state = 0;
}
- else
- {
+ else {
ui_objection->set_image("objection.png");
ui_take_that->set_image("takethat.png");
ui_hold_it->set_image("holdit.png");
@@ -3204,13 +3117,11 @@ void Courtroom::on_custom_objection_clicked()
void Courtroom::on_realization_clicked()
{
- if (realization_state == 0)
- {
+ if (realization_state == 0) {
realization_state = 1;
ui_realization->set_image("realization_pressed.png");
}
- else
- {
+ else {
realization_state = 0;
ui_realization->set_image("realization.png");
}
@@ -3220,16 +3131,14 @@ void Courtroom::on_realization_clicked()
void Courtroom::on_mute_clicked()
{
- if (ui_mute_list->isHidden())
- {
+ if (ui_mute_list->isHidden()) {
ui_mute_list->show();
ui_pair_list->hide();
ui_pair_offset_spinbox->hide();
ui_pair_button->set_image("pair_button.png");
ui_mute->set_image("mute_pressed.png");
}
- else
- {
+ else {
ui_mute_list->hide();
ui_mute->set_image("mute.png");
}
@@ -3237,16 +3146,14 @@ void Courtroom::on_mute_clicked()
void Courtroom::on_pair_clicked()
{
- if (ui_pair_list->isHidden())
- {
+ if (ui_pair_list->isHidden()) {
ui_pair_list->show();
ui_pair_offset_spinbox->show();
ui_mute_list->hide();
ui_mute->set_image("mute.png");
ui_pair_button->set_image("pair_button_pressed.png");
}
- else
- {
+ else {
ui_pair_list->hide();
ui_pair_offset_spinbox->hide();
ui_pair_button->set_image("pair_button.png");
@@ -3258,7 +3165,8 @@ void Courtroom::on_defense_minus_clicked()
int f_state = defense_bar_state - 1;
if (f_state >= 0)
- ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_defense_plus_clicked()
@@ -3266,7 +3174,8 @@ void Courtroom::on_defense_plus_clicked()
int f_state = defense_bar_state + 1;
if (f_state <= 10)
- ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_prosecution_minus_clicked()
@@ -3274,7 +3183,8 @@ void Courtroom::on_prosecution_minus_clicked()
int f_state = prosecution_bar_state - 1;
if (f_state >= 0)
- ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_prosecution_plus_clicked()
@@ -3282,7 +3192,8 @@ void Courtroom::on_prosecution_plus_clicked()
int f_state = prosecution_bar_state + 1;
if (f_state <= 10)
- ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_text_color_changed(int p_color)
@@ -3310,15 +3221,9 @@ void Courtroom::on_blip_slider_moved(int p_value)
ui_ic_chat_message->setFocus();
}
-void Courtroom::on_log_limit_changed(int value)
-{
- log_maximum_blocks = value;
-}
+void Courtroom::on_log_limit_changed(int value) { log_maximum_blocks = value; }
-void Courtroom::on_pair_offset_changed(int value)
-{
- offset_with_pair = value;
-}
+void Courtroom::on_pair_offset_changed(int value) { offset_with_pair = value; }
void Courtroom::on_witness_testimony_clicked()
{
@@ -3374,10 +3279,10 @@ void Courtroom::on_change_character_clicked()
}
void Courtroom::on_reload_theme_clicked()
-{
+{
ao_app->reload_theme();
- //to update status on the background
+ // to update status on the background
set_background(current_background);
enter_courtroom(m_cid);
@@ -3430,7 +3335,8 @@ void Courtroom::on_call_mod_clicked()
if (text.isEmpty()) {
errorBox.critical(nullptr, "Error", "You must provide a reason.");
return;
- } else if (text.length() > 256) {
+ }
+ else if (text.length() > 256) {
errorBox.critical(nullptr, "Error", "The message is too long.");
return;
}
@@ -3439,37 +3345,26 @@ void Courtroom::on_call_mod_clicked()
mod_reason.append(text);
ao_app->send_server_packet(new AOPacket("ZZ", mod_reason));
- } else {
+ }
+ else {
ao_app->send_server_packet(new AOPacket("ZZ#%"));
}
ui_ic_chat_message->setFocus();
}
-void Courtroom::on_settings_clicked()
-{
- ao_app->call_settings_menu();
-}
+void Courtroom::on_settings_clicked() { ao_app->call_settings_menu(); }
void Courtroom::on_announce_casing_clicked()
{
- ao_app->call_announce_menu(this);
+ ao_app->call_announce_menu(this);
}
-void Courtroom::on_pre_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
+void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); }
-void Courtroom::on_flip_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
+void Courtroom::on_flip_clicked() { ui_ic_chat_message->setFocus(); }
-void Courtroom::on_guard_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
+void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); }
void Courtroom::on_showname_enable_clicked()
{
@@ -3477,69 +3372,63 @@ void Courtroom::on_showname_enable_clicked()
first_message_sent = false;
foreach (chatlogpiece item, ic_chatlog_history) {
- if (ui_showname_enable->isChecked())
- {
- if (item.get_is_song())
- append_ic_text(item.get_message(), item.get_showname(), true);
- else
- append_ic_text(item.get_message(), item.get_showname());
- }
+ if (ui_showname_enable->isChecked()) {
+ if (item.get_is_song())
+ append_ic_text(item.get_message(), item.get_showname(), true);
else
- {
- if (item.get_is_song())
- append_ic_text(item.get_message(), item.get_name(), true);
- else
- append_ic_text(item.get_message(), item.get_name());
- }
+ append_ic_text(item.get_message(), item.get_showname());
}
+ else {
+ if (item.get_is_song())
+ append_ic_text(item.get_message(), item.get_name(), true);
+ else
+ append_ic_text(item.get_message(), item.get_name());
+ }
+ }
ui_ic_chat_message->setFocus();
}
void Courtroom::on_evidence_button_clicked()
{
- if (ui_evidence->isHidden())
- {
+ if (ui_evidence->isHidden()) {
ui_evidence->show();
ui_evidence_overlay->hide();
}
- else
- {
+ else {
ui_evidence->hide();
}
}
void Courtroom::on_switch_area_music_clicked()
{
- if (ui_area_list->isHidden())
- {
- ui_area_list->show();
- ui_music_list->hide();
- }
- else
- {
- ui_area_list->hide();
- ui_music_list->show();
- }
+ if (ui_area_list->isHidden()) {
+ ui_area_list->show();
+ ui_music_list->hide();
+ }
+ else {
+ ui_area_list->hide();
+ ui_music_list->show();
+ }
}
void Courtroom::ping_server()
{
- ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("CH#" + QString::number(m_cid) + "#%"));
}
void Courtroom::on_casing_clicked()
{
- if (ao_app->casing_alerts_enabled)
- {
- if (ui_casing->isChecked())
- {
+ if (ao_app->casing_alerts_enabled) {
+ if (ui_casing->isChecked()) {
QStringList f_packet;
f_packet.append(ao_app->get_casing_can_host_cases());
f_packet.append(QString::number(ao_app->get_casing_cm_enabled()));
f_packet.append(QString::number(ao_app->get_casing_defence_enabled()));
- f_packet.append(QString::number(ao_app->get_casing_prosecution_enabled()));
+ f_packet.append(
+ QString::number(ao_app->get_casing_prosecution_enabled()));
f_packet.append(QString::number(ao_app->get_casing_judge_enabled()));
f_packet.append(QString::number(ao_app->get_casing_juror_enabled()));
f_packet.append(QString::number(ao_app->get_casing_steno_enabled()));
@@ -3551,10 +3440,10 @@ void Courtroom::on_casing_clicked()
}
}
-void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::announce_case(QString title, bool def, bool pro, bool jud,
+ bool jur, bool steno)
{
- if (ao_app->casing_alerts_enabled)
- {
+ if (ao_app->casing_alerts_enabled) {
QStringList f_packet;
f_packet.append(title);
@@ -3565,7 +3454,7 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool
f_packet.append(QString::number(steno));
ao_app->send_server_packet(new AOPacket("CASEA", f_packet));
- }
+ }
}
Courtroom::~Courtroom()
@@ -3576,29 +3465,29 @@ Courtroom::~Courtroom()
delete blip_player;
}
-
-#if (defined (_WIN32) || defined (_WIN64))
+#if (defined(_WIN32) || defined(_WIN64))
void Courtroom::load_bass_opus_plugin()
{
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
BASS_PluginLoad("bassopus.dll", 0);
- #endif
+#endif
}
-#elif (defined (LINUX) || defined (__linux__))
+#elif (defined(LINUX) || defined(__linux__))
void Courtroom::load_bass_opus_plugin()
{
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
BASS_PluginLoad("libbassopus.so", 0);
- #endif
+#endif
}
#elif defined __APPLE__
void Courtroom::load_bass_opus_plugin()
{
- QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib";
+ QString libpath =
+ ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib";
QByteArray ba = libpath.toLocal8Bit();
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
BASS_PluginLoad(ba.data(), 0);
- #endif
+#endif
}
#else
#error This operating system is unsupported for bass plugins.