summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/widgets/ServerStatus.cpp56
-rw-r--r--application/widgets/ServerStatus.h3
2 files changed, 57 insertions, 2 deletions
diff --git a/application/widgets/ServerStatus.cpp b/application/widgets/ServerStatus.cpp
index 0c11b9bf..f0a7f97a 100644
--- a/application/widgets/ServerStatus.cpp
+++ b/application/widgets/ServerStatus.cpp
@@ -11,6 +11,49 @@
#include <QMap>
#include <QToolButton>
#include <QAction>
+#include <QDesktopServices>
+
+class ClickableLabel : public QLabel
+{
+ Q_OBJECT
+public:
+ ClickableLabel(QWidget *parent) : QLabel(parent)
+ {
+ setCursor(Qt::PointingHandCursor);
+ }
+
+ ~ClickableLabel(){};
+
+signals:
+ void clicked();
+
+protected:
+ void mousePressEvent(QMouseEvent *event)
+ {
+ emit clicked();
+ }
+};
+
+class ClickableIconLabel : public IconLabel
+{
+ Q_OBJECT
+public:
+ ClickableIconLabel(QWidget *parent, QIcon icon, QSize size) : IconLabel(parent, icon, size)
+ {
+ setCursor(Qt::PointingHandCursor);
+ }
+
+ ~ClickableIconLabel(){};
+
+signals:
+ void clicked();
+
+protected:
+ void mousePressEvent(QMouseEvent *event)
+ {
+ emit clicked();
+ }
+};
ServerStatus::ServerStatus(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
@@ -67,19 +110,26 @@ void ServerStatus::addLine()
void ServerStatus::addStatus(QString key, QString name)
{
{
- auto label = new IconLabel(this, badIcon, QSize(16, 16));
+ auto label = new ClickableIconLabel(this, badIcon, QSize(16, 16));
label->setToolTip(key);
serverLabels[key] = label;
layout->addWidget(label);
+ connect(label,SIGNAL(clicked()),SLOT(clicked()));
}
{
- auto label = new QLabel(this);
+ auto label = new ClickableLabel(this);
label->setText(name);
label->setToolTip(key);
layout->addWidget(label);
+ connect(label,SIGNAL(clicked()),SLOT(clicked()));
}
}
+void ServerStatus::clicked()
+{
+ QDesktopServices::openUrl(QUrl("https://help.mojang.com/"));
+}
+
void ServerStatus::setStatus(QString key, int value)
{
if (!serverLabels.contains(key))
@@ -127,3 +177,5 @@ void ServerStatus::StatusReloading(bool is_reloading)
{
m_statusRefresh->setChecked(is_reloading);
}
+
+#include "ServerStatus.moc"
diff --git a/application/widgets/ServerStatus.h b/application/widgets/ServerStatus.h
index fdd43677..f0b6e223 100644
--- a/application/widgets/ServerStatus.h
+++ b/application/widgets/ServerStatus.h
@@ -22,6 +22,9 @@ public slots:
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);