diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/aoapplication.h | 12 | ||||
| -rw-r--r-- | include/aooptionsdialog.h | 2 | ||||
| -rw-r--r-- | include/aopacket.h | 2 | ||||
| -rw-r--r-- | include/courtroom.h | 7 | ||||
| -rw-r--r-- | include/demoserver.h | 55 |
5 files changed, 77 insertions, 1 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index 0e003a8..5a02c3b 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -3,6 +3,7 @@ #include "aopacket.h" #include "datatypes.h" +#include "demoserver.h" #include "discord_rich_presence.h" #include "bass.h" @@ -27,6 +28,8 @@ #include <QStringList> #include <QTextStream> +#include <QElapsedTimer> + class NetworkManager; class Lobby; class Courtroom; @@ -219,6 +222,9 @@ public: // Current wait time between messages for the queue system int stay_time(); + // Returns Minimum amount of time (in miliseconds) that must pass before the next Enter key press will send your IC message. (new behaviour) + int get_chat_ratelimit(); + // Returns whether the log should go upwards (new behaviour) // or downwards (vanilla behaviour). bool get_log_goes_downwards(); @@ -261,6 +267,9 @@ public: // directory if it doesn't exist. bool append_to_file(QString p_text, QString p_file, bool make_dir = false); + // Append to the currently open demo file if there is one + void append_to_demofile(QString packet_string); + // Appends the argument string to serverlist.txt void write_to_serverlist_txt(QString p_line); @@ -458,6 +467,9 @@ public: void *user); static void doBASSreset(); + QElapsedTimer demo_timer; + DemoServer* demo_server = nullptr; + private: const int RELEASE = 2; const int MAJOR_VERSION = 8; diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 93b6677..74fc9af 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -58,6 +58,8 @@ private: QCheckBox *ui_desync_logs_cb; QLabel *ui_instant_objection_lbl; QCheckBox *ui_instant_objection_cb; + QLabel *ui_chat_ratelimit_lbl; + QSpinBox *ui_chat_ratelimit_spinbox; QLabel *ui_log_ic_actions_lbl; QCheckBox *ui_log_ic_actions_cb; QFrame *ui_log_names_divider; diff --git a/include/aopacket.h b/include/aopacket.h index 6d1deba..794025c 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -12,7 +12,7 @@ public: QString get_header() { return m_header; } QStringList &get_contents() { return m_contents; } - QString to_string(); + QString to_string(bool encoded = false); void net_encode(); void net_decode(); diff --git a/include/courtroom.h b/include/courtroom.h index 4cf42e1..31b90c9 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -504,6 +504,12 @@ private: // List of all currently available pos QStringList pos_dropdown_list; + // Current list file sorted line by line + QStringList sound_list; + + // Current SFX the user put in for the sfx dropdown list + QString custom_sfx = ""; + // is the message we're about to send supposed to present evidence? bool is_presenting_evidence = false; @@ -805,6 +811,7 @@ private slots: void on_iniswap_remove_clicked(); void on_sfx_dropdown_changed(int p_index); + void on_sfx_dropdown_custom(QString p_sfx); void set_sfx_dropdown(); void on_sfx_context_menu_requested(const QPoint &pos); void on_sfx_edit_requested(); diff --git a/include/demoserver.h b/include/demoserver.h new file mode 100644 index 0000000..b21811b --- /dev/null +++ b/include/demoserver.h @@ -0,0 +1,55 @@ +#ifndef DEMOSERVER_H +#define DEMOSERVER_H + +#include "aopacket.h" + +#include <QDebug> +#include <QObject> +#include <QQueue> +#include <QTcpServer> +#include <QTcpSocket> +#include <QTimer> +#include <QFileDialog> + +class DemoServer : public QObject +{ + Q_OBJECT +public: + explicit DemoServer(QObject *parent = nullptr); + + bool server_started = false; + int port = 27088; + int max_wait = -1; + int min_wait = -1; + +private: + void handle_packet(AOPacket packet); + void load_demo(QString filename); + + QTcpServer* tcp_server; + QTcpSocket* client_sock = nullptr; + bool client_connected = false; + bool partial_packet = false; + QString temp_packet = ""; + QQueue<QString> demo_data; + QString sc_packet; + int num_chars = 0; + QString p_path; + QTimer *timer; + int elapsed_time = 0; + +private slots: + void accept_connection(); + void destroy_connection(); + void recv_data(); + void client_disconnect(); + void playback(); + +public slots: + void start_server(); + +signals: + +}; + +#endif // DEMOSERVER_H |
