aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aoapplication.h3
-rw-r--r--courtroom.cpp18
-rw-r--r--courtroom.h4
-rw-r--r--text_file_functions.cpp12
4 files changed, 29 insertions, 8 deletions
diff --git a/aoapplication.h b/aoapplication.h
index d94cd2af..33d18c79 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -140,6 +140,9 @@ public:
// Returns the username the user may have set in config.ini.
QString get_default_username();
+ // Returns whether the user would like to have custom shownames on by default.
+ bool get_showname_enabled_by_default();
+
//Returns the list of words in callwords.ini
QStringList get_call_words();
diff --git a/courtroom.cpp b/courtroom.cpp
index f9259b74..ec1393bd 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -169,6 +169,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_guard->setText("Guard");
ui_guard->hide();
+ ui_showname_enable = new QCheckBox(this);
+ ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default());
+ ui_showname_enable->setText("Custom shownames");
+ ui_showname_enable;
+
ui_custom_objection = new AOButton(this, ao_app);
ui_realization = new AOButton(this, ao_app);
ui_mute = new AOButton(this, ao_app);
@@ -278,6 +283,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
+ connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked()));
+
connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked()));
set_widgets();
@@ -489,6 +496,8 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_guard, "guard");
+ set_size_and_pos(ui_showname_enable, "showname_enable");
+
set_size_and_pos(ui_custom_objection, "custom_objection");
ui_custom_objection->set_image("custom.png");
@@ -985,7 +994,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
return;
QString f_showname;
- if (m_chatmessage[SHOWNAME].isEmpty())
+ if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
{
f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
}
@@ -1077,7 +1086,7 @@ void Courtroom::handle_chatmessage_2()
ui_vp_speedlines->stop();
ui_vp_player_char->stop();
- if (m_chatmessage[SHOWNAME].isEmpty())
+ if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
{
QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
@@ -2497,6 +2506,11 @@ void Courtroom::on_guard_clicked()
ui_ic_chat_message->setFocus();
}
+void Courtroom::on_showname_enable_clicked()
+{
+ ui_ic_chat_message->setFocus();
+}
+
void Courtroom::on_evidence_button_clicked()
{
if (ui_evidence->isHidden())
diff --git a/courtroom.h b/courtroom.h
index eb6638a4..4b47558e 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -351,6 +351,8 @@ private:
QCheckBox *ui_flip;
QCheckBox *ui_guard;
+ QCheckBox *ui_showname_enable;
+
AOButton *ui_custom_objection;
AOButton *ui_realization;
AOButton *ui_mute;
@@ -500,6 +502,8 @@ private slots:
void on_flip_clicked();
void on_guard_clicked();
+ void on_showname_enable_clicked();
+
void on_evidence_button_clicked();
void on_evidence_delete_clicked();
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index 1389cf58..8ddeb6cb 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -102,13 +102,13 @@ int AOApplication::get_max_log_size()
bool AOApplication::get_log_goes_downwards()
{
QString f_result = read_config("log_goes_downwards");
+ return f_result.startsWith("true");
+}
- if (f_result == "true")
- return true;
- else if (f_result == "false")
- return false;
- else
- return true;
+bool AOApplication::get_showname_enabled_by_default()
+{
+ QString f_result = read_config("show_custom_shownames");
+ return f_result.startsWith("true");
}
QString AOApplication::get_default_username()