Separate screenshake options button from effects options button

Add a color logging option button
Update version to 2.8.2
This commit is contained in:
Crystalwarrior 2020-01-15 16:42:44 +03:00
parent f30013f7f9
commit 6138bb107b
6 changed files with 79 additions and 24 deletions

View File

@ -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

View File

@ -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";

View File

@ -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;

View File

@ -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");

View File

@ -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)
{

View File

@ -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>();
QString result = configini->value("shake", "true").value<QString>();
return result.startsWith("true");
}
bool AOApplication::is_effects_enabled()
{
QString result = configini->value("effects", "true").value<QString>();
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<QString>();
return result.startsWith("true");
}
bool AOApplication::get_casing_enabled()
{
QString result = configini->value("casing_enabled", "false").value<QString>();