aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aooptionsdialog.cpp16
-rw-r--r--src/courtroom.cpp6
-rw-r--r--src/packet_distribution.cpp17
-rw-r--r--src/text_file_functions.cpp6
4 files changed, 35 insertions, 10 deletions
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 79f1d11f..6cedee8d 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -699,6 +699,20 @@ 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_log_cb->setChecked(ao_app->get_auto_logging_enabled());
+
+ ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_log_cb);
// When we're done, we should continue the updates!
setUpdatesEnabled(true);
@@ -725,7 +739,7 @@ void AOOptionsDialog::save_pressed()
configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked());
configini->setValue("stickypres", ui_stickypres_cb->isChecked());
configini->setValue("customchat", ui_customchat_cb->isChecked());
-
+ configini->setValue("automatic_logging_enabled", ui_log_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 b203cf08..98b6a9c3 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1870,7 +1870,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
chatlogpiece *temp =
new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false, m_chatmessage[TEXT_COLOR].toInt());
ic_chatlog_history.append(*temp);
- ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
+ if (ao_app->get_auto_logging_enabled())
+ ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
while (ic_chatlog_history.size() > log_maximum_blocks &&
log_maximum_blocks > 0) {
@@ -3175,7 +3176,8 @@ void Courtroom::handle_song(QStringList *p_contents)
if (!mute_map.value(n_char)) {
chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true, m_chatmessage[TEXT_COLOR].toInt());
ic_chatlog_history.append(*temp);
- ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
+ if (ao_app->get_auto_logging_enabled())
+ ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true);
while (ic_chatlog_history.size() > log_maximum_blocks &&
log_maximum_blocks > 0) {
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 669b9541..b543cfb5 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -292,13 +292,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
// Remove any characters not accepted in folder names for the server_name
// here
- this->log_filename = QDateTime::currentDateTime().toUTC().toString(
- "'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) +
- "/'ddd MMMM yyyy hh.mm.ss t'.log'");
- this->write_to_file("Joined server " + server_name + " on address " +
- server_address + " on " +
- QDateTime::currentDateTime().toUTC().toString(),
- log_filename, true);
+ if (AOApplication::get_auto_logging_enabled()){
+ this->log_filename = QDateTime::currentDateTime().toUTC().toString(
+ "'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) +
+ "/'ddd MMMM yyyy hh.mm.ss t'.log'");
+ this->write_to_file("Joined server " + server_name + " on address " +
+ server_address + " on " +
+ QDateTime::currentDateTime().toUTC().toString(),
+ log_filename, true);
+ }
+
QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256);
hash.addData(server_address.toUtf8());
if (is_discord_enabled())
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index 2340bd87..39754f39 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -1049,3 +1049,9 @@ QString AOApplication::get_casing_can_host_cases()
.value<QString>();
return result;
}
+bool AOApplication::get_auto_logging_enabled()
+{
+ QString result =
+ configini->value("automatic_logging_enabled", "true").value<QString>();
+ return result.startsWith("true");
+}