Add "View details" to PC list (#1221)

* feat: add view pc details menu item

* feat: show mac address

* fix: cast mac byte array to string
This commit is contained in:
Jorys Paulin 2024-05-01 04:23:25 +02:00 committed by GitHub
commit c096238998
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

View file

@ -42,6 +42,20 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const
return computer->state == NvComputer::CS_UNKNOWN;
case ServerSupportedRole:
return computer->isSupportedServerVersion;
case DetailsRole:
return tr("Name: %1\nStatus: %2\nActive Address: %3\nUUID: %4\nLocal Address: %5\nRemote Address: %6\nIPv6 Address: %7\nManual Address: %8\nMAC Address: %9\nPair State: %10\nRunning Game ID: %11\nHTTPS Port: %12")
.arg(computer->name)
.arg(computer->state == NvComputer::CS_ONLINE ? tr("Online") : tr("Offline"))
.arg(computer->activeAddress.toString())
.arg(computer->uuid)
.arg(computer->localAddress.toString())
.arg(computer->remoteAddress.toString())
.arg(computer->ipv6Address.toString())
.arg(computer->manualAddress.toString())
.arg(computer->macAddress.isEmpty() ? "<NULL>" : QString(computer->macAddress.toHex(':')))
.arg(computer->pairState == NvComputer::PS_PAIRED ? tr("Paired") : tr("Unpaired"))
.arg(computer->currentGameId)
.arg(computer->activeHttpsPort);
default:
return QVariant();
}
@ -69,6 +83,7 @@ QHash<int, QByteArray> ComputerModel::roleNames() const
names[WakeableRole] = "wakeable";
names[StatusUnknownRole] = "statusUnknown";
names[ServerSupportedRole] = "serverSupported";
names[DetailsRole] = "details";
return names;
}