diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2020-05-22 19:17:55 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2020-05-22 19:17:55 -0500 |
| commit | fd1855b8d0ecaa56ae3165ad5d8f3bd65ff77a64 (patch) | |
| tree | 9c27d658dd8f19e649e1742b0fd39104a50a3ca6 /include | |
| parent | 8928aa2718378bc42d20d5bbe6c17be68d65d6f3 (diff) | |
| parent | 4617e3135ed14a28c4129154486022947fda9d82 (diff) | |
Merge KFO source unconditionally into AO2
Diffstat (limited to 'include')
| -rw-r--r-- | include/aoapplication.h | 136 | ||||
| -rw-r--r-- | include/aoblipplayer.h | 9 | ||||
| -rw-r--r-- | include/aocharmovie.h | 86 | ||||
| -rw-r--r-- | include/aoemotebutton.h | 8 | ||||
| -rw-r--r-- | include/aoevidencebutton.h | 11 | ||||
| -rw-r--r-- | include/aoevidencedisplay.h | 7 | ||||
| -rw-r--r-- | include/aoimage.h | 4 | ||||
| -rw-r--r-- | include/aolineedit.h | 9 | ||||
| -rw-r--r-- | include/aomovie.h | 5 | ||||
| -rw-r--r-- | include/aomusicplayer.h | 29 | ||||
| -rw-r--r-- | include/aooptionsdialog.h | 26 | ||||
| -rw-r--r-- | include/aoscene.h | 17 | ||||
| -rw-r--r-- | include/aosfxplayer.h | 21 | ||||
| -rw-r--r-- | include/aotextarea.h | 5 | ||||
| -rw-r--r-- | include/bass.h | 18 | ||||
| -rw-r--r-- | include/bassopus.h | 64 | ||||
| -rw-r--r-- | include/chatlogpiece.h | 4 | ||||
| -rw-r--r-- | include/courtroom.h | 276 | ||||
| -rw-r--r-- | include/datatypes.h | 11 | ||||
| -rw-r--r-- | include/discord_rich_presence.h | 5 | ||||
| -rw-r--r-- | include/lobby.h | 17 | ||||
| -rw-r--r-- | include/scrolltext.h | 47 |
22 files changed, 686 insertions, 129 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index ef1a1686..fa1757b9 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -23,6 +23,9 @@ #include <QScreen> #include <QStringList> #include <QTextStream> +#ifdef QTAUDIO +#include <QAudioDeviceInfo> +#endif class NetworkManager; class Lobby; @@ -74,6 +77,9 @@ public: bool arup_enabled = false; bool casing_alerts_enabled = false; bool modcall_reason_enabled = false; + bool looping_sfx_support_enabled = false; + bool additive_enabled = false; + bool effects_enabled = false; ///////////////loading info/////////////////// @@ -141,12 +147,18 @@ public: // Returns the value of ooc_name in config.ini QString get_ooc_name(); - // Returns the blip rate from config.ini + // Returns the blip rate from config.ini (once per X symbols) int read_blip_rate(); // Returns true if blank blips is enabled in config.ini and false otherwise bool get_blank_blip(); + // Returns true if looping sound effects are enabled in the config.ini + bool get_looping_sfx(); + + // Returns true if stop music on objection is enabled in the config.ini + bool objection_stop_music(); + // Returns the value of default_music in config.ini int get_default_music(); @@ -160,6 +172,34 @@ public: // from the config.ini. bool is_discord_enabled(); + // Returns the value of whether shaking should be enabled. + // from the config.ini. + bool is_shake_enabled(); + + // Returns the value of whether effects should be enabled. + // from the config.ini. + bool is_effects_enabled(); + + // Returns the value of whether frame-specific effects defined in char.ini + // should be sent/received over the network. from the config.ini. + bool is_frame_network_enabled(); + + // Returns the value of whether colored ic log should be a thing. + // from the config.ini. + bool is_colorlog_enabled(); + + // Returns the value of whether sticky sounds should be a thing. + // from the config.ini. + bool is_stickysounds_enabled(); + + // Returns the value of whether sticky effects should be a thing. + // from the config.ini. + bool is_stickyeffects_enabled(); + + // Returns the value of whether sticky preanims should be a thing. + // from the config.ini. + bool is_stickypres_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); @@ -173,6 +213,9 @@ 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(); @@ -180,6 +223,20 @@ public: // Returns the list of words in callwords.ini QStringList get_call_words(); + // returns all of the file's lines in a QStringList + QStringList get_list_file(QString p_file); + + // Process a file and return its text as a QString + QString read_file(QString filename); + + // Write text to file. make_dir would auto-create the directory if it doesn't + // exist. + bool write_to_file(QString p_text, QString p_file, bool make_dir = false); + + // Append text to the end of the file. make_dir would auto-create the + // directory if it doesn't exist. + bool append_to_file(QString p_text, QString p_file, bool make_dir = false); + // Appends the argument string to serverlist.txt void write_to_serverlist_txt(QString p_line); @@ -193,7 +250,12 @@ public: QPoint get_button_spacing(QString p_identifier, QString p_file); // Returns the dimensions of widget with specified identifier from p_file - pos_size_type get_element_dimensions(QString p_identifier, QString p_file); + pos_size_type get_element_dimensions(QString p_identifier, QString p_file, + QString p_char = ""); + + // Returns the value to you + QString get_design_element(QString p_identifier, QString p_file, + QString p_char = ""); // Returns the name of the font with p_identifier from p_file QString get_font_name(QString p_identifier, QString p_file); @@ -204,7 +266,10 @@ public: // Returns the color with p_identifier from p_file QColor get_color(QString p_identifier, QString p_file); - // Returns the colour from the misc folder. + // Returns the markdown symbol used for specified p_identifier such as colors + QString get_chat_markdown(QString p_identifier, QString p_file); + + // Returns the color from the misc folder. QColor get_chat_color(QString p_identifier, QString p_chat); // Returns the sfx with p_identifier from sounds.ini in the current theme path @@ -213,22 +278,46 @@ public: // Figure out if we can opus this or if we should fall back to wav QString get_sfx_suffix(QString sound_to_check); - // Can we use APNG for this? If not, fall back to a gif. + // Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to + // PNG. QString get_image_suffix(QString path_to_check); + // If this image is static and non-animated, return the supported static image + // formats. Currently only PNG. + QString get_static_image_suffix(QString path_to_check); + // Returns the value of p_search_line within target_tag and terminator_tag QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); + // Returns a QStringList of all key=value definitions on a given tag. + QStringList read_ini_tags(QString p_file, QString target_tag = ""); + + // Sets the char.ini p_search_line key under tag target_tag to value. + void set_char_ini(QString p_char, QString value, QString p_search_line, + QString target_tag); + + // Returns the text between target_tag and terminator_tag in p_file + QString get_stylesheet(QString p_file); + + // Returns the text between target_tag and terminator_tag in p_file + QString get_tagged_stylesheet(QString target_tag, QString p_file); + // Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); // Returns the showname from the ini of p_char QString get_showname(QString p_char); - // Returns the value of chat from the specific p_char's ini file + // Returns the value of chat image from the specific p_char's ini file QString get_chat(QString p_char); + // Returns the value of chat font from the specific p_char's ini file + QString get_chat_font(QString p_char); + + // Returns the value of chat font size from the specific p_char's ini file + int get_chat_size(QString p_char); + // Returns the value of shouts from the specified p_char's ini file QString get_char_shouts(QString p_char); @@ -242,6 +331,21 @@ public: // Not in use int get_text_delay(QString p_char, QString p_emote); + // Get the effects folder referenced by the char.ini, read it and return the + // list of filenames in a string + QStringList get_theme_effects(); + + // Get the theme's effects folder, read it and return the list of filenames in + // a string + QStringList get_effects(QString p_char); + + // t + QString get_effect(QString effect, QString p_char, QString p_folder); + + // Return the effect sound associated with the fx_name in the + // misc/effects/<char-defined>/sounds.ini, or theme/effects/sounds.ini. + QString get_effect_sound(QString fx_name, QString p_char); + // Returns the custom realisation used by the character. QString get_custom_realization(QString p_char); @@ -263,6 +367,21 @@ public: // Returns the sfx of p_char's p_emote QString get_sfx_name(QString p_char, int p_emote); + // Returns the blipsound of p_char's p_emote + QString get_emote_blip(QString p_char, int p_emote); + + // Returns if the sfx is defined as looping in char.ini + QString get_sfx_looping(QString p_char, int p_emote); + + // Returns if an emote has a frame specific SFX for it + QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); + + // Returns if an emote has a frame specific SFX for it + QString get_flash_frame(QString p_char, QString p_emote, int n_frame); + + // Returns if an emote has a frame specific SFX for it + QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame); + // Not in use int get_sfx_delay(QString p_char, int p_emote); @@ -303,10 +422,13 @@ public: // Get the message for the CM for casing alerts. QString get_casing_can_host_cases(); + // The file name of the log file in base/logs. + QString log_filename; + private: const int RELEASE = 2; - const int MAJOR_VERSION = 6; - const int MINOR_VERSION = 2; + const int MAJOR_VERSION = 8; + const int MINOR_VERSION = 4; QString current_theme = "default"; diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index 02bd3c66..5a104718 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -3,6 +3,7 @@ #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include <QSoundEffect> #endif @@ -10,6 +11,7 @@ #include "aoapplication.h" #include <QDebug> +#include <QElapsedTimer> #include <QWidget> #include <string.h> @@ -24,10 +26,15 @@ public: int m_cycle = 0; private: + const int max_blip_ms = 60; + QWidget *m_parent; AOApplication *ao_app; + qreal m_volume; + QElapsedTimer delay; + + void set_volume_internal(qreal p_volume); - int m_volume; #if defined(BASSAUDIO) HSTREAM m_stream_list[5]; #elif defined(QTAUDIO) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index b4a8be2c..2dda0ec2 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -2,9 +2,9 @@ #define AOCHARMOVIE_H #include <QDebug> +#include <QElapsedTimer> #include <QImageReader> #include <QLabel> -#include <QMovie> #include <QTimer> class AOApplication; @@ -15,43 +15,111 @@ class AOCharMovie : public QLabel { public: AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); - void play(QString p_char, QString p_emote, QString emote_prefix); + // Play a hat.gif - style preanimation void play_pre(QString p_char, QString p_emote, int duration); + + // Play a (b)normal.gif - style animation (talking) void play_talking(QString p_char, QString p_emote); + + // Play an (a)normal.gif - style animation (not talking) void play_idle(QString p_char, QString p_emote); + // Stop the movie, clearing the image + void stop(); + + // Set the m_flipped variable to true/false void set_flipped(bool p_flipped) { m_flipped = p_flipped; } - void stop(); + // Set the movie's playback speed (between 10% and 1000%) + void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); } + // Move the label itself around void move(int ax, int ay); + // This is somewhat pointless now as there's no "QMovie" object to resize, aka + // no "combo" to speak of void combo_resize(int w, int h); + // Return the frame delay adjusted for speed + int get_frame_delay(int delay); + + QStringList network_strings; + + QString m_char; + QString m_emote; + private: AOApplication *ao_app; - QMovie *m_movie; - QVector<QImage> movie_frames; + QVector<QPixmap> movie_frames; + QVector<int> movie_delays; + + // Effects such as sfx, screenshakes and realization flashes are stored in + // here. QString entry format: "sfx^[sfx_name]", "shake", "flash". The program + // uses the QVector index as reference. + QVector<QVector<QString>> movie_effects; + QTimer *preanim_timer; + QTimer *ticker; + QString last_path; + QImageReader *m_reader = new QImageReader(); + + QElapsedTimer actual_time; - const int time_mod = 62; + // Usually used to turn seconds into milliseconds such as for [Time] tag in + // char.ini + const int time_mod = 60; // These are the X and Y values before they are fixed based on the sprite's // width. int x = 0; int y = 0; + // These are the width and height values before they are fixed based on the + // sprite's width. + int f_w = 0; + int f_h = 0; - bool m_flipped = false; + int frame = 0; + int max_frames = 0; + + int speed = 100; + bool m_flipped = false; bool play_once = true; + // Set the movie's image to provided paths, preparing for playback. + void load_image(QString p_char, QString p_emote, QString emote_prefix); + + // Start playback of the movie (if animated). + void play(); + + // Play a frame-specific effect, if there's any defined for that specific + // frame. + void play_frame_effect(int frame); + + // Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a + // provided QImage + QPixmap get_pixmap(QImage image); + + // Set the movie's frame to provided pixmap + void set_frame(QPixmap f_pixmap); + + // Initialize the frame-specific effects from the char.ini + void load_effects(); + + // Initialize the frame-specific effects from the provided network_strings, + // this is only initialized if network_strings has size more than 0. + void load_network_effects(); + signals: void done(); + void shake(); + void flash(); + void play_sfx(QString sfx); private slots: - void frame_change(int n_frame); - void timer_done(); + void preanim_done(); + void movie_ticker(); }; #endif // AOCHARMOVIE_H diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index acf0b484..cb46167f 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -10,11 +10,11 @@ class AOEmoteButton : public QPushButton { Q_OBJECT public: - AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y); + AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, + int p_w, int p_h); - // void set_on(QString p_char, int p_emote); - // void set_off(QString p_char, int p_emote); - void set_image(QString p_char, int p_emote, QString suffix); + void set_image(QString p_image, QString p_emote_comment); + void set_char_image(QString p_char, int p_emote, QString suffix); void set_id(int p_id) { m_id = p_id; } int get_id() { return m_id; } diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index b56bfb1d..d7812fe9 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -12,10 +12,9 @@ class AOEvidenceButton : public QPushButton { Q_OBJECT public: - AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, - int p_y); + AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, + int p_w, int p_h); - void reset(); void set_image(QString p_image); void set_theme_image(QString p_image); void set_id(int p_id) { m_id = p_id; } @@ -36,9 +35,9 @@ protected: void leaveEvent(QEvent *e); void mouseDoubleClickEvent(QMouseEvent *e); /* - void dragLeaveEvent(QMouseEvent *e); - void dragEnterEvent(QMouseEvent *e); - */ +void dragLeaveEvent(QMouseEvent *e); +void dragEnterEvent(QMouseEvent *e); +*/ signals: void evidence_clicked(int p_id); diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h index 1d6280da..979a754e 100644 --- a/include/aoevidencedisplay.h +++ b/include/aoevidencedisplay.h @@ -2,11 +2,11 @@ #define AOEVIDENCEDISPLAY_H #include "aoapplication.h" +#include "aomovie.h" #include "aosfxplayer.h" #include <QDebug> #include <QLabel> -#include <QMovie> class AOEvidenceDisplay : public QLabel { Q_OBJECT @@ -17,15 +17,16 @@ public: void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume); QLabel *get_evidence_icon(); void reset(); + void combo_resize(int w, int h); private: AOApplication *ao_app; - QMovie *evidence_movie; + AOMovie *evidence_movie; QLabel *evidence_icon; AOSfxPlayer *sfx_player; private slots: - void frame_change(int p_frame); + void show_done(); }; #endif // AOEVIDENCEDISPLAY_H diff --git a/include/aoimage.h b/include/aoimage.h index c4fdf2ee..01ef8540 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -16,8 +16,8 @@ public: QWidget *m_parent; AOApplication *ao_app; - void set_image(QString p_image); - void set_image_from_path(QString p_path); + bool set_image(QString p_image); + bool set_chatbox(QString p_path); void set_size_and_pos(QString identifier); }; diff --git a/include/aolineedit.h b/include/aolineedit.h index 70f1f978..5dce3aaa 100644 --- a/include/aolineedit.h +++ b/include/aolineedit.h @@ -10,14 +10,17 @@ class AOLineEdit : public QLineEdit { public: AOLineEdit(QWidget *parent); + void preserve_selection(bool toggle) { p_selection = toggle; } + +private: + bool p_selection = false; + protected: void mouseDoubleClickEvent(QMouseEvent *e); + void focusOutEvent(QFocusEvent *ev); signals: void double_clicked(); - -private slots: - void on_enter_pressed(); }; #endif // AOLINEEDIT_H diff --git a/include/aomovie.h b/include/aomovie.h index d22f725a..eb7f7a53 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -14,13 +14,15 @@ public: AOMovie(QWidget *p_parent, AOApplication *p_ao_app); void set_play_once(bool p_play_once); - void play(QString p_gif, QString p_char = "", QString p_custom_theme = ""); + void play(QString p_image, QString p_char = "", QString p_custom_theme = "", + int default_duration = 0); void combo_resize(int w, int h); void stop(); private: QMovie *m_movie; AOApplication *ao_app; + QTimer *timer; bool play_once = true; signals: @@ -28,6 +30,7 @@ signals: private slots: void frame_change(int n_frame); + void timer_done(); }; #endif // AOMOVIE_H diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index fd6b2548..5c72649f 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -1,8 +1,10 @@ #ifndef AOMUSICPLAYER_H #define AOMUSICPLAYER_H +#include "file_functions.h" #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include <QMediaPlayer> #endif @@ -16,17 +18,34 @@ class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + virtual ~AOMusicPlayer(); + void set_volume(int p_value, int channel = -1); + void set_looping(bool toggle, int channel = 0); - void play(QString p_song); - void set_volume(int p_value); + const int m_channelmax = 4; + + // These have to be public for the stupid sync thing + QWORD loop_start = 0; + QWORD loop_end = 0; + +public slots: + void play(QString p_song, int channel = 0, bool loop = false, + int effect_flags = 0); + void stop(int channel = 0); private: QWidget *m_parent; AOApplication *ao_app; - int m_volume = 0; - HSTREAM m_stream; + bool m_looping = false; + int m_volume[4] = {0, 0, 0, 0}; + + // Channel 0 = music + // Channel 1 = ambience + // Channel 2 = extra + // Channel 3 = extra + HSTREAM m_stream_list[4]; + HSYNC loop_sync[4]; }; #elif defined(QTAUDIO) class AOMusicPlayer { diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index ec0889ba..7e983a3f 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -15,6 +15,7 @@ #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QPlainTextEdit> +#include <QtWidgets/QScrollArea> #include <QtWidgets/QSpinBox> #include <QtWidgets/QTabWidget> #include <QtWidgets/QVBoxLayout> @@ -55,6 +56,27 @@ private: 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; QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; @@ -80,6 +102,10 @@ private: 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; diff --git a/include/aoscene.h b/include/aoscene.h index 1c258f2f..726e2641 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -16,10 +16,27 @@ public: void set_image(QString p_image); void set_legacy_desk(QString p_image); + // Move the label itself around + void move(int ax, int ay); + + // This is somewhat pointless now as there's no "QMovie" object to resize, aka + // no "combo" to speak of + void combo_resize(int w, int h); + private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; + QString last_image; + + // These are the X and Y values before they are fixed based on the sprite's + // width. + int x = 0; + int y = 0; + // These are the width and height values before they are fixed based on the + // sprite's width. + int f_w = 0; + int f_h = 0; }; #endif // AOSCENE_H diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index b6dce85d..9c9824ab 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -3,6 +3,7 @@ #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include <QSoundEffect> #endif @@ -17,19 +18,29 @@ class AOSfxPlayer { public: AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); - void play(QString p_sfx, QString p_char = "", QString shout = ""); - void stop(); - void set_volume(int p_volume); + void clear(); + void loop_clear(); + void play(QString p_sfx, QString p_char = "", QString shout = "", + int channel = -1); + void stop(int channel = -1); + void set_volume(qreal p_volume); + void set_looping(bool toggle, int channel = -1); + int m_channel = 0; private: QWidget *m_parent; AOApplication *ao_app; + qreal m_volume = 0; + + bool m_looping = true; + void set_volume_internal(qreal p_volume); + #if defined(BASSAUDIO) - HSTREAM m_stream; + const int m_channelmax = 5; + HSTREAM m_stream_list[5]; #elif defined(QTAUDIO) QSoundEffect m_sfx; #endif - int m_volume = 0; }; #endif // AOSFXPLAYER_H diff --git a/include/aotextarea.h b/include/aotextarea.h index 13532d29..453e9659 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -11,11 +11,12 @@ class AOTextArea : public QTextBrowser { public: AOTextArea(QWidget *p_parent = nullptr); - void append_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_linked(QString p_message); + void append_chatmessage(QString p_name, QString p_message, QString p_colur); void append_error(QString p_message); private: - const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); + const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down); diff --git a/include/bass.h b/include/bass.h index 068b963c..ec2c7a29 100644 --- a/include/bass.h +++ b/include/bass.h @@ -1,6 +1,6 @@ /* BASS 2.4 C/C++ header file - Copyright (c) 1999-2018 Un4seen Developments Ltd. + Copyright (c) 1999-2019 Un4seen Developments Ltd. See the BASS.CHM file for more detailed documentation */ @@ -117,6 +117,7 @@ typedef DWORD HPLUGIN; // Plugin handle #define BASS_CONFIG_VERIFY 23 #define BASS_CONFIG_UPDATETHREADS 24 #define BASS_CONFIG_DEV_BUFFER 27 +#define BASS_CONFIG_REC_LOOPBACK 28 #define BASS_CONFIG_VISTA_TRUEPOS 30 #define BASS_CONFIG_IOS_MIXAUDIO 34 #define BASS_CONFIG_DEV_DEFAULT 36 @@ -141,11 +142,14 @@ typedef DWORD HPLUGIN; // Plugin handle #define BASS_CONFIG_AM_DISABLE 58 #define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 #define BASS_CONFIG_NET_PREBUF_WAIT 60 +#define BASS_CONFIG_WASAPI_PERSIST 65 +#define BASS_CONFIG_REC_WASAPI 66 // BASS_SetConfigPtr options #define BASS_CONFIG_NET_AGENT 16 #define BASS_CONFIG_NET_PROXY 17 #define BASS_CONFIG_IOS_NOTIFY 46 +#define BASS_CONFIG_LIBSSL 64 // BASS_Init flags #define BASS_DEVICE_8BITS 1 // 8 bit @@ -526,9 +530,10 @@ BASS_STREAMPROC_END flag to end the stream. */ #define BASS_STREAMPROC_END 0x80000000 // end of user stream flag // special STREAMPROCs -#define STREAMPROC_DUMMY (STREAMPROC *)0 // "dummy" stream -#define STREAMPROC_PUSH (STREAMPROC *)-1 // push stream -#define STREAMPROC_DEVICE (STREAMPROC *)-2 // device mix stream +#define STREAMPROC_DUMMY (STREAMPROC *)0 // "dummy" stream +#define STREAMPROC_PUSH (STREAMPROC *)-1 // push stream +#define STREAMPROC_DEVICE (STREAMPROC *)-2 // device mix stream +#define STREAMPROC_DEVICE_3D (STREAMPROC *)-3 // device 3D mix stream // BASS_StreamCreateFileUser file systems #define STREAMFILE_NOBUFFER 0 @@ -584,6 +589,8 @@ user : The 'user' parameter value given when calling BASS_StreamCreateURL */ #define BASS_SYNC_MUSICINST 1 #define BASS_SYNC_MUSICFX 3 #define BASS_SYNC_OGG_CHANGE 12 +#define BASS_SYNC_DEV_FAIL 14 +#define BASS_SYNC_DEV_FORMAT 15 #define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime #define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously @@ -623,6 +630,7 @@ RETURN : TRUE = continue recording, FALSE = stop */ #define BASS_ACTIVE_PLAYING 1 #define BASS_ACTIVE_STALLED 2 #define BASS_ACTIVE_PAUSED 3 +#define BASS_ACTIVE_PAUSED_DEVICE 4 // Channel attributes #define BASS_ATTRIB_FREQ 1 @@ -668,6 +676,7 @@ RETURN : TRUE = continue recording, FALSE = stop */ #define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window #define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias #define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data +#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value // BASS_ChannelGetLevelEx flags #define BASS_LEVEL_MONO 1 @@ -1040,6 +1049,7 @@ float BASSDEF(BASS_GetCPU)(); BOOL BASSDEF(BASS_Start)(); BOOL BASSDEF(BASS_Stop)(); BOOL BASSDEF(BASS_Pause)(); +BOOL BASSDEF(BASS_IsStarted)(); BOOL BASSDEF(BASS_SetVolume)(float volume); float BASSDEF(BASS_GetVolume)(); diff --git a/include/bassopus.h b/include/bassopus.h new file mode 100644 index 00000000..3d8b131d --- /dev/null +++ b/include/bassopus.h @@ -0,0 +1,64 @@ +/* + BASSOPUS 2.4 C/C++ header file + Copyright (c) 2012-2015 Un4seen Developments Ltd. + + See the BASSOPUS.CHM file for more detailed documentation +*/ + +#ifndef BASSOPUS_H +#define BASSOPUS_H + +#include "bass.h" + +#if BASSVERSION != 0x204 +#error conflicting BASS and BASSOPUS versions +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BASSOPUSDEF +#define BASSOPUSDEF(f) WINAPI f +#endif + +// BASS_CHANNELINFO type +#define BASS_CTYPE_STREAM_OPUS 0x11200 + +// Additional attributes +#define BASS_ATTRIB_OPUS_ORIGFREQ 0x13000 +#define BASS_ATTRIB_OPUS_GAIN 0x13001 + +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, + QWORD offset, QWORD length, + DWORD flags); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateURL)(const char *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFileUser)(DWORD system, DWORD flags, + const BASS_FILEPROCS *procs, + void *user); + +#ifdef __cplusplus +} + +#if defined(_WIN32) && !defined(NOBASSOVERLOADS) +static inline HSTREAM BASS_OPUS_StreamCreateFile(BOOL mem, const WCHAR *file, + QWORD offset, QWORD length, + DWORD flags) +{ + return BASS_OPUS_StreamCreateFile(mem, (const void *)file, offset, length, + flags | BASS_UNICODE); +} + +static inline HSTREAM BASS_OPUS_StreamCreateURL(const WCHAR *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user) +{ + return BASS_OPUS_StreamCreateURL((const char *)url, offset, + flags | BASS_UNICODE, proc, user); +} +#endif +#endif + +#endif diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 1fbca250..e6f77c74 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -15,7 +15,7 @@ public: QString get_name(); QString get_showname(); QString get_message(); - bool get_is_song(); + bool is_song(); QDateTime get_datetime(); QString get_datetime_as_string(); @@ -26,7 +26,7 @@ private: QString showname; QString message; QDateTime datetime; - bool is_song; + bool p_is_song; }; #endif // CHATLOGPIECE_H diff --git a/include/courtroom.h b/include/courtroom.h index 5d9a4b84..259a7ed5 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -13,6 +13,7 @@ #include "aolineedit.h" #include "aomovie.h" #include "aomusicplayer.h" +#include "aooptionsdialog.h" #include "aopacket.h" #include "aoscene.h" #include "aosfxplayer.h" @@ -24,10 +25,12 @@ #include "file_functions.h" #include "hardware_functions.h" #include "lobby.h" +#include "scrolltext.h" #include <QCheckBox> #include <QCloseEvent> #include <QComboBox> +#include <QHeaderView> #include <QLineEdit> #include <QListWidget> #include <QMainWindow> @@ -36,17 +39,24 @@ #include <QSlider> #include <QSpinBox> #include <QTextBrowser> +#include <QTreeWidget> #include <QVector> #include <QBrush> #include <QDebug> +#include <QDesktopServices> #include <QFileDialog> #include <QFont> #include <QInputDialog> +#include <QMenu> +#include <QMessageBox> +#include <QParallelAnimationGroup> +#include <QPropertyAnimation> #include <QRegExp> #include <QScrollBar> #include <QTextBoundaryFinder> #include <QTextCharFormat> +//#include <QRandomGenerator> #include <stack> @@ -61,6 +71,8 @@ public: void append_evidence(evi_type p_evi) { evidence_list.append(p_evi); } void append_music(QString f_music) { music_list.append(f_music); } void append_area(QString f_area) { area_list.append(f_area); } + void clear_music() { music_list.clear(); } + void clear_areas() { area_list.clear(); } void fix_last_area() { @@ -104,23 +116,47 @@ public: // sets position of widgets based on theme ini files void set_widgets(); + // sets font size based on theme ini files - void set_font(QWidget *widget, QString p_identifier); + void set_font(QWidget *widget, QString class_name, QString p_identifier); + + // Get the properly constructed font + QFont get_qfont(QString font_name, int f_pointsize, bool antialias = true); + + // actual operation of setting the font on a widget + void set_qfont(QWidget *widget, QString class_name, QFont font, + QColor f_color = Qt::black, bool bold = false); + // helper function that calls above function on the relevant widgets void set_fonts(); + // sets dropdown menu stylesheet + void set_dropdown(QWidget *widget); + + // helper funciton that call above function on the relevant widgets + void set_dropdowns(); + void set_window_title(QString p_title); // reads theme inis and sets size and pos based on the identifier void set_size_and_pos(QWidget *p_widget, QString p_identifier); + // reads theme inis and returns the size and pos as defined by it + QPoint get_theme_pos(QString p_identifier); + // sets status as taken on character with cid n_char and places proper shading // on charselect void set_taken(int n_char, bool p_taken); // sets the current background to argument. also does some checks to see if // it's a legacy bg - void set_background(QString p_background); + void set_background(QString p_background, bool display = false); + + // sets the local character pos/side to use. + void set_side(QString p_side); + + // sets the pos dropdown + void set_pos_dropdown(QStringList pos_dropdowns); // sets the evidence list member variable to argument void set_evidence_list(QVector<evi_type> &p_evi_list); @@ -135,13 +171,7 @@ public: void set_pair_list(); // sets desk and bg based on pos in chatmessage - void set_scene(); - - // sets text color based on text color in chatmessage - void set_text_color(); - - // And gets the colour, too! - QColor get_text_color(QString color); + void set_scene(QString f_desk_mod, QString f_side); // takes in serverD-formatted IP list as prints a converted version to server // OOC admittedly poorly named @@ -159,8 +189,11 @@ public: QString get_current_char() { return current_char; } QString get_current_background() { return current_background; } + // updates character to p_cid and updates necessary ui elements + void update_character(int p_cid); + // properly sets up some varibles: resets user state - void enter_courtroom(int p_cid); + void enter_courtroom(); // helper function that populates ui_music_list with the contents of // music_list @@ -170,7 +203,7 @@ public: // these are for OOC chat void append_ms_chatmessage(QString f_name, QString f_message); void append_server_chatmessage(QString p_name, QString p_message, - QString p_colour); + QString p_color); // these functions handle chatmessages sequentially. // The process itself is very convoluted and merits separate documentation @@ -181,14 +214,14 @@ public: // This function filters out the common CC inline text trickery, for appending // to the IC chatlog. - QString filter_ic_text(QString p_text); + QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, + int default_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 // or the user isn't already scrolled to the top - void append_ic_text(QString p_text, QString p_name = "", - bool is_songchange = false); + void append_ic_text(QString p_text, QString p_name = "", QString action = ""); // 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 the @@ -230,12 +263,8 @@ private: bool first_message_sent = false; int maximumMessages = 0; - // This is for inline message-colouring. - - enum INLINE_COLOURS { INLINE_BLUE, INLINE_GREEN, INLINE_ORANGE, INLINE_GREY }; - - // A stack of inline colours. - std::stack<INLINE_COLOURS> inline_colour_stack; + QParallelAnimationGroup *screenshake_animation_group = + new QParallelAnimationGroup; bool next_character_is_not_special = false; // If true, write the // next character as it is. @@ -243,21 +272,16 @@ private: bool message_is_centered = false; int current_display_speed = 3; - int message_display_speed[7] = {30, 40, 50, 60, 75, 100, 120}; - - // This is for checking if the character should start talking again - // when an inline blue text ends. - bool entire_message_is_blue = false; - - // And this is the inline 'talking checker'. Counts how 'deep' we are - // in inline blues. - int inline_blue_depth = 0; + int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; // The character ID of the character this user wants to appear alongside with. int other_charid = -1; // The offset this user has given if they want to appear alongside someone. - int offset_with_pair = 0; + int char_offset = 0; + + // 0 = in front, 1 = behind + int pair_order = 0; QVector<char_type> char_list; QVector<evi_type> evidence_list; @@ -271,10 +295,6 @@ private: QVector<chatlogpiece> ic_chatlog_history; - // These map music row items and area row items to their actual IDs. - QVector<int> music_row_to_number; - QVector<int> area_row_to_number; - // triggers ping_server() every 60 seconds QTimer *keepalive_timer; @@ -283,13 +303,19 @@ private: // int chat_tick_interval = 60; // which tick position(character in chat message) we are at int tick_pos = 0; + // the actual document tick pos we gotta worry about for making the text + // scroll better + int real_tick_pos = 0; // used to determine how often blips sound - int blip_pos = 0; + int blip_ticker = 0; int blip_rate = 1; int rainbow_counter = 0; 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; @@ -302,32 +328,33 @@ private: // delay before sfx plays QTimer *sfx_delay_timer; - // keeps track of how long realization is visible(it's just a white square and - // should be visible less than a second) - QTimer *realization_timer; - - // times how long the blinking testimony should be shown(green one in the - // corner) - QTimer *testimony_show_timer; - // times how long the blinking testimony should be hidden - QTimer *testimony_hide_timer; - // every time point in char.inis times this equals the final time const int time_mod = 40; - static const int chatmessage_size = 23; - QString m_chatmessage[chatmessage_size]; - bool chatmessage_is_empty = false; + // the amount of time non-animated objection/hold it/takethat images stay + // onscreen for in ms + const int shout_stay_time = 724; - QString previous_ic_message = ""; + // the amount of time non-animated guilty/not guilty images stay onscreen for + // in ms + const int verdict_stay_time = 3000; + + // the amount of time non-animated witness testimony/cross-examination images + // stay onscreen for in ms + const int wtce_stay_time = 1500; - bool testimony_in_progress = false; + // characters we consider punctuation + const QString punctuation_chars = ".,?!:;"; - // in milliseconds - const int testimony_show_time = 1500; + // 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]; + bool chatmessage_is_empty = false; - // in milliseconds - const int testimony_hide_time = 500; + QString previous_ic_message = ""; + QString additive_previous = ""; // char id, muted or not QMap<int, bool> mute_map; @@ -340,6 +367,9 @@ private: // noniterrupting preanim int anim_state = 3; + // whether or not current color is a talking one + bool color_is_talking = true; + // state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = // ticking done int text_state = 2; @@ -351,9 +381,42 @@ private: int objection_state = 0; int realization_state = 0; + int screenshake_state = 0; int text_color = 0; + + // How many unique user colors are possible + static const int max_colors = 12; + + // Text Color-related optimization: + // Current color list indexes to real color references + QVector<int> color_row_to_number; + + // List of associated RGB colors for this color index + QVector<QColor> color_rgb_list; + + // List of markdown start characters, their index is tied to the color index + QStringList color_markdown_start_list; + + // List of markdown end characters, their index is tied to the color index + QStringList color_markdown_end_list; + + // Whether or not we're supposed to remove this char during parsing + QVector<bool> color_markdown_remove_list; + + // Whether or not this color allows us to play the talking animation + QVector<bool> color_markdown_talking_list; + // Text Color-related optimization END + + // List of all currently available pos + QStringList pos_dropdown_list; + bool is_presenting_evidence = false; + QString effect = ""; + + // Music effect flags we want to send to server when we play music + int music_flags = 0; + int defense_bar_state = 0; int prosecution_bar_state = 0; @@ -372,6 +435,11 @@ private: int max_emotes_on_page = 10; QVector<evi_type> local_evidence_list; + QVector<evi_type> private_evidence_list; + QVector<evi_type> global_evidence_list; + + // false = use private_evidence_list + bool current_evidence_global = true; int current_evidence_page = 0; int current_evidence = 0; @@ -387,6 +455,7 @@ private: bool server_ooc = true; QString current_background = "default"; + QString current_side = ""; AOMusicPlayer *music_player; AOSfxPlayer *sfx_player; @@ -407,9 +476,10 @@ private: AOEvidenceDisplay *ui_vp_evidence_display; AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; + AOMovie *ui_vp_chat_arrow; QTextEdit *ui_vp_message; - AOImage *ui_vp_testimony; - AOImage *ui_vp_realization; + AOMovie *ui_vp_effect; + AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; @@ -419,14 +489,19 @@ private: AOTextArea *ui_server_chatlog; QListWidget *ui_mute_list; - QListWidget *ui_area_list; - QListWidget *ui_music_list; + QTreeWidget *ui_area_list; + QTreeWidget *ui_music_list; + + ScrollText *ui_music_name; + AOMovie *ui_music_display; AOButton *ui_pair_button; QListWidget *ui_pair_list; QSpinBox *ui_pair_offset_spinbox; - QLineEdit *ui_ic_chat_message; + QComboBox *ui_pair_order_dropdown; + + AOLineEdit *ui_ic_chat_message; QLineEdit *ui_ic_chat_name; QLineEdit *ui_ooc_chat_message; @@ -443,6 +518,14 @@ private: QComboBox *ui_emote_dropdown; QComboBox *ui_pos_dropdown; + QComboBox *ui_iniswap_dropdown; + AOButton *ui_iniswap_remove; + + QComboBox *ui_sfx_dropdown; + AOButton *ui_sfx_remove; + + QComboBox *ui_effects_dropdown; + AOImage *ui_defense_bar; AOImage *ui_prosecution_bar; @@ -470,6 +553,7 @@ private: QCheckBox *ui_pre; QCheckBox *ui_flip; + QCheckBox *ui_additive; QCheckBox *ui_guard; QCheckBox *ui_casing; @@ -478,6 +562,7 @@ private: AOButton *ui_custom_objection; AOButton *ui_realization; + AOButton *ui_screenshake; AOButton *ui_mute; AOButton *ui_defense_plus; @@ -494,9 +579,6 @@ private: AOImage *ui_muted; - QSpinBox *ui_log_limit_spinbox; - QLabel *ui_log_limit_label; - AOButton *ui_evidence_button; AOImage *ui_evidence; AOLineEdit *ui_evidence_name; @@ -510,6 +592,11 @@ private: AOLineEdit *ui_evidence_image_name; AOButton *ui_evidence_image_button; AOButton *ui_evidence_x; + AOButton *ui_evidence_ok; + AOButton *ui_evidence_switch; + AOButton *ui_evidence_transfer; + AOButton *ui_evidence_save; + AOButton *ui_evidence_load; AOTextEdit *ui_evidence_description; AOImage *ui_char_select_background; @@ -541,21 +628,23 @@ private: void put_button_in_place(int starting, int chars_on_this_page); void filter_character_list(); - void construct_emotes(); + void initialize_emotes(); + void refresh_emotes(); void set_emote_page(); void set_emote_dropdown(); - void construct_evidence(); + void initialize_evidence(); + void refresh_evidence(); void set_evidence_page(); public slots: void objection_done(); void preanim_done(); - - void realization_done(); - - void show_testimony(); - void hide_testimony(); + void do_screenshake(); + void do_flash(); + void do_effect(QString fx_path, QString fx_sound, QString p_char, + QString p_folder); + void play_char_sfx(QString sfx_name); void mod_called(QString p_ip); @@ -576,8 +665,14 @@ private slots: void on_ooc_return_pressed(); void on_music_search_edited(QString p_text); - void on_music_list_double_clicked(QModelIndex p_model); - void on_area_list_double_clicked(QModelIndex p_model); + void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_music_list_context_menu_requested(const QPoint &pos); + void music_fade_out(bool toggle); + void music_fade_in(bool toggle); + void music_synchronize(bool toggle); + void music_list_expand_all(); + void music_list_collapse_all(); + void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); void select_emote(int p_id); @@ -589,6 +684,28 @@ private slots: void on_emote_dropdown_changed(int p_index); void on_pos_dropdown_changed(int p_index); + void on_iniswap_dropdown_changed(int p_index); + void set_iniswap_dropdown(); + void on_iniswap_context_menu_requested(const QPoint &pos); + void on_iniswap_edit_requested(); + void on_iniswap_remove_clicked(); + + void on_sfx_dropdown_changed(int p_index); + void set_sfx_dropdown(); + void on_sfx_context_menu_requested(const QPoint &pos); + void on_sfx_edit_requested(); + void on_sfx_remove_clicked(); + + void set_effects_dropdown(); + void on_effects_context_menu_requested(const QPoint &pos); + void on_effects_edit_requested(); + void on_character_effects_edit_requested(); + void on_effects_dropdown_changed(int p_index); + bool effects_dropdown_find_and_set(QString effect); + + QString get_char_sfx(); + int get_char_sfx_delay(); + void on_evidence_name_edited(); void on_evidence_image_name_edited(); void on_evidence_image_button_clicked(); @@ -607,9 +724,11 @@ private slots: void on_custom_objection_clicked(); void on_realization_clicked(); + void on_screenshake_clicked(); void on_mute_clicked(); void on_pair_clicked(); + void on_pair_order_dropdown_changed(int p_index); void on_defense_minus_clicked(); void on_defense_plus_clicked(); @@ -617,6 +736,7 @@ private slots: void on_prosecution_plus_clicked(); void on_text_color_changed(int p_color); + void set_text_color_dropdown(); void on_music_slider_moved(int p_value); void on_sfx_slider_moved(int p_value); @@ -640,14 +760,28 @@ private slots: void on_pre_clicked(); void on_flip_clicked(); + void on_additive_clicked(); void on_guard_clicked(); void on_showname_enable_clicked(); + void on_evidence_name_double_clicked(); + void on_evidence_image_name_double_clicked(); void on_evidence_button_clicked(); void on_evidence_delete_clicked(); void on_evidence_x_clicked(); + void on_evidence_ok_clicked(); + void on_evidence_switch_clicked(); + void on_evidence_transfer_clicked(); + + void on_evidence_edited(); + + void evidence_close(); + void evidence_switch(bool global); + void on_evidence_save_clicked(); + void on_evidence_load_clicked(); + bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); void on_back_to_lobby_clicked(); diff --git a/include/datatypes.h b/include/datatypes.h index 207f5062..21ade040 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -91,9 +91,16 @@ enum CHAT_MESSAGE { SELF_OFFSET, OTHER_OFFSET, OTHER_FLIP, - NONINTERRUPTING_PRE + NONINTERRUPTING_PRE, + LOOPING_SFX, + SCREENSHAKE, + FRAME_SCREENSHAKE, + FRAME_REALIZATION, + FRAME_SFX, + ADDITIVE, + EFFECTS }; -enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN }; +enum MUSIC_EFFECT { FADE_IN = 1, FADE_OUT = 2, SYNC_POS = 4 }; #endif // DATATYPES_H diff --git a/include/discord_rich_presence.h b/include/discord_rich_presence.h index 77c0eff7..42de59e2 100644 --- a/include/discord_rich_presence.h +++ b/include/discord_rich_presence.h @@ -1,9 +1,12 @@ #ifndef DISCORD_RICH_PRESENCE_H #define DISCORD_RICH_PRESENCE_H +#include <QCoreApplication> #include <QDebug> #include <cstring> #include <ctime> +#include <string> + #include <discord-rpc.h> #include <string> @@ -15,6 +18,8 @@ namespace AttorneyOnline { class Discord { + Q_DECLARE_TR_FUNCTIONS(Discord) + private: const char *APPLICATION_ID = "399779271737868288"; std::string server_name, server_id; diff --git a/include/lobby.h b/include/lobby.h index 833450d4..42f52977 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -13,6 +13,7 @@ #include <QPlainTextEdit> #include <QProgressBar> #include <QTextBrowser> +#include <QTreeWidget> #include <QDebug> #include <QScrollBar> @@ -31,6 +32,10 @@ public: void append_chatmessage(QString f_name, QString f_message); void append_error(QString f_message); void set_player_count(int players_online, int max_players); + void set_stylesheet(QWidget *widget, QString target_tag); + void set_stylesheets(); + void set_fonts(); + void set_font(QWidget *widget, QString p_identifier); void set_loading_text(QString p_text); void show_loading_overlay() { ui_loading_background->show(); } void hide_loading_overlay() { ui_loading_background->hide(); } @@ -59,7 +64,10 @@ private: QLabel *ui_version; AOButton *ui_about; - QListWidget *ui_server_list; + AOButton *ui_settings; + + QTreeWidget *ui_server_list; + QLineEdit *ui_server_search; QLabel *ui_player_count; AOTextArea *ui_description; @@ -74,6 +82,8 @@ private: QProgressBar *ui_progress_bar; AOButton *ui_cancel; + int last_index; + void set_size_and_pos(QWidget *p_widget, QString p_identifier); private slots: @@ -87,7 +97,10 @@ private slots: void on_connect_pressed(); void on_connect_released(); void on_about_clicked(); - void on_server_list_clicked(QModelIndex p_model); + void on_settings_clicked(); + void on_server_list_clicked(QTreeWidgetItem *p_item, int column); + void on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column); + void on_server_search_edited(QString p_text); void on_chatfield_return_pressed(); }; diff --git a/include/scrolltext.h b/include/scrolltext.h new file mode 100644 index 00000000..9ed5ff77 --- /dev/null +++ b/include/scrolltext.h @@ -0,0 +1,47 @@ +#ifndef SCROLLTEXT_H +#define SCROLLTEXT_H + +#include <QDebug> +#include <QPainter> +#include <QStaticText> +#include <QTimer> +#include <QWidget> + +class ScrollText : public QWidget { + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QString separator READ separator WRITE setSeparator) + +public: + explicit ScrollText(QWidget *parent = nullptr); + +public slots: + QString text() const; + void setText(QString text); + + QString separator() const; + void setSeparator(QString separator); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); + +private: + void updateText(); + QString _text; + QString _separator; + QStaticText staticText; + int singleTextWidth; + QSize wholeTextSize; + int leftMargin; + bool scrollEnabled; + int scrollPos; + QImage alphaChannel; + QImage buffer; + QTimer timer; + +private slots: + virtual void timer_timeout(); +}; + +#endif // SCROLLTEXT_H |
