summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv/stable-30/mythtv/addHostnameIPtoMachineStatus.patch
blob: 2fd8b8821ad836c8f028ce8f386ab2a8226b3a00 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
diff --git a/mythtv/programs/mythfrontend/statusbox.cpp b/mythtv/programs/mythfrontend/statusbox.cpp
index e45016af50..73e7792a61 100644
--- a/mythtv/programs/mythfrontend/statusbox.cpp
+++ b/mythtv/programs/mythfrontend/statusbox.cpp
@@ -5,6 +5,7 @@ using namespace std;
 
 #include <QRegExp>
 #include <QHostAddress>
+    #include <QNetworkInterface>
 
 #include "mythcorecontext.h"
 #include "filesysteminfo.h"
@@ -1271,9 +1272,10 @@ void StatusBox::doMachineStatus()
         m_iconState->DisplayState("machine");
     m_logList->Reset();
     QString machineStr = tr("Machine Status shows some operating system "
-                            "statistics of this machine");
+                            "statistics of this machine.");
     if (!m_isBackendActive)
-        machineStr.append(" " + tr("and the MythTV server"));
+        machineStr = tr("Machine Status shows some operating system "
+                        "statistics of this machine and the MythTV server.");
 
     if (m_helpText)
         m_helpText->SetText(machineStr);
@@ -1291,13 +1293,41 @@ void StatusBox::doMachineStatus()
         line = tr("This machine:");
     AddLogLine(line, machineStr);
 
+    // Hostname & IP
+    line = "   " + tr("Hostname") + ": " + gCoreContext->GetHostName();
+    line.append("      " + tr("IP") + ": ");
+    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;
+
+        sep = ", ";
+        QString sep2 = "";
+        foreach(QNetworkAddressEntry addr, iface.addressEntries())
+        {
+            if (addr.ip().protocol() == QAbstractSocket::IPv4Protocol || addr.ip().protocol() == QAbstractSocket::IPv6Protocol)
+            {
+                line += sep2 + addr.ip().toString();
+                sep2 = ", ";
+            }
+        }
+        line += "";
+    }
+    AddLogLine(line, machineStr);
+
     // uptime
     if (!getUptime(uptime))
         uptime = 0;
     line = uptimeStr(uptime);
 
     // weighted average loads
-    line.append(".   " + tr("Load") + ": ");
+    line.append("      " + tr("Load") + ": ");
 
 #if defined(_WIN32) || defined(Q_OS_ANDROID)
     line.append(tr("unknown") + " - getloadavg() " + tr("failed"));
@@ -1339,13 +1369,18 @@ void StatusBox::doMachineStatus()
         line = tr("MythTV server") + ':';
         AddLogLine(line, machineStr);
 
+        // Hostname & IP
+        line = "   " + tr("Hostname") + ": " + gCoreContext->GetSetting("MasterServerName");
+        line.append("      " + tr("IP") + ": " + gCoreContext->GetSetting("MasterServerIP"));
+        AddLogLine(line, machineStr);
+
         // uptime
         if (!RemoteGetUptime(uptime))
             uptime = 0;
         line = uptimeStr(uptime);
 
         // weighted average loads
-        line.append(".   " + tr("Load") + ": ");
+        line.append("      " + tr("Load") + ": ");
         float floads[3];
         if (RemoteGetLoad(floads))
         {