Reorganise logging option into its own settings tab (#790)

* Split logging options into its own tab

This is so ugly its not even funny.

* Update src/aooptionsdialog.cpp

bot being annoying.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Can't trust the bot with anything

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Salanto 2022-07-16 06:47:04 -07:00 committed by GitHub
parent 15c2e0022d
commit 368f2b04ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 227 additions and 163 deletions

View File

@ -8,7 +8,6 @@
#include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QFormLayout>
@ -16,6 +15,7 @@
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPlainTextEdit>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QTabWidget>
@ -45,6 +45,7 @@ private:
QWidget *ui_gameplay_tab;
QWidget *ui_form_layout_widget;
QFormLayout *ui_gameplay_form;
QLabel *ui_theme_label;
QComboBox *ui_theme_combobox;
QLabel *ui_subtheme_label;
@ -53,30 +54,14 @@ private:
QLabel *ui_animated_theme_lbl;
QCheckBox *ui_animated_theme_cb;
QFrame *ui_theme_log_divider;
QLabel *ui_downwards_lbl;
QCheckBox *ui_downwards_cb;
QLabel *ui_length_lbl;
QSpinBox *ui_length_spinbox;
QLabel *ui_log_newline_lbl;
QCheckBox *ui_log_newline_cb;
QLabel *ui_log_margin_lbl;
QSpinBox *ui_log_margin_spinbox;
QLabel *ui_log_timestamp_lbl;
QCheckBox *ui_log_timestamp_cb;
QLabel *ui_log_timestamp_format_lbl;
QComboBox *ui_log_timestamp_format_combobox;
QLabel *ui_stay_time_lbl;
QSpinBox *ui_stay_time_spinbox;
QLabel *ui_desync_logs_lbl;
QCheckBox *ui_desync_logs_cb;
QLabel *ui_instant_objection_lbl;
QCheckBox *ui_instant_objection_cb;
QLabel *ui_text_crawl_lbl;
QSpinBox *ui_text_crawl_spinbox;
QLabel *ui_chat_ratelimit_lbl;
QSpinBox *ui_chat_ratelimit_spinbox;
QLabel *ui_log_ic_actions_lbl;
QCheckBox *ui_log_ic_actions_cb;
QFrame *ui_log_names_divider;
QLineEdit *ui_username_textbox;
QLabel *ui_username_lbl;
@ -125,12 +110,6 @@ private:
QLabel *ui_category_stop_lbl;
QCheckBox *ui_category_stop_cb;
QLabel *ui_log_text_lbl;
QCheckBox *ui_log_text_cb;
QLabel *ui_log_demo_lbl;
QCheckBox *ui_log_demo_cb;
QWidget *ui_callwords_tab;
QWidget *ui_callwords_widget;
QVBoxLayout *ui_callwords_layout;
@ -193,6 +172,71 @@ private:
QPushButton *ui_mount_down;
QPushButton *ui_mount_clear_cache;
QWidget *ui_logging_tab;
QWidget *ui_form_logging_widget;
QFormLayout *ui_logging_form;
/**
* Option for log direction. Supported options are downwards and wrong way.
*/
QLabel *ui_downwards_lbl;
QCheckBox *ui_downwards_cb;
/**
* Option for log length. Controls how many IC-log entries are kept before it autowraps.
*/
QLabel *ui_length_lbl;
QSpinBox *ui_length_spinbox;
/**
* Option for log newline. Controls if the IC-log contains newlines or as one consecutive string.
*/
QLabel *ui_log_newline_lbl;
QCheckBox *ui_log_newline_cb;
/**
* Option for log margin. Controls how many pixels are between each log entry.
*/
QLabel *ui_log_margin_lbl;
QSpinBox *ui_log_margin_spinbox;
/**
* Option for timestamp format. A checkmark to enable the timestamp dropdown.
* Why does this exist? Are we Dorico now?
*/
QLabel *ui_log_timestamp_lbl;
QCheckBox *ui_log_timestamp_cb;
/**
* Option for timestamp format. Dropdown to select the preferred format.
*/
QLabel *ui_log_timestamp_format_lbl;
QComboBox *ui_log_timestamp_format_combobox;
/**
* Option for desynched IC-log and viewport. Controls if entires are appended to the IC-log before displayed in the viewport.
*/
QLabel *ui_desync_logs_lbl;
QCheckBox *ui_desync_logs_cb;
/**
* Option for logging IC-actions. Will add shouts, evidence or music changes to the IC-log.
*/
QLabel *ui_log_ic_actions_lbl;
QCheckBox *ui_log_ic_actions_cb;
/**
* Option to enable logging. If enabled client will save all messages to the log folder.
*/
QLabel *ui_log_text_lbl;
QCheckBox *ui_log_text_cb;
/**
* Option to enable demo logging. If enabled, client will save a demo file for replay trough the demo server.
*/
QLabel *ui_log_demo_lbl;
QCheckBox *ui_log_demo_cb;
QWidget *ui_privacy_tab;
QVBoxLayout *ui_privacy_layout;
QCheckBox *ui_privacy_optout_cb;

View File

@ -149,113 +149,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole,
ui_theme_log_divider);
row += 1;
ui_downwards_lbl = new QLabel(ui_form_layout_widget);
ui_downwards_lbl->setText(tr("Log goes downwards:"));
ui_downwards_lbl->setToolTip(
tr("If ticked, new messages will appear at "
"the bottom (like the OOC chatlog). The traditional "
"(AO1) behaviour is equivalent to this being unticked."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_downwards_lbl);
ui_downwards_cb = new QCheckBox(ui_form_layout_widget);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_downwards_cb);
row += 1;
ui_length_lbl = new QLabel(ui_form_layout_widget);
ui_length_lbl->setText(tr("Log length:"));
ui_length_lbl->setToolTip(tr(
"The amount of message lines the IC chatlog will keep before "
"deleting older message lines. A value of 0 or below counts as 'infinite'."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_length_lbl);
ui_length_spinbox = new QSpinBox(ui_form_layout_widget);
ui_length_spinbox->setSuffix(" lines");
ui_length_spinbox->setMaximum(10000);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_length_spinbox);
row += 1;
ui_log_newline_lbl = new QLabel(ui_form_layout_widget);
ui_log_newline_lbl->setText(tr("Log newline:"));
ui_log_newline_lbl->setToolTip(
tr("If ticked, new messages will appear separated, "
"with the message coming on the next line after the name. "
"When unticked, it displays it as 'name: message'."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_newline_lbl);
ui_log_newline_cb = new QCheckBox(ui_form_layout_widget);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_newline_cb);
row += 1;
ui_log_margin_lbl = new QLabel(ui_form_layout_widget);
ui_log_margin_lbl->setText(tr("Log margin:"));
ui_log_margin_lbl->setToolTip(tr(
"The distance in pixels between each entry in the IC log. "
"Default: 0."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_margin_lbl);
ui_log_margin_spinbox = new QSpinBox(ui_form_layout_widget);
ui_log_margin_spinbox->setSuffix(" px");
ui_log_margin_spinbox->setMaximum(1000);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_margin_spinbox);
row += 1;
ui_log_timestamp_lbl = new QLabel(ui_form_layout_widget);
ui_log_timestamp_lbl->setText(tr("Log timestamp:"));
ui_log_timestamp_lbl->setToolTip(
tr("If ticked, log will contain a timestamp in UTC before the name."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_timestamp_lbl);
ui_log_timestamp_cb = new QCheckBox(ui_form_layout_widget);
connect(ui_log_timestamp_cb, &QCheckBox::stateChanged, this, &AOOptionsDialog::timestamp_cb_changed);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_timestamp_cb);
row += 1;
ui_log_timestamp_format_lbl = new QLabel(ui_form_layout_widget);
ui_log_timestamp_format_lbl->setText(tr("Log timestamp format:\n") + QDateTime::currentDateTime().toString(ao_app->get_log_timestamp_format()));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_timestamp_format_lbl);
ui_log_timestamp_format_combobox = new QComboBox(ui_form_layout_widget);
ui_log_timestamp_format_combobox->setEditable(true);
QString l_current_format = ao_app->get_log_timestamp_format();
ui_log_timestamp_format_combobox->setCurrentText(l_current_format);
ui_log_timestamp_format_combobox->addItem("h:mm:ss AP"); // 2:13:09 PM
ui_log_timestamp_format_combobox->addItem("hh:mm:ss"); // 14:13:09
ui_log_timestamp_format_combobox->addItem("h:mm AP"); // 2:13 PM
ui_log_timestamp_format_combobox->addItem("hh:mm"); // 14:13
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_timestamp_format_combobox);
connect(ui_log_timestamp_format_combobox, &QComboBox::currentTextChanged, this, &AOOptionsDialog::on_timestamp_format_edited);
if(!ao_app->get_log_timestamp())
ui_log_timestamp_format_combobox->setDisabled(true);
row += 1;
ui_log_ic_actions_lbl = new QLabel(ui_form_layout_widget);
ui_log_ic_actions_lbl->setText(tr("Log IC actions:"));
ui_log_ic_actions_lbl->setToolTip(
tr("If ticked, log will show IC actions such as shouting and presenting evidence."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_ic_actions_lbl);
ui_log_ic_actions_cb = new QCheckBox(ui_form_layout_widget);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_ic_actions_cb);
row += 1;
ui_stay_time_lbl = new QLabel(ui_form_layout_widget);
@ -272,18 +165,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stay_time_spinbox);
row += 1;
ui_desync_logs_lbl = new QLabel(ui_form_layout_widget);
ui_desync_logs_lbl->setText(tr("Desynchronize IC Logs:"));
ui_desync_logs_lbl->setToolTip(
tr("If ticked, log will show messages as-received, while viewport will parse according to the queue (Text Stay Time)."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_desync_logs_lbl);
ui_desync_logs_cb = new QCheckBox(ui_form_layout_widget);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_desync_logs_cb);
row += 1;
ui_instant_objection_lbl = new QLabel(ui_form_layout_widget);
ui_instant_objection_lbl->setText(tr("Instant Objection:"));
@ -584,27 +465,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_category_stop_cb);
//Check whether mass logging is enabled
row += 1;
ui_log_text_lbl = new QLabel(ui_form_layout_widget);
ui_log_text_lbl->setText(tr("Log to Text Files:"));
ui_log_text_lbl->setToolTip(
tr("Text logs of gameplay will be automatically written in the /logs folder."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_text_lbl);
ui_log_text_cb = new QCheckBox(ui_form_layout_widget);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_text_cb);
row += 1;
ui_log_demo_lbl = new QLabel(ui_form_layout_widget);
ui_log_demo_lbl->setText(tr("Log to Demo Files:"));
ui_log_demo_lbl->setToolTip(
tr("Gameplay will be automatically recorded as demos in the /logs folder."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_demo_lbl);
ui_log_demo_cb = new QCheckBox(ui_form_layout_widget);
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_demo_cb);
// Finish gameplay tab
QScrollArea *scroll = new QScrollArea(this);
scroll->setWidget(ui_form_layout_widget);
@ -1074,6 +934,166 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_mount_down->setEnabled(false);
});
// Logging tab
ui_logging_tab = new QWidget(this);
ui_settings_tabs->addTab(ui_logging_tab, tr("Logging"));
ui_form_logging_widget = new QWidget(this);
ui_logging_form = new QFormLayout(ui_form_logging_widget);
ui_logging_form->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
Qt::AlignVCenter);
ui_logging_form->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
Qt::AlignTop);
ui_logging_form->setContentsMargins(5, 5, 0, 0);
ui_logging_form->setSpacing(4);
row = 0;
ui_downwards_lbl = new QLabel(ui_form_logging_widget);
ui_downwards_lbl->setText(tr("Log goes downwards:"));
ui_downwards_lbl->setToolTip(
tr("If ticked, new messages will appear at "
"the bottom (like the OOC chatlog). The traditional "
"(AO1) behaviour is equivalent to this being unticked."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_downwards_lbl);
ui_downwards_cb = new QCheckBox(ui_form_logging_widget);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_downwards_cb);
row += 1;
ui_length_lbl = new QLabel(ui_form_logging_widget);
ui_length_lbl->setText(tr("Log length:"));
ui_length_lbl->setToolTip(tr(
"The amount of message lines the IC chatlog will keep before "
"deleting older message lines. A value of 0 or below counts as 'infinite'."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_length_lbl);
ui_length_spinbox = new QSpinBox(ui_form_logging_widget);
ui_length_spinbox->setSuffix(" lines");
ui_length_spinbox->setMaximum(10000);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_length_spinbox);
row += 1;
ui_log_newline_lbl = new QLabel(ui_form_logging_widget);
ui_log_newline_lbl->setText(tr("Log newline:"));
ui_log_newline_lbl->setToolTip(
tr("If ticked, new messages will appear separated, "
"with the message coming on the next line after the name. "
"When unticked, it displays it as 'name: message'."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_newline_lbl);
ui_log_newline_cb = new QCheckBox(ui_form_logging_widget);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_newline_cb);
row += 1;
ui_log_margin_lbl = new QLabel(ui_form_logging_widget);
ui_log_margin_lbl->setText(tr("Log margin:"));
ui_log_margin_lbl->setToolTip(tr(
"The distance in pixels between each entry in the IC log. "
"Default: 0."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_margin_lbl);
ui_log_margin_spinbox = new QSpinBox(ui_form_logging_widget);
ui_log_margin_spinbox->setSuffix(" px");
ui_log_margin_spinbox->setMaximum(1000);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_margin_spinbox);
row += 1;
ui_log_timestamp_lbl = new QLabel(ui_form_logging_widget);
ui_log_timestamp_lbl->setText(tr("Log timestamp:"));
ui_log_timestamp_lbl->setToolTip(
tr("If ticked, log will contain a timestamp in UTC before the name."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_timestamp_lbl);
ui_log_timestamp_cb = new QCheckBox(ui_form_logging_widget);
connect(ui_log_timestamp_cb, &QCheckBox::stateChanged, this, &AOOptionsDialog::timestamp_cb_changed);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_timestamp_cb);
row += 1;
ui_log_timestamp_format_lbl = new QLabel(ui_form_logging_widget);
ui_log_timestamp_format_lbl->setText(tr("Log timestamp format:\n") + QDateTime::currentDateTime().toString(ao_app->get_log_timestamp_format()));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_timestamp_format_lbl);
ui_log_timestamp_format_combobox = new QComboBox(ui_form_logging_widget);
ui_log_timestamp_format_combobox->setEditable(true);
QString l_current_format = ao_app->get_log_timestamp_format();
ui_log_timestamp_format_combobox->setCurrentText(l_current_format);
ui_log_timestamp_format_combobox->addItem("h:mm:ss AP"); // 2:13:09 PM
ui_log_timestamp_format_combobox->addItem("hh:mm:ss"); // 14:13:09
ui_log_timestamp_format_combobox->addItem("h:mm AP"); // 2:13 PM
ui_log_timestamp_format_combobox->addItem("hh:mm"); // 14:13
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_timestamp_format_combobox);
connect(ui_log_timestamp_format_combobox, &QComboBox::currentTextChanged, this, &AOOptionsDialog::on_timestamp_format_edited);
if(!ao_app->get_log_timestamp()) {
ui_log_timestamp_format_combobox->setDisabled(true);
}
row += 1;
ui_log_ic_actions_lbl = new QLabel(ui_form_logging_widget);
ui_log_ic_actions_lbl->setText(tr("Log IC actions:"));
ui_log_ic_actions_lbl->setToolTip(
tr("If ticked, log will show IC actions such as shouting and presenting evidence."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_ic_actions_lbl);
ui_log_ic_actions_cb = new QCheckBox(ui_form_logging_widget);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_ic_actions_cb);
row += 1;
ui_desync_logs_lbl = new QLabel(ui_form_logging_widget);
ui_desync_logs_lbl->setText(tr("Desynchronize IC Logs:"));
ui_desync_logs_lbl->setToolTip(
tr("If ticked, log will show messages as-received, while viewport will parse according to the queue (Text Stay Time)."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_desync_logs_lbl);
ui_desync_logs_cb = new QCheckBox(ui_form_logging_widget);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_desync_logs_cb);
//Check whether mass logging is enabled
row += 1;
ui_log_text_lbl = new QLabel(ui_form_logging_widget);
ui_log_text_lbl->setText(tr("Log to Text Files:"));
ui_log_text_lbl->setToolTip(
tr("Text logs of gameplay will be automatically written in the /logs folder."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_text_lbl);
ui_log_text_cb = new QCheckBox(ui_form_logging_widget);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_text_cb);
row += 1;
ui_log_demo_lbl = new QLabel(ui_form_logging_widget);
ui_log_demo_lbl->setText(tr("Log to Demo Files:"));
ui_log_demo_lbl->setToolTip(
tr("Gameplay will be automatically recorded as demos in the /logs folder."));
ui_logging_form->setWidget(row, QFormLayout::LabelRole, ui_log_demo_lbl);
ui_log_demo_cb = new QCheckBox(ui_form_logging_widget);
ui_logging_form->setWidget(row, QFormLayout::FieldRole, ui_log_demo_cb);
// Finish logging tab
QScrollArea *log_scroll = new QScrollArea(this);
log_scroll->setWidget(ui_form_logging_widget);
ui_logging_tab->setLayout(new QVBoxLayout);
ui_logging_tab->layout()->addWidget(log_scroll);
ui_logging_tab->show();
// Privacy tab
ui_privacy_tab = new QWidget(this);
ui_settings_tabs->addTab(ui_privacy_tab, tr("Privacy"));