summaryrefslogtreecommitdiffstats
path: root/application/widgets/ServerStatus.h
blob: e1e70dfb6d90ff2ced7416445f5c6465b12dd9a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include <QString>
#include <QWidget>
#include <QMap>
#include <QIcon>
#include <memory>

class IconLabel;
class QToolButton;
class QHBoxLayout;
class StatusChecker;

class ServerStatus: public QWidget
{
    Q_OBJECT
public:
    explicit ServerStatus(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
    virtual ~ServerStatus();

public slots:
    void reloadStatus();
    void StatusChanged(const QMap<QString, QString> statuses);
    void StatusReloading(bool is_reloading);

private slots:
    void clicked();

private: /* methods */
    void addLine();
    void addStatus(QString key, QString name);
    void setStatus(QString key, int value);
private: /* data */
    QHBoxLayout * layout = nullptr;
    QToolButton *m_statusRefresh = nullptr;
    QMap<QString, IconLabel *> serverLabels;
    QIcon goodIcon;
    QIcon yellowIcon;
    QIcon badIcon;
    std::shared_ptr<StatusChecker> m_statusChecker;
};