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 | 24 |
3 files changed, 52 insertions, 5 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index 0e003a81..776a5f13 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -26,6 +26,7 @@ #include <QScreen> #include <QStringList> #include <QTextStream> +#include <QTime> class NetworkManager; class Lobby; @@ -61,6 +62,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 92b5a03c..4d4f1733 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -6,6 +6,7 @@ #include "aobutton.h" #include "aocharbutton.h" #include "aocharmovie.h" +#include "aoclocklabel.h" #include "aoemotebutton.h" #include "aoevidencebutton.h" #include "aoevidencedisplay.h" @@ -57,7 +58,7 @@ #include <QScrollBar> #include <QTextBoundaryFinder> #include <QTextCharFormat> -//#include <QRandomGenerator> +#include <QElapsedTimer> #include <algorithm> #include <stack> @@ -296,11 +297,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; @@ -350,13 +358,16 @@ private: QVector<chatlogpiece> ic_chatlog_history; - 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; @@ -600,6 +611,9 @@ private: ScrollText *ui_music_name; AOMovie *ui_music_display; + static const int max_clocks = 5; + AOClockLabel *ui_clock[max_clocks]; + AOButton *ui_pair_button; QListWidget *ui_pair_list; QSpinBox *ui_pair_offset_spinbox; |
