From 6138bb107b5ab4d882e9ceb75e1394c2b8ec82a3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 15 Jan 2020 16:42:44 +0300 Subject: [PATCH] Separate screenshake options button from effects options button Add a color logging option button Update version to 2.8.2 --- Attorney_Online.pro | 2 +- include/aoapplication.h | 14 +++++++++--- include/aooptionsdialog.h | 9 ++++++-- src/aooptionsdialog.cpp | 45 +++++++++++++++++++++++++++++-------- src/courtroom.cpp | 17 ++++++++------ src/text_file_functions.cpp | 16 +++++++++++-- 6 files changed, 79 insertions(+), 24 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 97eaf51..cb6727f 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.1.0 +VERSION = 2.8.2.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/aoapplication.h b/include/aoapplication.h index fe1a5b7..0ab6831 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -172,14 +172,22 @@ public: // from the config.ini. bool is_discord_enabled(); - // Returns the value of whether shaking and flashing should be enabled. + // Returns the value of whether shaking should be enabled. // from the config.ini. - bool is_shake_flash_enabled(); + bool is_shake_enabled(); + + // Returns the value of whether effects should be enabled. + // from the config.ini. + bool is_effects_enabled(); // Returns the value of whether frame-specific effects defined in char.ini should be sent/received over the network. // from the config.ini. bool is_frame_network_enabled(); + // Returns the value of whether colored ic log should be a thing. + // from the config.ini. + bool is_colorlog_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); @@ -396,7 +404,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 1; + const int MINOR_VERSION = 2; QString current_theme = "default"; diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 5198410..9e34e65 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -65,11 +65,16 @@ private: QLabel *ui_language_label; QComboBox *ui_language_combobox; - QLabel *ui_epilepsy_lbl; - QCheckBox *ui_epilepsy_cb; + QLabel *ui_shake_lbl; + QCheckBox *ui_shake_cb; + QLabel *ui_effects_lbl; + QCheckBox *ui_effects_cb; QLabel *ui_framenetwork_lbl; QCheckBox *ui_framenetwork_cb; + QLabel *ui_colorlog_lbl; + QCheckBox *ui_colorlog_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 37694e4..ad1042f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -195,16 +195,28 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_language_combobox); row += 1; - ui_epilepsy_lbl = new QLabel(ui_form_layout_widget); - ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:")); - ui_epilepsy_lbl->setToolTip(tr("Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + ui_shake_lbl = new QLabel(ui_form_layout_widget); + ui_shake_lbl->setText(tr("Allow Screenshake:")); + ui_shake_lbl->setToolTip(tr("Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_epilepsy_lbl); + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_shake_lbl); - ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); - ui_epilepsy_cb->setChecked(ao_app->is_shake_flash_enabled()); + ui_shake_cb = new QCheckBox(ui_form_layout_widget); + ui_shake_cb->setChecked(ao_app->is_shake_enabled()); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_epilepsy_cb); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_shake_cb); + + row += 1; + ui_effects_lbl = new QLabel(ui_form_layout_widget); + ui_effects_lbl->setText(tr("Allow Effects:")); + ui_effects_lbl->setToolTip(tr("Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_effects_lbl); + + ui_effects_cb = new QCheckBox(ui_form_layout_widget); + ui_effects_cb->setChecked(ao_app->is_effects_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_effects_cb); row += 1; ui_framenetwork_lbl = new QLabel(ui_form_layout_widget); @@ -214,10 +226,22 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_framenetwork_lbl); ui_framenetwork_cb = new QCheckBox(ui_form_layout_widget); - ui_framenetwork_cb->setChecked(ao_app->is_shake_flash_enabled()); + ui_framenetwork_cb->setChecked(ao_app->is_frame_network_enabled()); ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb); + row += 1; + ui_colorlog_lbl = new QLabel(ui_form_layout_widget); + ui_colorlog_lbl->setText(tr("Colors in IC Log:")); + ui_colorlog_lbl->setToolTip(tr("Use the markup colors in the server IC chatlog.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_colorlog_lbl); + + ui_colorlog_cb = new QCheckBox(ui_form_layout_widget); + ui_colorlog_cb->setChecked(ao_app->is_colorlog_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb); + QScrollArea *scroll = new QScrollArea; scroll->setWidget(ui_form_layout_widget); ui_gameplay_tab->setLayout(new QVBoxLayout); @@ -571,8 +595,11 @@ void AOOptionsDialog::save_pressed() configini->setValue("master", ui_ms_textbox->text()); configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); - configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); + configini->setValue("shake", ui_shake_cb->isChecked()); + configini->setValue("effects", ui_effects_cb->isChecked()); configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); + configini->setValue("colorlog", ui_colorlog_cb->isChecked()); + QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 937cfc5..283611f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1889,7 +1889,7 @@ void Courtroom::handle_chatmessage_2() void Courtroom::do_screenshake() { - if(!ao_app->is_shake_flash_enabled()) + if(!ao_app->is_shake_enabled()) return; //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. @@ -1935,7 +1935,7 @@ void Courtroom::do_screenshake() void Courtroom::do_flash() { - if(!ao_app->is_shake_flash_enabled()) + if(!ao_app->is_effects_enabled()) return; QString f_char = m_chatmessage[CHAR_NAME]; @@ -1945,17 +1945,20 @@ void Courtroom::do_flash() void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) { - if(!ao_app->is_shake_flash_enabled()) - return; QString effect = ao_app->get_effect(fx_name, p_char); if (effect == "") return; - ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. - ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once if (fx_sound != "") sfx_player->play(fx_sound); + + //Only check if effects are disabled after playing the sound if it exists + if(!ao_app->is_effects_enabled()) + return; + + ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. + ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once } void Courtroom::play_char_sfx(QString sfx_name) @@ -2299,7 +2302,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); if (!is_songchange) - p_text = filter_ic_text(p_text, true, -1, m_chatmessage[TEXT_COLOR].toInt()); + p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, m_chatmessage[TEXT_COLOR].toInt()); if (log_goes_downwards) { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 2c9d5e9..bb5d7de 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -960,9 +960,15 @@ bool AOApplication::is_discord_enabled() return result.startsWith("true"); } -bool AOApplication::is_shake_flash_enabled() +bool AOApplication::is_shake_enabled() { - QString result = configini->value("shakeandflash", "true").value(); + QString result = configini->value("shake", "true").value(); + return result.startsWith("true"); +} + +bool AOApplication::is_effects_enabled() +{ + QString result = configini->value("effects", "true").value(); return result.startsWith("true"); } @@ -972,6 +978,12 @@ bool AOApplication::is_frame_network_enabled() return result.startsWith("true"); } +bool AOApplication::is_colorlog_enabled() +{ + QString result = configini->value("colorlog", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value();