aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-12-23 17:29:17 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2021-12-23 17:29:17 -0600
commit2eed786c776ba31e464e5929a6a0299a19897192 (patch)
tree82dd9106048009e219d49f7400a0b8e121cb0e85 /src
parentd9e69cca06ef98e6a0ea9bc22a990e735ee5a65f (diff)
Split logging option into text and demo
Apparently, people don't like logging demos because it takes up too much space. It's possible to enable NTFS compression for demo files (or the entire demos folder), though.
Diffstat (limited to 'src')
-rw-r--r--src/aooptionsdialog.cpp41
-rw-r--r--src/courtroom.cpp4
-rw-r--r--src/packet_distribution.cpp4
-rw-r--r--src/text_file_functions.cpp9
4 files changed, 38 insertions, 20 deletions
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 1b9342c3..b752038e 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -583,6 +583,28 @@ 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);
ui_gameplay_tab->setLayout(new QVBoxLayout);
@@ -921,19 +943,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_casing_layout->setWidget(row, QFormLayout::FieldRole,
ui_casing_cm_cases_textbox);
- //Check whether mass logging is enabled
- row += 1;
- ui_log_lbl = new QLabel(ui_casing_widget);
- ui_log_lbl->setText(tr("Automatic Logging:"));
- ui_log_lbl->setToolTip(
- tr("If checked, all logs will be automatically written in the "
- "/logs folder."));
-
- ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_log_lbl);
-
- ui_log_cb = new QCheckBox(ui_casing_widget);
-
- ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_log_cb);
// Assets tab
ui_assets_tab = new QWidget(this);
@@ -1123,7 +1132,8 @@ void AOOptionsDialog::update_values() {
ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled());
ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled());
ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled());
- ui_log_cb->setChecked(ao_app->get_auto_logging_enabled());
+ ui_log_text_cb->setChecked(ao_app->get_text_logging_enabled());
+ ui_log_demo_cb->setChecked(ao_app->get_demo_logging_enabled());
ui_length_spinbox->setValue(ao_app->get_max_log_size());
ui_log_margin_spinbox->setValue(ao_app->get_log_margin());
ui_stay_time_spinbox->setValue(ao_app->stay_time());
@@ -1181,7 +1191,8 @@ void AOOptionsDialog::save_pressed()
configini->setValue("stickypres", ui_stickypres_cb->isChecked());
configini->setValue("customchat", ui_customchat_cb->isChecked());
configini->setValue("sticker", ui_sticker_cb->isChecked());
- configini->setValue("automatic_logging_enabled", ui_log_cb->isChecked());
+ configini->setValue("automatic_logging_enabled", ui_log_text_cb->isChecked());
+ configini->setValue("demo_logging_enabled", ui_log_demo_cb->isChecked());
configini->setValue("continuous_playback", ui_continuous_cb->isChecked());
configini->setValue("category_stop", ui_category_stop_cb->isChecked());
QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 8c59f1d2..d64e5b0e 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1761,7 +1761,7 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
ui_server_chatlog->append_chatmessage(p_name, p_message, color);
- if (ao_app->get_auto_logging_enabled() && !ao_app->log_filename.isEmpty()) {
+ if (ao_app->get_text_logging_enabled() && !ao_app->log_filename.isEmpty()) {
QString full = "[OOC][" + QDateTime::currentDateTimeUtc().toString() + "] " + p_name + ": " + p_message;
ao_app->append_to_file(full, ao_app->log_filename, true);
}
@@ -3091,7 +3091,7 @@ void Courtroom::log_ic_text(QString p_name, QString p_showname,
{
chatlogpiece log_entry(p_name, p_showname, p_message, p_action, p_color);
ic_chatlog_history.append(log_entry);
- if (ao_app->get_auto_logging_enabled() && !ao_app->log_filename.isEmpty())
+ if (ao_app->get_text_logging_enabled() && !ao_app->log_filename.isEmpty())
ao_app->append_to_file(log_entry.get_full(), ao_app->log_filename, true);
while (ic_chatlog_history.size() > log_maximum_blocks &&
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index bcbc6671..066ed63c 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -107,7 +107,7 @@ end:
void AOApplication::append_to_demofile(QString packet_string)
{
- if (get_auto_logging_enabled() && !log_filename.isEmpty())
+ if (get_demo_logging_enabled() && !log_filename.isEmpty())
{
QString path = log_filename.left(log_filename.size()).replace(".log", ".demo");
if (!demo_timer.isValid())
@@ -304,7 +304,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
// Remove any characters not accepted in folder names for the server_name
// here
- if (AOApplication::get_auto_logging_enabled() && server_name != "Demo playback") {
+ if (AOApplication::get_demo_logging_enabled() && server_name != "Demo playback") {
this->log_filename = QDateTime::currentDateTime().toUTC().toString(
"'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) +
"/'yyyy-MM-dd hh-mm-ss t'.log'");
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index d873b3c1..af96b3d1 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -1067,13 +1067,20 @@ QString AOApplication::get_casing_can_host_cases()
return result;
}
-bool AOApplication::get_auto_logging_enabled()
+bool AOApplication::get_text_logging_enabled()
{
QString result =
configini->value("automatic_logging_enabled", "true").value<QString>();
return result.startsWith("true");
}
+bool AOApplication::get_demo_logging_enabled()
+{
+ QString result =
+ configini->value("demo_logging_enabled", "true").value<QString>();
+ return result.startsWith("true");
+}
+
QString AOApplication::get_subtheme()
{
QString result =