diff options
| author | Crystalwarrior <Varsash@Gmail.com> | 2020-08-19 19:16:41 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-19 11:16:41 -0500 |
| commit | cef0ebc6eb2ac549a5475bee332be35ab7f565fc (patch) | |
| tree | d0a250c7d7061432bde6a5b6d2aa46cb90d6f023 /include | |
| parent | c984c57102bd269fed48a6b84fa9546f48e23dc9 (diff) | |
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)
Diffstat (limited to 'include')
| -rw-r--r-- | include/aoapplication.h | 9 | ||||
| -rw-r--r-- | include/aooptionsdialog.h | 6 | ||||
| -rw-r--r-- | include/chatlogpiece.h | 8 | ||||
| -rw-r--r-- | include/courtroom.h | 19 |
4 files changed, 36 insertions, 6 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index f4685eca..b44c8a80 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 2b8c879b..fe99626a 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 14d4b349..da78d0da 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 df75cce5..979650a3 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<br>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(); |
