Apply some minor cosmetic improvements to the details dialog

This commit is contained in:
Cameron Gutman 2024-04-30 21:36:59 -05:00
parent c096238998
commit 0531666f38
2 changed files with 34 additions and 8 deletions

View file

@ -406,11 +406,10 @@ CenteredGridView {
NavigableMessageDialog {
id: showPcDetailsDialog
property int pcIndex : -1;
property string pcDetails : "";
text: showPcDetailsDialog.pcDetails
imageSrc: "qrc:/res/baseline-help_outline-24px.svg"
standardButtons: Dialog.Ok | (SystemProperties.hasBrowser ? Dialog.Help : 0)
standardButtons: Dialog.Ok
}
ScrollBar.vertical: ScrollBar {}

View file

@ -42,20 +42,47 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const
return computer->state == NvComputer::CS_UNKNOWN;
case ServerSupportedRole:
return computer->isSupportedServerVersion;
case DetailsRole:
case DetailsRole: {
QString state, pairState;
switch (computer->state) {
case NvComputer::CS_ONLINE:
state = tr("Online");
break;
case NvComputer::CS_OFFLINE:
state = tr("Offline");
break;
default:
state = tr("Unknown");
break;
}
switch (computer->pairState) {
case NvComputer::PS_PAIRED:
pairState = tr("Paired");
break;
case NvComputer::PS_NOT_PAIRED:
pairState = tr("Unpaired");
break;
default:
pairState = tr("Unknown");
break;
}
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(state)
.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);
.arg(computer->macAddress.isEmpty() ? tr("Unknown") : QString(computer->macAddress.toHex(':')))
.arg(pairState)
.arg(computer->state == NvComputer::CS_ONLINE ? QString::number(computer->currentGameId) : tr("Unknown"))
.arg(computer->state == NvComputer::CS_ONLINE ? QString::number(computer->activeHttpsPort) : tr("Unknown"));
}
default:
return QVariant();
}