Ticket #13430: addHostnameIPtoMachineStatus.patch

File addHostnameIPtoMachineStatus.patch, 3.1 KB (added by Britney Fransen, 5 years ago)
  • mythtv/programs/mythfrontend/statusbox.cpp

    diff --git a/mythtv/programs/mythfrontend/statusbox.cpp b/mythtv/programs/mythfrontend/statusbox.cpp
    index e45016af50..73e7792a61 100644
    a b using namespace std; 
    55
    66#include <QRegExp>
    77#include <QHostAddress>
     8    #include <QNetworkInterface>
    89
    910#include "mythcorecontext.h"
    1011#include "filesysteminfo.h"
    void StatusBox::doMachineStatus() 
    12711272        m_iconState->DisplayState("machine");
    12721273    m_logList->Reset();
    12731274    QString machineStr = tr("Machine Status shows some operating system "
    1274                             "statistics of this machine");
     1275                            "statistics of this machine.");
    12751276    if (!m_isBackendActive)
    1276         machineStr.append(" " + tr("and the MythTV server"));
     1277        machineStr = tr("Machine Status shows some operating system "
     1278                        "statistics of this machine and the MythTV server.");
    12771279
    12781280    if (m_helpText)
    12791281        m_helpText->SetText(machineStr);
    void StatusBox::doMachineStatus() 
    12911293        line = tr("This machine:");
    12921294    AddLogLine(line, machineStr);
    12931295
     1296    // Hostname & IP
     1297    line = "   " + tr("Hostname") + ": " + gCoreContext->GetHostName();
     1298    line.append("      " + tr("IP") + ": ");
     1299    QString sep = " ";
     1300    foreach(QNetworkInterface iface, QNetworkInterface::allInterfaces())
     1301    {
     1302        QNetworkInterface::InterfaceFlags f = iface.flags();
     1303        if (!(f & QNetworkInterface::IsUp))
     1304            continue;
     1305        if (!(f & QNetworkInterface::IsRunning))
     1306            continue;
     1307        if (f & QNetworkInterface::IsLoopBack)
     1308            continue;
     1309
     1310        sep = ", ";
     1311        QString sep2 = "";
     1312        foreach(QNetworkAddressEntry addr, iface.addressEntries())
     1313        {
     1314            if (addr.ip().protocol() == QAbstractSocket::IPv4Protocol || addr.ip().protocol() == QAbstractSocket::IPv6Protocol)
     1315            {
     1316                line += sep2 + addr.ip().toString();
     1317                sep2 = ", ";
     1318            }
     1319        }
     1320        line += "";
     1321    }
     1322    AddLogLine(line, machineStr);
     1323
    12941324    // uptime
    12951325    if (!getUptime(uptime))
    12961326        uptime = 0;
    12971327    line = uptimeStr(uptime);
    12981328
    12991329    // weighted average loads
    1300     line.append(".   " + tr("Load") + ": ");
     1330    line.append("      " + tr("Load") + ": ");
    13011331
    13021332#if defined(_WIN32) || defined(Q_OS_ANDROID)
    13031333    line.append(tr("unknown") + " - getloadavg() " + tr("failed"));
    void StatusBox::doMachineStatus() 
    13391369        line = tr("MythTV server") + ':';
    13401370        AddLogLine(line, machineStr);
    13411371
     1372        // Hostname & IP
     1373        line = "   " + tr("Hostname") + ": " + gCoreContext->GetSetting("MasterServerName");
     1374        line.append("      " + tr("IP") + ": " + gCoreContext->GetSetting("MasterServerIP"));
     1375        AddLogLine(line, machineStr);
     1376
    13421377        // uptime
    13431378        if (!RemoteGetUptime(uptime))
    13441379            uptime = 0;
    13451380        line = uptimeStr(uptime);
    13461381
    13471382        // weighted average loads
    1348         line.append(".   " + tr("Load") + ": ");
     1383        line.append("      " + tr("Load") + ": ");
    13491384        float floads[3];
    13501385        if (RemoteGetLoad(floads))
    13511386        {