summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv/stable-30/mythtv/0294-0283-FE-Add-network-status-to-machine-status-dialog.patch
blob: 192f0fcf08502b8ad93dfe8a3dd33214c3cff855 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 273937c9ee4ba00ad049ac3c9fe62ecabd2f8fdb Mon Sep 17 00:00:00 2001
From: Lawrence Rust <lvr@softsystem.co.uk>
Date: Thu, 1 Oct 2015 09:56:13 +0100
Subject: [PATCH 283/290] FE: Add network status to machine status dialog

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
---
 mythtv/programs/mythfrontend/statusbox.cpp |   33 ++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/mythtv/programs/mythfrontend/statusbox.cpp b/mythtv/programs/mythfrontend/statusbox.cpp
index f0078ea..23c5a24 100644
--- a/mythtv/programs/mythfrontend/statusbox.cpp
+++ src/mythtv/programs/mythfrontend/statusbox.cpp
@@ -5,6 +5,8 @@ using namespace std;
 
 #include <QRegExp>
 #include <QHostAddress>
+#include <QHostInfo>
+#include <QNetworkInterface>
 
 #include "mythcorecontext.h"
 #include "filesysteminfo.h"
@@ -1221,6 +1223,12 @@ void StatusBox::doMachineStatus()
         line = tr("This machine:");
     AddLogLine(line, machineStr);
 
+    // Hostname
+    line = "   " + tr("Hostname") + ": " + QHostInfo::localHostName();
+    if ( !QHostInfo::localDomainName().isEmpty())
+        line += "." + QHostInfo::localDomainName();
+    AddLogLine(line, machineStr);
+
     // uptime
     if (!getUptime(uptime))
         uptime = 0;
@@ -1264,6 +1272,31 @@ void StatusBox::doMachineStatus()
         }
     }
 
+    // Network status
+    line = "   " + tr("Interfaces") + ":";
+    QString sep = " ";
+    foreach( QNetworkInterface iface, QNetworkInterface::allInterfaces())
+    {
+        QNetworkInterface::InterfaceFlags f = iface.flags();
+        if (!(f & QNetworkInterface::IsUp))
+            continue;
+        if (!(f & QNetworkInterface::IsRunning))
+            continue;
+        if (f & QNetworkInterface::IsLoopBack)
+            continue;
+
+        line += sep + iface.humanReadableName() + " [";
+        sep = ", ";
+        QString sep2 = "";
+        foreach( QNetworkAddressEntry addr, iface.addressEntries())
+        {
+            line += sep2 + addr.ip().toString();
+            sep2 = ", ";
+        }
+        line += "]";
+    }
+    AddLogLine(line, machineStr);
+
     if (!m_isBackendActive)
     {
         line = tr("MythTV server") + ':';
-- 
1.7.9.5