From 5b6d58bd020978f4632cb2dcb2db620213175645 Mon Sep 17 00:00:00 2001 From: cents Date: Mon, 20 Apr 2020 07:49:47 -0700 Subject: Added additional customization options. I didn't format anything tho that is at the end --- src/aooptionsdialog.cpp | 27 +++++++++++++++++---------- src/courtroom.cpp | 11 ++++++++--- src/text_file_functions.cpp | 17 +++++++++++------ 3 files changed, 36 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e9b38fa..e2f433d 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -189,16 +189,23 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_net_divider->setFrameShadow(QFrame::Sunken); ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_net_divider); + ui_slower_blips_lb = new QLabel(ui_form_layout_widget); + ui_slower_blips_lb->setText(tr("Slower text speed:")); + ui_slower_blips_lb->setToolTip(tr("Set the text speed to be the same as the AA games.")); + ui_slower_blips_cb = new QCheckBox(ui_form_layout_widget); + ui_slower_blips_cb->setChecked(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_slower_blips_cb); + ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_slower_blips_lb); + ui_pun_delay = new QLabel(ui_form_layout_widget); - ui_pun_delay->setText(tr("Punctation Delay:")); + ui_pun_delay->setText(tr("Blip delay on punctuations:")); ui_pun_delay->setToolTip(tr("Punctation delay modifier." - " Set it to 1 for no additional delay.")); - ui_pun_delay_spinbox = new QSpinBox(ui_form_layout_widget); - ui_pun_delay_spinbox->setMinimum(1); - ui_pun_delay_spinbox->setMaximum(3); - ui_pun_delay_spinbox->setValue(p_ao_app->get_pundelay()); - ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_pun_delay_spinbox); - ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_pun_delay); + " Enable it for the blips to slow down on punctuations.")); + ui_pun_delay_cb = new QCheckBox(ui_form_layout_widget); + ui_pun_delay_cb->setChecked(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_pun_delay_cb); + ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_pun_delay); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); @@ -655,8 +662,8 @@ void AOOptionsDialog::save_pressed() configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); - configini->setValue("punctuation_delay", ui_pun_delay_spinbox->value()); - configini->setValue("keep_evidence", ui_keepevi_cb->isChecked()); + configini->setValue("punctuation_delay", ui_pun_delay_cb->isChecked()); + configini->setValue("slower_blips", ui_slower_blips_cb->isChecked()); QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c0fb24b..0cacffc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1761,7 +1761,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_vp_objection->stop(); // ui_vp_player_char->stop(); chat_tick_timer->stop(); - if (keep_evidence_display) + if (!keep_evidence_display) ui_vp_evidence_display->reset(); chatmessage_is_empty = @@ -2769,7 +2769,10 @@ void Courtroom::start_chat_ticking() // At the start of every new message, we set the text speed to the default. current_display_speed = 3; - chat_tick_timer->start(message_display_speed[current_display_speed]); + if (slower_blips) + chat_tick_timer->start(message_display_speed_slow[current_display_speed]); + else + chat_tick_timer->start(message_display_speed[current_display_speed]); QString f_char = m_chatmessage[CHAR_NAME]; QString f_gender = ao_app->get_gender(f_char); @@ -2793,6 +2796,8 @@ void Courtroom::chat_tick() // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); int msg_delay = message_display_speed[current_display_speed]; + if (slower_blips) + msg_delay = message_display_speed_slow[current_display_speed]; // Stops blips from playing when we have a formatting option. bool formatting_char = false; @@ -2829,7 +2834,7 @@ void Courtroom::chat_tick() f_character = f_character.toHtmlEscaped(); if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier; + msg_delay *= punctuation_modifier + 1; // Since we are handling a boolean, if its true its double (1 + 1) or false (1 + 0). // ui_vp_message->insertPlainText(f_character); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 29c5c42..779765d 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -46,13 +46,18 @@ int AOApplication::get_max_log_size() return result; } -int AOApplication::get_pundelay() +bool AOApplication::get_slower_blips() { - int result = configini->value("punctuation_delay", 2).toInt(); - if (result < 1 || result > 3) { - result = 2; - } - return result; + QString result = + configini->value("slower_blips", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_pundelay() +{ + QString result = + configini->value("punctuation_delay", "false").value(); + return result.startsWith("true"); } bool AOApplication::get_log_goes_downwards() -- cgit