serverstatuswidget.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef SERVERSTATUSWIDGET_H
  2. #define SERVERSTATUSWIDGET_H
  3. #include <QWidget>
  4. #include <QTimer>
  5. #include <QByteArray>
  6. #include "models/downloader.h"
  7. namespace Ui {
  8. class ServerStatusWidget;
  9. }
  10. class ServerStatusWidget : public QWidget
  11. {
  12. Q_OBJECT
  13. public:
  14. explicit ServerStatusWidget(QWidget *parent = 0);
  15. ~ServerStatusWidget();
  16. public slots:
  17. void updateFontsSizes();
  18. signals:
  19. void showServersTooltip(QString tooltip);
  20. void showNoTooltip();
  21. protected:
  22. void resizeEvent(QResizeEvent *event) override;
  23. virtual void leaveEvent(QEvent * event) override;
  24. virtual void enterEvent(QEvent * event) override;
  25. public slots:
  26. void updateServerStatus();
  27. private slots:
  28. void updateStatus();
  29. void updateTechWorksMessage();
  30. private:
  31. QString server_status_tooltip_ = "Информация о состоянии серверов загружается...";
  32. QTimer update_timer;
  33. Downloader status_downloader;
  34. QByteArray status_data;
  35. Downloader tech_work_message_downloader;
  36. QByteArray tech_work_message_data;
  37. const QString open_color = "color: rgb(0, 170, 0);";
  38. const QString closed_color = "color: rgb(255, 0, 0);";
  39. private:
  40. const QStringList servers_list = {"Anor",
  41. "Arkenstone",
  42. "Belegaer",
  43. "Brandywine",
  44. "Bullroarer",
  45. "Crickhollow",
  46. "Evernight",
  47. "Gladden",
  48. "Gwaihir",
  49. "Ithil",
  50. "Landroval",
  51. "Laurelin",
  52. "Sirannon"};
  53. Ui::ServerStatusWidget *ui;
  54. bool servers_disabled;
  55. };
  56. #endif // SERVERSTATUSWIDGET_H