pollymc/application/widgets/ServerStatus.h

41 lines
924 B
C
Raw Normal View History

2014-05-16 02:02:54 +05:30
#pragma once
2014-05-17 19:53:48 +05:30
#include <QString>
2014-05-16 02:02:54 +05:30
#include <QWidget>
2014-05-17 19:53:48 +05:30
#include <QMap>
#include <QIcon>
2014-05-16 02:02:54 +05:30
#include <memory>
2014-05-17 19:53:48 +05:30
class IconLabel;
2014-05-16 02:02:54 +05:30
class QToolButton;
class QHBoxLayout;
class StatusChecker;
2014-05-16 02:02:54 +05:30
class ServerStatus: public QWidget
{
2018-07-15 18:21:05 +05:30
Q_OBJECT
2014-05-16 02:02:54 +05:30
public:
2018-07-15 18:21:05 +05:30
explicit ServerStatus(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
virtual ~ServerStatus();
2015-10-11 23:26:31 +05:30
2014-05-16 02:02:54 +05:30
public slots:
2018-07-15 18:21:05 +05:30
void reloadStatus();
void StatusChanged(const QMap<QString, QString> statuses);
void StatusReloading(bool is_reloading);
2014-05-16 02:02:54 +05:30
private slots:
2018-07-15 18:21:05 +05:30
void clicked();
2014-05-16 02:02:54 +05:30
private: /* methods */
2018-07-15 18:21:05 +05:30
void addLine();
void addStatus(QString key, QString name);
void setStatus(QString key, int value);
2014-05-16 02:02:54 +05:30
private: /* data */
2018-07-15 18:21:05 +05:30
QHBoxLayout * layout = nullptr;
QToolButton *m_statusRefresh = nullptr;
QMap<QString, IconLabel *> serverLabels;
QIcon goodIcon;
QIcon yellowIcon;
QIcon badIcon;
std::shared_ptr<StatusChecker> m_statusChecker;
2014-05-16 02:02:54 +05:30
};