PrismLauncher/application/widgets/ServerStatus.h

41 lines
873 B
C
Raw Normal View History

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