diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/aoapplication.h | 4 | ||||
| -rw-r--r-- | include/aoclocklabel.h | 29 | ||||
| -rw-r--r-- | include/courtroom.h | 22 |
3 files changed, 52 insertions, 3 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index c0c3ba37..8bd0781e 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -29,6 +29,7 @@ #include <QScreen> #include <QStringList> #include <QTextStream> +#include <QTime> #include <QElapsedTimer> @@ -66,6 +67,9 @@ public: void call_settings_menu(); void call_announce_menu(Courtroom *court); + qint64 latency = 0; + QString window_title; + /////////////////server metadata////////////////// bool yellow_text_enabled = false; diff --git a/include/aoclocklabel.h b/include/aoclocklabel.h new file mode 100644 index 00000000..b5d07945 --- /dev/null +++ b/include/aoclocklabel.h @@ -0,0 +1,29 @@ +#ifndef AOCLOCKLABEL_H +#define AOCLOCKLABEL_H + +#include <QLabel> +#include <QBasicTimer> +#include <QTimerEvent> +#include <QTime> +#include <QDebug> + +class AOClockLabel : public QLabel { + Q_OBJECT + +public: + AOClockLabel(QWidget *parent); + void start(); + void start(int msecs); + void set(int msecs, bool update_text = false); + void pause(); + void stop(); + +protected: + void timerEvent(QTimerEvent *event) override; + +private: + QBasicTimer timer; + QTime target_time; +}; + +#endif // AOCLOCKLABEL_H diff --git a/include/courtroom.h b/include/courtroom.h index f12b47f7..0dcc53de 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -5,6 +5,7 @@ #include "aoblipplayer.h" #include "aobutton.h" #include "aocharbutton.h" +#include "aoclocklabel.h" #include "aoemotebutton.h" #include "aoevidencebutton.h" #include "aoevidencedisplay.h" @@ -55,7 +56,7 @@ #include <QScrollBar> #include <QTextBoundaryFinder> #include <QTextCharFormat> -//#include <QRandomGenerator> +#include <QElapsedTimer> #include <algorithm> #include <stack> @@ -300,11 +301,18 @@ public: void check_connection_received(); + void start_clock(int id); + void start_clock(int id, qint64 msecs); + void set_clock(int id, qint64 msecs); + void pause_clock(int id); + void stop_clock(int id); + void set_clock_visibility(int id, bool visible); + + qint64 pong(); // Truncates text so it fits within theme-specified boundaries and sets the tooltip to the full string void truncate_label_text(QWidget* p_widget, QString p_identifier); ~Courtroom(); - private: AOApplication *ao_app; @@ -357,11 +365,16 @@ private: QQueue<QStringList> chatmessage_queue; - // triggers ping_server() every 60 seconds + // triggers ping_server() every 45 seconds QTimer *keepalive_timer; // determines how fast messages tick onto screen QTimer *chat_tick_timer; + + // count up timer to check how long it took for us to get a response from ping_server() + QElapsedTimer ping_timer; + bool is_pinging = false; + // int chat_tick_interval = 60; // which tick position(character in chat message) we are at int tick_pos = 0; @@ -619,6 +632,9 @@ private: StickerLayer *ui_vp_sticker; + static const int max_clocks = 5; + AOClockLabel *ui_clock[max_clocks]; + AOButton *ui_pair_button; QListWidget *ui_pair_list; QSpinBox *ui_pair_offset_spinbox; |
