atrooney-online-2/include/aooptionsdialog.h
Crystalwarrior 2d1de1fb54
Desynchronize viewport from the IC chat log so that users have a smooth viewing experience as an option (#385)
* Begin trying to understand handle_chatmessage monstrosity
Rearrange some functionality to be more consistent with what the particular handle_chatmessage is *supposed* to be responsible for
Single responsibility principle doesn't apply not just to script files but even functions in this goddamned program apparently.

* Fix some oversights relating to "has presented evidence" logs

* Fix an edge case crash with negative evidence, idk why this didn't happen before.

* Completely refactor handle_chatmessage hell and split it up into single-responsibility-principle functions like a sane and organized coder would.
This will break any PRs that touch handle_chatmessage and will have to conform to the new standard, but it's very good in the long run.
Functions have also been meticulously commentated to make sure that everyone can understand at a glance what everything does.
This refactor is done to pave way for smooth viewport, making characters no longer randomly interrupt each other when speaking.

* Rename confusingly named "handle_chatbox" to "handle_ic_speaking"
Add a new function "handle_callwords"

* Parse blankposts in the packet unpacking phase
log_chatmessage is now an argument-based funciton instead of using m_chatmessage monstrosity
Commentate the heck out of log_chatmessage
Fix showname displaying logic being bonkers for log entries
Fix -1 char_id most likely crashing client, even tho they're supposed to be system messages
Fix [CHARID] being referenced instead of [OTHER_CHARID] in the pair display func
Fix chat message color being used for "has played a song" even though it shouldn't

* Move setting emote_mod from the objection thing to the packet unpacking thing
handle_emote_mod has become argumented

* Make display_pair_character take in only vars it needs

* Add functionality for message stacks (does not handle logging separately yet)
Currently segfaults at line 1823 if stacking behavior actually occurs. Plz help I'm poopie brain at this

* Make sense of pointers and dereference some pointers to prevent wacky errors
Replace _stack with _queue, and turn it into a QQueue

* Implement a minimum text delay queue timer so that each msg must stay on screen for a specified amount of time
Chat_arrow only shows up when the minimum text delay has expired
Check if target is muted in the enqueueing, as well as the validity of the character id, so we don't even bother adding it to the queue
Add a settings option to set text stay time (minimum amount of time to pass before displaying the next message).
TODO: Handle queued interjections in a cooler way

* Adjust default option for stay_time to be 200ms
Make the stay_time setting of 0 disable the queue system entirely

* Make interjections force-clear the message queue
Use interjections to instantly process those messages - objections are usually extremely important and must have everyone's immediate attention.
TODO: Add a settings option for interjection behavior

* Clear message queue when bg display packet is received

* Add an instant objection setting which, when enabled, will interrupt and skip the message queue on objections (effectively bypassing text_delay system)

* Stop using AOPacket for the queue and use QStringList instead (packet contents, we don't care for the header)
Implement objection threshold which works in a queue if instant objections are disabled (not exposed to the settings yet)
Modify packet contents directly instead of waiting for m_chatmessage shenanigans (we should deprecate this soon)
Rename isinstant_objection_enabled options check to be more consistent

* Make it so objections display as soon as the message is over if instant_objection is disabled

* Remove emote_mod = "1" thing that had no real purpose
Implement desynchronized logs settings option, which is false by default, meaning users' messages and display IC logs are going to be in sync.
Split up display and logging behavior, meaning IC logs will be saved with accurate timings on the .logs file, while display can be slower.
Remove dumb "System" showname thing cuz it was dumb

* Bring back minimum packet size safety check

* Make sure shouts are properly logged. I am very sorry for this horrible amount of code duplication though.

* fix compile errors

* fix html parsing error

* Rearrange the order of logging so IC messages go like this:
* shouts go first
* evidence goes second
* chat message goes last

* Fix No Interrupt coming back, go away you foolish beast

* fix borked options dialog

* Crank down "press enter delay" from 600ms to 200ms so it's not as harsh

Co-authored-by: in1tiate <radwoodward@vikings.grayson.edu>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
2021-01-12 11:24:11 +03:00

161 lines
4.1 KiB
C++

#ifndef AOOPTIONSDIALOG_H
#define AOOPTIONSDIALOG_H
#include "aoapplication.h"
#include "bass.h"
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QFrame>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPlainTextEdit>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
#include <QDirIterator>
#include <QTextStream>
class AOOptionsDialog : public QDialog {
Q_OBJECT
public:
explicit AOOptionsDialog(QWidget *parent = nullptr,
AOApplication *p_ao_app = nullptr);
private:
AOApplication *ao_app;
QVBoxLayout *ui_vertical_layout;
QTabWidget *ui_settings_tabs;
QWidget *ui_gameplay_tab;
QWidget *ui_form_layout_widget;
QFormLayout *ui_gameplay_form;
QLabel *ui_theme_label;
QComboBox *ui_theme_combobox;
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_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;
QLineEdit *ui_username_textbox;
QLabel *ui_username_lbl;
QLabel *ui_showname_lbl;
QCheckBox *ui_showname_cb;
QFrame *ui_net_divider;
QLabel *ui_ms_lbl;
QLineEdit *ui_ms_textbox;
QLabel *ui_discord_lbl;
QCheckBox *ui_discord_cb;
QLabel *ui_language_label;
QComboBox *ui_language_combobox;
QLabel *ui_shake_lbl;
QCheckBox *ui_shake_cb;
QLabel *ui_effects_lbl;
QCheckBox *ui_effects_cb;
QLabel *ui_framenetwork_lbl;
QCheckBox *ui_framenetwork_cb;
QLabel *ui_colorlog_lbl;
QCheckBox *ui_colorlog_cb;
QLabel *ui_stickysounds_lbl;
QCheckBox *ui_stickysounds_cb;
QLabel *ui_stickyeffects_lbl;
QCheckBox *ui_stickyeffects_cb;
QLabel *ui_stickypres_lbl;
QCheckBox *ui_stickypres_cb;
QLabel *ui_customchat_lbl;
QCheckBox *ui_customchat_cb;
QWidget *ui_callwords_tab;
QWidget *ui_callwords_widget;
QVBoxLayout *ui_callwords_layout;
QPlainTextEdit *ui_callwords_textbox;
QLabel *ui_callwords_explain_lbl;
QCheckBox *ui_callwords_char_textbox;
QWidget *ui_audio_tab;
QWidget *ui_audio_widget;
QFormLayout *ui_audio_layout;
QLabel *ui_audio_device_lbl;
QComboBox *ui_audio_device_combobox;
QFrame *ui_audio_volume_divider;
QSpinBox *ui_music_volume_spinbox;
QLabel *ui_music_volume_lbl;
QSpinBox *ui_sfx_volume_spinbox;
QSpinBox *ui_blips_volume_spinbox;
QLabel *ui_sfx_volume_lbl;
QLabel *ui_blips_volume_lbl;
QFrame *ui_volume_blip_divider;
QSpinBox *ui_bliprate_spinbox;
QLabel *ui_bliprate_lbl;
QCheckBox *ui_blank_blips_cb;
QLabel *ui_blank_blips_lbl;
QLabel *ui_loopsfx_lbl;
QCheckBox *ui_loopsfx_cb;
QLabel *ui_objectmusic_lbl;
QCheckBox *ui_objectmusic_cb;
QDialogButtonBox *ui_settings_buttons;
QWidget *ui_casing_tab;
QWidget *ui_casing_widget;
QFormLayout *ui_casing_layout;
QLabel *ui_casing_supported_lbl;
QLabel *ui_casing_enabled_lbl;
QCheckBox *ui_casing_enabled_cb;
QLabel *ui_casing_def_lbl;
QCheckBox *ui_casing_def_cb;
QLabel *ui_casing_pro_lbl;
QCheckBox *ui_casing_pro_cb;
QLabel *ui_casing_jud_lbl;
QCheckBox *ui_casing_jud_cb;
QLabel *ui_casing_jur_lbl;
QCheckBox *ui_casing_jur_cb;
QLabel *ui_casing_steno_lbl;
QCheckBox *ui_casing_steno_cb;
QLabel *ui_casing_cm_lbl;
QCheckBox *ui_casing_cm_cb;
QLabel *ui_casing_cm_cases_lbl;
QLineEdit *ui_casing_cm_cases_textbox;
QLabel *ui_log_lbl;
QCheckBox *ui_log_cb;
bool needs_default_audiodev();
signals:
public slots:
void save_pressed();
void discard_pressed();
};
#endif // AOOPTIONSDIALOG_H