- Timestamp:
- Jun 3, 2008 7:02:33 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMInformationDlg.ui.h
r8997 r9364 543 543 if (osType.isNull()) 544 544 osType = tr ("Not Detected", "guest os type"); 545 else 546 osType = vboxGlobal().vmGuestOSTypeDescription (osType); 545 547 546 548 result += hdrRow.arg ("state_running_16px.png").arg (tr ("Runtime Attributes")); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMInformationDlg.cpp
r9257 r9364 140 140 141 141 updateDetails(); 142 143 AssertReturnVoid (!mSession.isNull()); 144 CMachine machine = mSession.GetMachine(); 145 AssertReturnVoid (!machine.isNull()); 142 143 AssertReturnVoid (!mSession.isNull()); 144 CMachine machine = mSession.GetMachine(); 145 AssertReturnVoid (!machine.isNull()); 146 146 147 147 /* Setup a dialog caption */ … … 154 154 /* Clear counter names initially */ 155 155 mNamesMap.clear(); 156 mUnitsMap.clear(); 157 mLinksMap.clear(); 158 159 /* IDE HD statistics: */ 160 for (int i = 0; i < 2; ++ i) 161 for (int j = 0; j < 2; ++ j) 162 { 163 /* Names */ 164 mNamesMap [QString ("/Devices/ATA%1/Unit%2/*DMA") 165 .arg (i).arg (j)] = tr ("DMA Transfers"); 166 mNamesMap [QString ("/Devices/ATA%1/Unit%2/*PIO") 167 .arg (i).arg (j)] = tr ("PIO Transfers"); 168 mNamesMap [QString ("/Devices/ATA%1/Unit%2/ReadBytes") 169 .arg (i).arg (j)] = tr ("Data Read"); 170 mNamesMap [QString ("/Devices/ATA%1/Unit%2/WrittenBytes") 171 .arg (i).arg (j)] = tr ("Data Written"); 172 173 /* Units */ 174 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/*DMA") 175 .arg (i).arg (j)] = "[B]"; 176 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/*PIO") 177 .arg (i).arg (j)] = "[B]"; 178 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/ReadBytes") 179 .arg (i).arg (j)] = "B"; 180 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/WrittenBytes") 181 .arg (i).arg (j)] = "B"; 182 183 /* Belongs to */ 184 mLinksMap [QString ("IDE%1%2").arg (i).arg (j)] = QStringList() 185 << QString ("/Devices/ATA%1/Unit%2/*DMA").arg (i).arg (j) 186 << QString ("/Devices/ATA%1/Unit%2/*PIO").arg (i).arg (j) 187 << QString ("/Devices/ATA%1/Unit%2/ReadBytes").arg (i).arg (j) 188 << QString ("/Devices/ATA%1/Unit%2/WrittenBytes").arg (i).arg (j); 189 } 190 191 /* SATA HD statistics: */ 192 for (int i = 0; i < 30; ++ i) 193 { 194 /* Names */ 195 mNamesMap [QString ("/Devices/SATA/Port%1/DMA").arg (i)] 196 = tr ("DMA Transfers"); 197 mNamesMap [QString ("/Devices/SATA/Port%1/ReadBytes").arg (i)] 198 = tr ("Data Read"); 199 mNamesMap [QString ("/Devices/SATA/Port%1/WrittenBytes").arg (i)] 200 = tr ("Data Written"); 201 202 /* Units */ 203 mUnitsMap [QString ("/Devices/SATA/Port%1/DMA").arg (i)] = "[B]"; 204 mUnitsMap [QString ("/Devices/SATA/Port%1/ReadBytes").arg (i)] = "B"; 205 mUnitsMap [QString ("/Devices/SATA/Port%1/WrittenBytes").arg (i)] = "B"; 206 207 /* Belongs to */ 208 mLinksMap [QString ("SATA%1").arg (i)] = QStringList() 209 << QString ("/Devices/SATA/Port%1/DMA").arg (i) 210 << QString ("/Devices/SATA/Port%1/ReadBytes").arg (i) 211 << QString ("/Devices/SATA/Port%1/WrittenBytes").arg (i); 212 } 213 214 /* Network Adapters statistics: */ 215 ulong count = vboxGlobal().virtualBox() 216 .GetSystemProperties().GetNetworkAdapterCount(); 156 mUnitsMap.clear(); 157 mLinksMap.clear(); 158 159 /* IDE HD statistics: */ 160 for (int i = 0; i < 2; ++ i) 161 for (int j = 0; j < 2; ++ j) 162 { 163 /* Names */ 164 mNamesMap [QString ("/Devices/ATA%1/Unit%2/*DMA") 165 .arg (i).arg (j)] = tr ("DMA Transfers"); 166 mNamesMap [QString ("/Devices/ATA%1/Unit%2/*PIO") 167 .arg (i).arg (j)] = tr ("PIO Transfers"); 168 mNamesMap [QString ("/Devices/ATA%1/Unit%2/ReadBytes") 169 .arg (i).arg (j)] = tr ("Data Read"); 170 mNamesMap [QString ("/Devices/ATA%1/Unit%2/WrittenBytes") 171 .arg (i).arg (j)] = tr ("Data Written"); 172 173 /* Units */ 174 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/*DMA") 175 .arg (i).arg (j)] = "[B]"; 176 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/*PIO") 177 .arg (i).arg (j)] = "[B]"; 178 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/ReadBytes") 179 .arg (i).arg (j)] = "B"; 180 mUnitsMap [QString ("/Devices/ATA%1/Unit%2/WrittenBytes") 181 .arg (i).arg (j)] = "B"; 182 183 /* Belongs to */ 184 mLinksMap [QString ("IDE%1%2").arg (i).arg (j)] = QStringList() 185 << QString ("/Devices/ATA%1/Unit%2/*DMA").arg (i).arg (j) 186 << QString ("/Devices/ATA%1/Unit%2/*PIO").arg (i).arg (j) 187 << QString ("/Devices/ATA%1/Unit%2/ReadBytes").arg (i).arg (j) 188 << QString ("/Devices/ATA%1/Unit%2/WrittenBytes").arg (i).arg (j); 189 } 190 191 /* SATA HD statistics: */ 192 for (int i = 0; i < 30; ++ i) 193 { 194 /* Names */ 195 mNamesMap [QString ("/Devices/SATA/Port%1/DMA").arg (i)] 196 = tr ("DMA Transfers"); 197 mNamesMap [QString ("/Devices/SATA/Port%1/ReadBytes").arg (i)] 198 = tr ("Data Read"); 199 mNamesMap [QString ("/Devices/SATA/Port%1/WrittenBytes").arg (i)] 200 = tr ("Data Written"); 201 202 /* Units */ 203 mUnitsMap [QString ("/Devices/SATA/Port%1/DMA").arg (i)] = "[B]"; 204 mUnitsMap [QString ("/Devices/SATA/Port%1/ReadBytes").arg (i)] = "B"; 205 mUnitsMap [QString ("/Devices/SATA/Port%1/WrittenBytes").arg (i)] = "B"; 206 207 /* Belongs to */ 208 mLinksMap [QString ("SATA%1").arg (i)] = QStringList() 209 << QString ("/Devices/SATA/Port%1/DMA").arg (i) 210 << QString ("/Devices/SATA/Port%1/ReadBytes").arg (i) 211 << QString ("/Devices/SATA/Port%1/WrittenBytes").arg (i); 212 } 213 214 /* Network Adapters statistics: */ 215 ulong count = vboxGlobal().virtualBox() 216 .GetSystemProperties().GetNetworkAdapterCount(); 217 217 for (ulong i = 0; i < count; ++ i) 218 { 219 CNetworkAdapter na = machine.GetNetworkAdapter (i); 220 KNetworkAdapterType ty = na.GetAdapterType(); 221 const char *name; 222 223 switch (ty) 224 { 218 { 219 CNetworkAdapter na = machine.GetNetworkAdapter (i); 220 KNetworkAdapterType ty = na.GetAdapterType(); 221 const char *name; 222 223 switch (ty) 224 { 225 225 case KNetworkAdapterType_I82540EM: 226 226 case KNetworkAdapterType_I82543GC: 227 name = "E1k"; 228 break; 229 default: 230 name = "PCNet"; 231 break; 232 } 233 234 /* Names */ 235 mNamesMap [QString ("/Devices/%1%2/TransmitBytes") 236 .arg (name).arg (i)] = tr ("Data Transmitted"); 237 mNamesMap [QString ("/Devices/%1%2/ReceiveBytes") 238 .arg (name).arg (i)] = tr ("Data Received"); 239 240 /* Units */ 241 mUnitsMap [QString ("/Devices/%1%2/TransmitBytes") 242 .arg (name).arg (i)] = "B"; 243 mUnitsMap [QString ("/Devices/%1%2/ReceiveBytes") 244 .arg (name).arg (i)] = "B"; 245 246 /* Belongs to */ 247 mLinksMap [QString ("NA%1").arg (i)] = QStringList() 248 << QString ("/Devices/%1%2/TransmitBytes").arg (name).arg (i) 227 name = "E1k"; 228 break; 229 default: 230 name = "PCNet"; 231 break; 232 } 233 234 /* Names */ 235 mNamesMap [QString ("/Devices/%1%2/TransmitBytes") 236 .arg (name).arg (i)] = tr ("Data Transmitted"); 237 mNamesMap [QString ("/Devices/%1%2/ReceiveBytes") 238 .arg (name).arg (i)] = tr ("Data Received"); 239 240 /* Units */ 241 mUnitsMap [QString ("/Devices/%1%2/TransmitBytes") 242 .arg (name).arg (i)] = "B"; 243 mUnitsMap [QString ("/Devices/%1%2/ReceiveBytes") 244 .arg (name).arg (i)] = "B"; 245 246 /* Belongs to */ 247 mLinksMap [QString ("NA%1").arg (i)] = QStringList() 248 << QString ("/Devices/%1%2/TransmitBytes").arg (name).arg (i) 249 249 << QString ("/Devices/%1%2/ReceiveBytes").arg (name).arg (i); 250 250 } … … 403 403 resolution += QString ("x%1").arg (bpp); 404 404 QString virt = console.GetDebugger().GetHWVirtExEnabled() ? 405 VBoxGlobal::tr ("Enabled", "details report (VT-x/AMD-V)") : 406 VBoxGlobal::tr ("Disabled", "details report (VT-x/AMD-V)"); 407 QString addInfo = console.GetGuest().GetAdditionsVersion(); 408 uint addVersion = addInfo.toUInt(); 409 QString addVerisonStr = !addInfo.isNull() ? 410 tr ("Version %1.%2", "guest additions") 411 .arg (RT_HIWORD (addVersion)).arg (RT_LOWORD (addVersion)) : 412 tr ("Not Detected", "guest additions"); 413 QString osType = console.GetGuest().GetOSTypeId(); 414 if (osType.isNull()) 405 VBoxGlobal::tr ("Enabled", "details report (VT-x/AMD-V)") : 406 VBoxGlobal::tr ("Disabled", "details report (VT-x/AMD-V)"); 407 QString addInfo = console.GetGuest().GetAdditionsVersion(); 408 uint addVersion = addInfo.toUInt(); 409 QString addVerisonStr = !addInfo.isNull() ? 410 tr ("Version %1.%2", "guest additions") 411 .arg (RT_HIWORD (addVersion)).arg (RT_LOWORD (addVersion)) : 412 tr ("Not Detected", "guest additions"); 413 QString osType = console.GetGuest().GetOSTypeId(); 414 if (osType.isNull()) 415 415 osType = tr ("Not Detected", "guest os type"); 416 else 417 osType = vboxGlobal().vmGuestOSTypeDescription (osType); 416 418 417 419 result += hdrRow.arg (":/state_running_16px.png").arg (tr ("Runtime Attributes")); 418 420 result += bdyRow.arg (tr ("Screen Resolution")).arg (resolution) + 419 bdyRow.arg (VBoxGlobal::tr ("VT-x/AMD-V", "details report")).arg (virt); 421 bdyRow.arg (VBoxGlobal::tr ("VT-x/AMD-V", "details report")).arg (virt); 420 422 result += bdyRow.arg (tr ("Guest Additions")).arg (addVerisonStr); 421 423 result += bdyRow.arg (tr ("Guest OS Type")).arg (osType); … … 424 426 425 427 /* Hard Disk Statistics */ 426 { 427 QString hdStat; 428 429 result += hdrRow.arg (":/hd_16px.png").arg (tr ("Hard Disk Statistics")); 430 431 /* IDE Hard Disk (Primary Master) */ 432 if (!m.GetHardDisk (KStorageBus_IDE, 0, 0).isNull()) 433 { 434 hdStat += formatHardDisk (KStorageBus_IDE, 0, 0, "IDE00"); 435 hdStat += paragraph; 436 } 437 438 /* IDE Hard Disk (Primary Slave) */ 439 if (!m.GetHardDisk (KStorageBus_IDE, 0, 1).isNull()) 440 { 441 hdStat += formatHardDisk (KStorageBus_IDE, 0, 1, "IDE01"); 442 hdStat += paragraph; 443 } 444 445 /* IDE Hard Disk (Secondary Slave) */ 446 if (!m.GetHardDisk (KStorageBus_IDE, 1, 1).isNull()) 447 { 448 hdStat += formatHardDisk (KStorageBus_IDE, 1, 1, "IDE11"); 449 hdStat += paragraph; 450 } 451 452 /* SATA Hard Disks */ 453 for (int i = 0; i < 30; ++ i) 454 { 455 if (!m.GetHardDisk (KStorageBus_SATA, i, 0).isNull()) 456 { 457 hdStat += formatHardDisk (KStorageBus_SATA, i, 0, 458 QString ("SATA%1").arg (i)); 459 hdStat += paragraph; 460 } 461 } 462 463 /* If there are no Hard Disks */ 464 if (hdStat.isNull()) 465 { 428 { 429 QString hdStat; 430 431 result += hdrRow.arg (":/hd_16px.png").arg (tr ("Hard Disk Statistics")); 432 433 /* IDE Hard Disk (Primary Master) */ 434 if (!m.GetHardDisk (KStorageBus_IDE, 0, 0).isNull()) 435 { 436 hdStat += formatHardDisk (KStorageBus_IDE, 0, 0, "IDE00"); 437 hdStat += paragraph; 438 } 439 440 /* IDE Hard Disk (Primary Slave) */ 441 if (!m.GetHardDisk (KStorageBus_IDE, 0, 1).isNull()) 442 { 443 hdStat += formatHardDisk (KStorageBus_IDE, 0, 1, "IDE01"); 444 hdStat += paragraph; 445 } 446 447 /* IDE Hard Disk (Secondary Slave) */ 448 if (!m.GetHardDisk (KStorageBus_IDE, 1, 1).isNull()) 449 { 450 hdStat += formatHardDisk (KStorageBus_IDE, 1, 1, "IDE11"); 451 hdStat += paragraph; 452 } 453 454 /* SATA Hard Disks */ 455 for (int i = 0; i < 30; ++ i) 456 { 457 if (!m.GetHardDisk (KStorageBus_SATA, i, 0).isNull()) 458 { 459 hdStat += formatHardDisk (KStorageBus_SATA, i, 0, 460 QString ("SATA%1").arg (i)); 461 hdStat += paragraph; 462 } 463 } 464 465 /* If there are no Hard Disks */ 466 if (hdStat.isNull()) 467 { 466 468 hdStat = composeArticle (tr ("No Hard Disks")); 467 hdStat += paragraph; 468 } 469 470 result += hdStat; 471 472 /* CD/DVD-ROM (Secondary Master) */ 473 result += hdrRow.arg (":/cd_16px.png").arg (tr ("CD/DVD-ROM Statistics")); 474 result += formatHardDisk (KStorageBus_IDE, 1, 0, "IDE10"); 475 result += paragraph; 476 } 469 hdStat += paragraph; 470 } 471 472 result += hdStat; 473 474 /* CD/DVD-ROM (Secondary Master) */ 475 result += hdrRow.arg (":/cd_16px.png").arg (tr ("CD/DVD-ROM Statistics")); 476 result += formatHardDisk (KStorageBus_IDE, 1, 0, "IDE10"); 477 result += paragraph; 478 } 477 479 478 480 /* Network Adapters Statistics */ 479 { 481 { 480 482 QString naStat; 481 483 482 result += hdrRow.arg (":/nw_16px.png") 483 .arg (tr ("Network Adapter Statistics")); 484 485 /* Network Adapters list */ 486 ulong count = vboxGlobal().virtualBox() 487 .GetSystemProperties().GetNetworkAdapterCount(); 488 for (ulong slot = 0; slot < count; ++ slot) 489 { 490 if (m.GetNetworkAdapter (slot).GetEnabled()) 491 { 492 naStat += formatAdapter (slot, QString ("NA%1").arg (slot)); 493 naStat += paragraph; 494 } 495 } 496 497 /* If there are no Network Adapters */ 498 if (naStat.isNull()) 499 { 484 result += hdrRow.arg (":/nw_16px.png") 485 .arg (tr ("Network Adapter Statistics")); 486 487 /* Network Adapters list */ 488 ulong count = vboxGlobal().virtualBox() 489 .GetSystemProperties().GetNetworkAdapterCount(); 490 for (ulong slot = 0; slot < count; ++ slot) 491 { 492 if (m.GetNetworkAdapter (slot).GetEnabled()) 493 { 494 naStat += formatAdapter (slot, QString ("NA%1").arg (slot)); 495 naStat += paragraph; 496 } 497 } 498 499 /* If there are no Network Adapters */ 500 if (naStat.isNull()) 501 { 500 502 naStat = composeArticle (tr ("No Network Adapters")); 501 naStat += paragraph; 502 } 503 naStat += paragraph; 504 } 503 505 504 506 result += naStat; … … 510 512 } 511 513 512 QString VBoxVMInformationDlg::formatHardDisk (KStorageBus aBus, 513 LONG aChannel, 514 LONG aDevice, 514 QString VBoxVMInformationDlg::formatHardDisk (KStorageBus aBus, 515 LONG aChannel, 516 LONG aDevice, 515 517 const QString &aBelongsTo) 516 518 { … … 520 522 CHardDisk hd = mSession.GetMachine().GetHardDisk (aBus, aChannel, aDevice); 521 523 QString header = "<tr><td></td><td colspan=3><nobr><u>%1</u></nobr></td></tr>"; 522 QString name = vboxGlobal().toFullString (aBus, aChannel, aDevice); 523 QString result = hd.isNull() ? QString::null : header.arg (name); 524 QString name = vboxGlobal().toFullString (aBus, aChannel, aDevice); 525 QString result = hd.isNull() ? QString::null : header.arg (name); 524 526 result += composeArticle (aBelongsTo); 525 527 return result; 526 528 } 527 529 528 QString VBoxVMInformationDlg::formatAdapter (ULONG aSlot, 530 QString VBoxVMInformationDlg::formatAdapter (ULONG aSlot, 529 531 const QString &aBelongsTo) 530 532 { … … 533 535 534 536 QString header = "<tr><td></td><td colspan=3><nobr><u>%1</u></nobr></td></tr>"; 535 QString name = VBoxGlobal::tr ("Adapter %1", "details report (network)").arg (aSlot); 536 QString result = header.arg (name); 537 QString name = VBoxGlobal::tr ("Adapter %1", "details report (network)").arg (aSlot); 538 QString result = header.arg (name); 537 539 result += composeArticle (aBelongsTo); 538 540 return result; 539 541 } 540 542 541 QString VBoxVMInformationDlg::composeArticle (const QString &aBelongsTo) 542 { 543 QString body = "<tr><td></td><td><nobr>%1</nobr></td><td align=right>" 543 QString VBoxVMInformationDlg::composeArticle (const QString &aBelongsTo) 544 { 545 QString body = "<tr><td></td><td><nobr>%1</nobr></td><td align=right>" 544 546 "<nobr>%2%3</nobr></td><td></td></tr>"; 545 547 QString result; 546 548 547 if (mLinksMap.contains (aBelongsTo)) 548 { 549 QStringList keyList = mLinksMap [aBelongsTo]; 550 for (QStringList::Iterator it = keyList.begin(); it != keyList.end(); ++ it) 551 { 552 QString line (body); 553 QString key = *it; 554 if (mNamesMap.contains (key) && 555 mValuesMap.contains (key) && 556 mUnitsMap.contains (key)) 557 { 558 line = line.arg (mNamesMap [key]) 559 .arg (QString ("%L1") 560 .arg (mValuesMap [key].toULongLong())); 561 line = mUnitsMap [key].contains (QRegExp ("\\[\\S+\\]")) ? 562 line.arg (QString ("<img src=:/tpixel.png width=%1 height=1>") 563 .arg (QApplication::fontMetrics().width ( 564 QString (" %1").arg (mUnitsMap [key] 565 .mid (1, mUnitsMap [key].length() - 2))))) : 566 line.arg (QString (" %1").arg (mUnitsMap [key])); 567 result += line; 568 } 569 } 570 } 571 else 549 if (mLinksMap.contains (aBelongsTo)) 550 { 551 QStringList keyList = mLinksMap [aBelongsTo]; 552 for (QStringList::Iterator it = keyList.begin(); it != keyList.end(); ++ it) 553 { 554 QString line (body); 555 QString key = *it; 556 if (mNamesMap.contains (key) && 557 mValuesMap.contains (key) && 558 mUnitsMap.contains (key)) 559 { 560 line = line.arg (mNamesMap [key]) 561 .arg (QString ("%L1") 562 .arg (mValuesMap [key].toULongLong())); 563 line = mUnitsMap [key].contains (QRegExp ("\\[\\S+\\]")) ? 564 line.arg (QString ("<img src=:/tpixel.png width=%1 height=1>") 565 .arg (QApplication::fontMetrics().width ( 566 QString (" %1").arg (mUnitsMap [key] 567 .mid (1, mUnitsMap [key].length() - 2))))) : 568 line.arg (QString (" %1").arg (mUnitsMap [key])); 569 result += line; 570 } 571 } 572 } 573 else 572 574 result = body.arg (aBelongsTo).arg (QString::null).arg (QString::null); 573 575
Note:
See TracChangeset
for help on using the changeset viewer.