From 8b44d4ae9599a90579c4fb974fab1704ace8d131 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sat, 15 Aug 2020 19:40:52 -0500 Subject: Only regenerate the area list once per ARUP packet --- include/courtroom.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/courtroom.h b/include/courtroom.h index 182c2a6..e7a51d3 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -109,7 +109,6 @@ public: if (arup_locks.size() > place) arup_locks[place] = value; } - list_areas(); } void character_loading_finished(); -- cgit From 102ca4d64143ecb9401fdb1627ada00194d58dd1 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sat, 15 Aug 2020 19:47:24 -0500 Subject: Create brushes for area list once --- include/courtroom.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/courtroom.h b/include/courtroom.h index e7a51d3..f1cb026 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -457,6 +457,14 @@ private: QString current_background = "default"; QString current_side = ""; + QBrush free_brush; + QBrush lfp_brush; + QBrush casing_brush; + QBrush recess_brush; + QBrush rp_brush; + QBrush gaming_brush; + QBrush locked_brush; + AOMusicPlayer *music_player; AOSfxPlayer *sfx_player; AOSfxPlayer *objection_player; -- cgit From 11250e13864dc5e3cdd799b02498905c58db55ea Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sun, 16 Aug 2020 06:50:19 -0500 Subject: Ensure consistent behavior in IC log, clarify showname logic, and define constants for minimum and maximum packet sizes --- include/courtroom.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/courtroom.h b/include/courtroom.h index 182c2a6..6132ed9 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -349,8 +349,10 @@ private: // amount by which we multiply the delay when we parse punctuation chars const int punctuation_modifier = 3; - static const int chatmessage_size = 30; - QString m_chatmessage[chatmessage_size]; + // Minumum and maximum number of parameters in the MS packet + static const int MS_MINIMUM = 15; + static const int MS_MAXIMUM = 30; + QString m_chatmessage[MS_MAXIMUM]; bool chatmessage_is_empty = false; QString previous_ic_message = ""; -- cgit From 1c5b097f654d16e0dde47f7ae62d236427077cb7 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sun, 16 Aug 2020 12:43:26 -0500 Subject: further cleanup of chat handler --- include/courtroom.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/courtroom.h b/include/courtroom.h index a4bacc2..ca271a4 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -648,6 +648,8 @@ private: void refresh_evidence(); void set_evidence_page(); + void reset_ic(); + void reset_ui(); public slots: void objection_done(); void preanim_done(); -- cgit From ecb0ee42a3a399c092eafdf2ac60faaad4bf119f Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sun, 16 Aug 2020 21:59:44 -0500 Subject: clang format --- include/courtroom.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/courtroom.h b/include/courtroom.h index ca271a4..898e8ba 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -117,7 +117,9 @@ public: void set_widgets(); // sets font size based on theme ini files - void set_font(QWidget *widget, QString class_name, QString p_identifier, QString p_char="", QString font_name="", int f_pointsize=0); + void set_font(QWidget *widget, QString class_name, QString p_identifier, + QString p_char = "", QString font_name = "", + int f_pointsize = 0); // Get the properly constructed font QFont get_qfont(QString font_name, int f_pointsize, bool antialias = true); @@ -127,7 +129,7 @@ public: QColor f_color = Qt::black, bool bold = false); // helper function that calls above function on the relevant widgets - void set_fonts(QString p_char=""); + void set_fonts(QString p_char = ""); // sets dropdown menu stylesheet void set_dropdown(QWidget *widget); @@ -220,7 +222,8 @@ public: // this function keeps the chatlog scrolled to the top unless there's text // selected // or the user isn't already scrolled to the top - void append_ic_text(QString p_text, QString p_name = "", QString action = "", int color = 0); + void append_ic_text(QString p_text, QString p_name = "", QString action = "", + int color = 0); // prints who played the song to IC chat and plays said song(if found on local // filesystem) takes in a list where the first element is the song name and -- cgit From 475a572c3bdb0f1d4a7353b9c61bbfac71888ef9 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 18 Aug 2020 18:02:53 +0300 Subject: Improved blankposting (#256) * Consolidate blankposting into singular log entries of "no message" instead of spamming the logs repeatedly when someone decides to keep switching emotes Return proper blankpost checking to 2.8.5 (chatmessage_is_empty bool makes sure the chatbox doesn't appear - branch broke that behavior by never setting it) More robust blankpost checking, meaning that passing a competely empty "" string will also count as a blankpost Fix screenshake not working with blankposting by moving it before the chatmessage_is_empty check in start_chack_ticking() stage of the message parsing * Allow user to send blankposts without even having to input a single spacebar, but only if last m_chatmessage CID matches ours. * Reviews are cool and good:ok_hand: allow sending no-text chat message to server without weird cid checks (let the server validate if they want to do STR_OR_EMPTY or just STR) - doesn't break existing behavior and lets servers introduce the new one if they want to Treat all blank/whitespace messages as blankposting and not just single-whitespace. Remove chatmessage_is_empty bool because why the fuck would you even need it if you have m_chatmessage[MESSAGE] already Simplify chatlogpiece log entry to not be a *temp pointer by suggestion * another useless bool destroyed Make "additive" have a very awesome emergent behavior with blankposting - keep showing the chatbox+message while only changing the emotes. Works with preanims too! --- include/courtroom.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/courtroom.h b/include/courtroom.h index 898e8ba..df75cce 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -315,9 +315,6 @@ private: bool rainbow_appended = false; bool blank_blip = false; - // Whether or not is this message additive to the previous one - bool is_additive = false; - // Used for getting the current maximum blocks allowed in the IC chatlog. int log_maximum_blocks = 0; @@ -355,7 +352,6 @@ private: static const int MS_MINIMUM = 15; static const int MS_MAXIMUM = 30; QString m_chatmessage[MS_MAXIMUM]; - bool chatmessage_is_empty = false; QString previous_ic_message = ""; QString additive_previous = ""; -- cgit From cef0ebc6eb2ac549a5475bee332be35ab7f565fc Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 19 Aug 2020 19:16:41 +0300 Subject: IC log rewrite (#259) * Rewrite the IC Log code to drastically reduce code duplication and have both downward and upward mode in the same function Regenerate the IC Log in set_widgets() function, making sure the maximum_blocks is accounted for and clearing the log to prepare for different log mode (upwards/downwards) if it's different from previous Add placeholder text telling the user the direction in which the log will go Remove useless first_message_sent global boolean, a remnant from a w e a k e r c o d e r m a n * Add log_colors boolean to reduce color I/O happening in append_ic_text (optimization meme) Clear the IC log when log_colors setting changes and reload theme is pressed Fix https://github.com/AttorneyOnline/AO2-Client/issues/221 * Add configurable margin between IC log entries Add configurable newline/singleline log mode Options in settings for these * Add optional timestamps * Un-hardcode "played music" from the chatlogpiece and introduce the "action" argument so that "presented evidence" is fully supported now Translate "has presented evidence" Regenerate IC chatlog instead of clearing it, properly updating every element with the new configurations * Go away *temp, code duplication making me shid and cry rn Why is this not done in append_ic_text, or why isn't there a dedicated ic logging func aAAAaaaaAAAaa Fix presenting evidence not being properly logged Fix timestamp being UTC instead of local time (local time will not be as confusing) * okok it was a joke a big ol bamboozle you got gnomed haha rick rolled beaned stickbugged I did NOT copy paste code, no, I actually intended to fix copy pasted code all along. log_ic_text was always planned. (Fix copypasted code for ic_chatlog_history and consolidate it into a single log_ic_text func) --- include/aoapplication.h | 9 +++++++++ include/aooptionsdialog.h | 6 ++++++ include/chatlogpiece.h | 8 ++++---- include/courtroom.h | 19 +++++++++++++++++-- 4 files changed, 36 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index f4685ec..b44c8a8 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -213,6 +213,15 @@ public: // or downwards (vanilla behaviour). bool get_log_goes_downwards(); + // Returns whether the log should separate name from text via newline or : + bool get_log_newline(); + + // Get spacing between IC log entries. + int get_log_margin(); + + // Returns whether the log should have a timestamp. + bool get_log_timestamp(); + // Returns the username the user may have set in config.ini. QString get_default_username(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 2b8c879..fe99626 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -46,6 +46,12 @@ private: 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; QFrame *ui_log_names_divider; QLineEdit *ui_username_textbox; QLabel *ui_username_lbl; diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 14d4b34..da78d0d 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -10,14 +10,14 @@ class chatlogpiece { public: chatlogpiece(); chatlogpiece(QString p_name, QString p_showname, QString p_message, - bool p_song,int color); + QString p_action,int color); chatlogpiece(QString p_name, QString p_showname, QString p_message, - bool p_song, int color, QDateTime p_datetime); + QString p_action, int color, QDateTime p_datetime); QString get_name(); QString get_showname(); QString get_message(); - bool is_song(); + QString get_action(); QDateTime get_datetime(); QString get_datetime_as_string(); int get_chat_color(); @@ -27,9 +27,9 @@ private: QString name; QString showname; QString message; + QString action; QDateTime datetime; int color; - bool p_is_song; }; #endif // CHATLOGPIECE_H diff --git a/include/courtroom.h b/include/courtroom.h index df75cce..979650a 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -218,6 +218,8 @@ public: QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, int default_color = 0); + void log_ic_text(QString p_name, QString p_showname, QString p_message, QString p_action="", int p_color=0); + // adds text to the IC chatlog. p_name first as bold then p_text then a newlin // this function keeps the chatlog scrolled to the top unless there's text // selected @@ -262,7 +264,6 @@ private: int m_viewport_width = 256; int m_viewport_height = 192; - bool first_message_sent = false; int maximumMessages = 0; QParallelAnimationGroup *screenshake_animation_group = @@ -319,7 +320,19 @@ private: int log_maximum_blocks = 0; // True, if the log should go downwards. - bool log_goes_downwards = false; + bool log_goes_downwards = true; + + // True, if log should display colors. + bool log_colors = true; + + // True, if the log should display the message like name
text instead of name: text + bool log_newline = false; + + // Margin in pixels between log entries for the IC log. + int log_margin = 0; + + // True, if the log should have a timestamp. + bool log_timestamp = false; // delay before chat messages starts ticking QTimer *text_delay_timer; @@ -649,6 +662,8 @@ private: void reset_ic(); void reset_ui(); + + void regenerate_ic_chatlog(); public slots: void objection_done(); void preanim_done(); -- cgit From 9eb0f53db1ae87058458eae267f2a72e3a0a8091 Mon Sep 17 00:00:00 2001 From: scatterflower <2956568+scatterflower@users.noreply.github.com> Date: Wed, 19 Aug 2020 16:40:37 -0500 Subject: Reset BASS when switching devices; drop Qt Multimedia support (#262) * Allow changing audio device on the fly while in a server * Use default audio device if device in config doesn't exist * Automatically change audio device to default when current one is invalid * Destroy Qt Multimedia support It was decided that there was not enough attention being given to Qt Multimedia support to justify its continued maintenance simply as a libre alternative to BASS. While substantial changes to audio were being made in 2.8, the Qt Multimedia support code fell behind in disrepair. It's clear that there is no vested interest in implementing audio features twice for the sake of licensing. When it's time to switch to another audio library, it will be done unilaterally. * CI: Use BASS for Linux build Co-authored-by: oldmud0 --- include/aoapplication.h | 18 +++++++++++------- include/aoblipplayer.h | 8 -------- include/aomusicplayer.h | 8 -------- include/aosfxplayer.h | 8 -------- include/courtroom.h | 2 -- 5 files changed, 11 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index b44c8a8..f0e0545 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -5,6 +5,9 @@ #include "datatypes.h" #include "discord_rich_presence.h" +#include "bass.h" +#include "bassopus.h" + #include #include #include @@ -23,9 +26,6 @@ #include #include #include -#ifdef QTAUDIO -#include -#endif class NetworkManager; class Lobby; @@ -202,7 +202,8 @@ public: // Returns the value of whether custom chatboxes should be a thing. // from the config.ini. - // I am increasingly maddened by the lack of dynamic auto-generation system for settings. + // I am increasingly maddened by the lack of dynamic auto-generation system + // for settings. bool is_customchat_enabled(); // Returns the value of the maximum amount of lines the IC chatlog @@ -227,9 +228,6 @@ public: // Returns the audio device used for the client. QString get_audio_output_device(); -#ifdef QTAUDIO - QAudioDeviceInfo QtAudioDevice; -#endif // Returns whether the user would like to have custom shownames on by default. bool get_showname_enabled_by_default(); @@ -442,6 +440,12 @@ public: // The file name of the log file in base/logs. QString log_filename; + void initBASS(); + static void load_bass_opus_plugin(); + static void CALLBACK BASSreset(HSTREAM handle, DWORD channel, DWORD data, + void *user); + static void doBASSreset(); + private: const int RELEASE = 2; const int MAJOR_VERSION = 8; diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index 5a10471..4d3b5f1 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -1,12 +1,8 @@ #ifndef AOBLIPPLAYER_H #define AOBLIPPLAYER_H -#if defined(BASSAUDIO) #include "bass.h" #include "bassopus.h" -#elif defined(QTAUDIO) -#include -#endif #include "aoapplication.h" @@ -35,11 +31,7 @@ private: void set_volume_internal(qreal p_volume); -#if defined(BASSAUDIO) HSTREAM m_stream_list[5]; -#elif defined(QTAUDIO) - QSoundEffect m_blips; -#endif }; #endif // AOBLIPPLAYER_H diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 82751b6..36031f1 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -2,12 +2,8 @@ #define AOMUSICPLAYER_H #include "file_functions.h" -#if defined(BASSAUDIO) #include "bass.h" #include "bassopus.h" -#elif defined(QTAUDIO) -#include -#endif #include "aoapplication.h" @@ -44,12 +40,8 @@ private: // Channel 1 = ambience // Channel 2 = extra // Channel 3 = extra - #if defined(BASSAUDIO) HSTREAM m_stream_list[4]; HSYNC loop_sync[4]; - #elif defined(QTAUDIO) - QMediaPlayer m_stream_list[4]; - #endif }; #endif // AOMUSICPLAYER_H diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 9918871..0a5fffa 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -1,12 +1,8 @@ #ifndef AOSFXPLAYER_H #define AOSFXPLAYER_H -#if defined(BASSAUDIO) #include "bass.h" #include "bassopus.h" -#elif defined(QTAUDIO) -#include -#endif #include "aoapplication.h" @@ -37,11 +33,7 @@ private: const int m_channelmax = 5; -#if defined(BASSAUDIO) HSTREAM m_stream_list[5]; -#elif defined(QTAUDIO) - QSoundEffect m_stream_list[5]; -#endif }; #endif // AOSFXPLAYER_H diff --git a/include/courtroom.h b/include/courtroom.h index 979650a..5b5ff6c 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -828,8 +828,6 @@ private slots: void on_casing_clicked(); void ping_server(); - - void load_bass_opus_plugin(); }; #endif // COURTROOM_H -- cgit From 7cd0fa0c6e9875c0f199c6d7448e0a031dd8e631 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Wed, 19 Aug 2020 22:56:36 -0500 Subject: version bump to 2.8.5 --- include/aoapplication.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index f0e0545..60d945e 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -449,7 +449,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 4; + const int MINOR_VERSION = 5; QString current_theme = "default"; -- cgit