Merge branch 'master' into feature/timerclock

# Conflicts:
#	include/courtroom.h
This commit is contained in:
Crystalwarrior 2021-01-12 11:55:08 +03:00
commit 49c3dcdee5
15 changed files with 785 additions and 388 deletions

View File

@ -170,6 +170,14 @@ public:
// Returns the value of default_blip in config.ini
int get_default_blip();
// Returns the value if objections interrupt and skip the message queue
// from the config.ini.
bool is_instant_objection_enabled();
// returns if log will show messages as-received, while viewport will parse according to the queue (Text Stay Time)
// from the config.ini
bool is_desyncrhonized_logs_enabled();
// Returns the value of whether Discord should be enabled on startup
// from the config.ini.
bool is_discord_enabled();
@ -212,6 +220,9 @@ public:
// may contain, from config.ini.
int get_max_log_size();
// Current wait time between messages for the queue system
int stay_time();
// Returns whether the log should go upwards (new behaviour)
// or downwards (vanilla behaviour).
bool get_log_goes_downwards();

View File

@ -52,6 +52,12 @@ private:
QSpinBox *ui_log_margin_spinbox;
QLabel *ui_log_timestamp_lbl;
QCheckBox *ui_log_timestamp_cb;
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_log_ic_actions_lbl;
QCheckBox *ui_log_ic_actions_cb;
QFrame *ui_log_names_divider;

View File

@ -42,6 +42,7 @@
#include <QTextBrowser>
#include <QTreeWidget>
#include <QVector>
#include <QQueue>
#include <QBrush>
#include <QDebug>
@ -93,6 +94,13 @@ public:
arup_locks.append(locked);
}
void arup_clear() {
arup_players.clear();
arup_statuses.clear();
arup_cms.clear();
arup_locks.clear();
}
void arup_modify(int type, int place, QString value)
{
if (type == 0) {
@ -211,12 +219,46 @@ public:
void append_server_chatmessage(QString p_name, QString p_message,
QString p_color);
// these functions handle chatmessages sequentially.
// The process itself is very convoluted and merits separate documentation
// But the general idea is objection animation->pre animation->talking->idle
void handle_chatmessage(QStringList *p_contents);
void handle_chatmessage_2();
void handle_chatmessage_3();
// Add the message packet to the stack
void chatmessage_enqueue(QStringList p_contents);
// Parse the chat message packet and unpack it into the m_chatmessage[ITEM] format
void unpack_chatmessage(QStringList p_contents);
// Log the message contents and information such as evidence presenting etc. into the log file
void log_chatmessage(QString f_message, int f_char_id, QString f_showname = "", int f_color = 0);
// Display the message contents and information such as evidence presenting etc. in the IC logs
void display_log_chatmessage(QString f_message, int f_char_id, QString f_showname = "", int f_color = 0);
// Log the message contents and information such as evidence presenting etc. into the IC logs
void handle_callwords();
// Handle the objection logic, if it's interrupting the currently parsing message.
// Returns true if this message has an objection, otherwise returns false. The result decides when to call handle_ic_message()
bool handle_objection();
// Display the evidence image box when presenting evidence in IC
void display_evidence_image();
// Handle the stuff that comes when the character appears on screen and starts animating (preanims etc.)
void handle_ic_message();
// Display the character.
void display_character();
// Display the character's pair if present.
void display_pair_character(QString other_charid, QString other_offset);
// Handle the emote modifier value and proceed through the logic accordingly.
void handle_emote_mod(int emote_mod, bool p_immediate);
// Initialize the chatbox image, showname shenanigans, custom chatboxes, etc.
void initialize_chatbox();
// Finally start displaying the chatbox we initialized, display the evidence, and play the talking or idle emote for the character.
// Callwords are also handled here.
void handle_ic_speaking();
// This function filters out the common CC inline text trickery, for appending
// to the IC chatlog.
@ -360,8 +402,14 @@ private:
// True, if the log should have a timestamp.
bool log_timestamp = false;
// How long in miliseconds should the objection wait before appearing.
int objection_threshold = 1500;
// delay before chat messages starts ticking
QTimer *text_delay_timer;
// delay before the next queue entry is going to be processed
QTimer *text_queue_timer;
// delay before sfx plays
QTimer *sfx_delay_timer;
@ -710,7 +758,6 @@ private:
void refresh_evidence();
void set_evidence_page();
void reset_ic();
void reset_ui();
void regenerate_ic_chatlog();
@ -880,6 +927,9 @@ private slots:
void on_casing_clicked();
void ping_server();
// Proceed to parse the oldest chatmessage and remove it from the stack
void chatmessage_dequeue();
};
#endif // COURTROOM_H

View File

@ -696,7 +696,7 @@ Grund: </translation>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="241"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translation>Keine Unterbrechung</translation>
</message>
<message>

View File

@ -553,7 +553,7 @@ Reason: %1</source>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="241"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translation type="unfinished"></translation>
</message>
<message>

View File

@ -739,7 +739,7 @@ Razón: </translation>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="210"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translatorcomment>A translation wouldn&apos;t fit because of the shitty theme system.</translatorcomment>
<translation></translation>
</message>

View File

@ -563,7 +563,7 @@ Reason: %1</source>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="241"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translation type="unfinished"></translation>
</message>
<message>

View File

@ -620,7 +620,7 @@ Powód: %1</translation>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="241"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translation>Bez ociągania się</translation>
</message>
<message>

View File

@ -709,7 +709,7 @@ Motivo: %1</translation>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="210"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translatorcomment>A translation wouldn&apos;t fit because of the shitty theme system.</translatorcomment>
<translation></translation>
</message>

View File

@ -621,7 +621,7 @@ Reason: </source>
</message>
<message>
<location filename="../../src/courtroom.cpp" line="241"/>
<source>No Interrupt</source>
<source>Immediate</source>
<translation type="unfinished"></translation>
</message>
<message>

View File

@ -25,7 +25,10 @@ void AOEmoteButton::set_image(QString p_image, QString p_emote_comment)
"\") 0 0 0 0 stretch stretch; }"
"QToolTip { color: #000000; background-color: #ffffff; border: 0px; }");
}
else if (p_image.contains("_on") && file_exists(tmp_p_image.replace("_on", "_off"))) {
else if ((p_image.contains("_on") &&
file_exists(tmp_p_image.replace("_on", "_off"))) ||
(p_image.contains("_off") &&
file_exists(tmp_p_image.replace("_off", "_on")))) {
QImage tmpImage(tmp_p_image);
tmpImage = tmpImage.convertToFormat(QImage::Format_ARGB32);
QPoint p1, p2;

View File

@ -176,6 +176,48 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_ic_actions_cb);
row += 1;
ui_stay_time_lbl = new QLabel(ui_form_layout_widget);
ui_stay_time_lbl->setText(tr("Text Stay Time:"));
ui_stay_time_lbl->setToolTip(tr(
"Minimum amount of time (in miliseconds) an IC message must stay on screen before "
"the next IC message is shown, acting as a 'queue'. Set to 0 to disable this behaivor."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stay_time_lbl);
ui_stay_time_spinbox = new QSpinBox(ui_form_layout_widget);
ui_stay_time_spinbox->setMaximum(10000);
ui_stay_time_spinbox->setValue(p_ao_app->stay_time());
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_desync_logs_cb->setChecked(p_ao_app->get_log_timestamp());
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:"));
ui_instant_objection_lbl->setToolTip(
tr("If Text Stay Time is more than 0, instant objection will skip queued messages instead of waiting to catch up."));
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_instant_objection_lbl);
ui_instant_objection_cb = new QCheckBox(ui_form_layout_widget);
ui_instant_objection_cb->setChecked(ao_app->is_instant_objection_enabled());
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_instant_objection_cb);
row += 1;
ui_log_names_divider = new QFrame(ui_form_layout_widget);
ui_log_names_divider->setFrameShape(QFrame::HLine);
@ -779,6 +821,9 @@ void AOOptionsDialog::save_pressed()
configini->setValue("log_margin", ui_log_margin_spinbox->value());
configini->setValue("log_timestamp", ui_log_timestamp_cb->isChecked());
configini->setValue("log_ic_actions", ui_log_ic_actions_cb->isChecked());
configini->setValue("desync_logs", ui_desync_logs_cb->isChecked());
configini->setValue("stay_time", ui_stay_time_spinbox->value());
configini->setValue("instant_objection", ui_instant_objection_cb->isChecked());
configini->setValue("default_username", ui_username_textbox->text());
configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
configini->setValue("master", ui_ms_textbox->text());

File diff suppressed because it is too large Load Diff

View File

@ -286,7 +286,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
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'");
"/'yyyy-MM-dd hh-mm-ss t'.log'");
this->write_to_file("Joined server " + server_name + " on address " +
server_address + " on " +
QDateTime::currentDateTime().toUTC().toString(),
@ -413,9 +413,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
goto end;
w_courtroom->clear_areas();
w_courtroom->arup_clear();
for (int n_element = 0; n_element < f_contents.size(); ++n_element) {
w_courtroom->append_area(f_contents.at(n_element));
w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
}
w_courtroom->list_areas();
@ -473,7 +475,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
else if (header == "MS") {
if (courtroom_constructed && courtroom_loaded)
w_courtroom->handle_chatmessage(&p_packet->get_contents());
w_courtroom->chatmessage_enqueue(p_packet->get_contents());
}
else if (header == "MC") {
if (courtroom_constructed && courtroom_loaded)

View File

@ -46,6 +46,12 @@ int AOApplication::get_max_log_size()
return result;
}
int AOApplication::stay_time()
{
int result = configini->value("stay_time", 200).toInt();
return result;
}
bool AOApplication::get_log_goes_downwards()
{
QString result =
@ -854,7 +860,7 @@ QString AOApplication::get_flash_frame(QString p_char, QString p_emote,
int AOApplication::get_text_delay(QString p_char, QString p_emote)
{
QString f_result = read_char_ini(p_char, p_emote, "TextDelay");
QString f_result = read_char_ini(p_char, p_emote, "stay_time");
if (f_result == "")
return -1;
@ -979,6 +985,18 @@ bool AOApplication::objection_stop_music()
return result.startsWith("true");
}
bool AOApplication::is_instant_objection_enabled()
{
QString result = configini->value("instant_objection", "true").value<QString>();
return result.startsWith("true");
}
bool AOApplication::is_desyncrhonized_logs_enabled()
{
QString result = configini->value("desync_logs", "false").value<QString>();
return result.startsWith("true");
}
bool AOApplication::is_discord_enabled()
{
QString result = configini->value("discord", "true").value<QString>();