Changeset 6719 in vbox
- Timestamp:
- Feb 1, 2008 1:20:51 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMInformationDlg.ui
r6630 r6719 141 141 <slot access="protected">updateDetails()</slot> 142 142 <slot access="protected">processStatistics()</slot> 143 <slot access="protected">onPageChanged( QWidget* )</slot> 143 144 </slots> 144 145 <functions> … … 156 157 <function returnType="QString" access="pritave">parseStatistics( const QString & )</function> 157 158 <function access="pritave">refreshStatistics()</function> 158 <function returnType="QString" access="pritave">composeArticle( const QString &, int, int, int, int )</function> 159 <function returnType="QString" access="pritave">formatHardDisk( const QString &, CEnums::DiskControllerType, LONG, int, int )</function> 160 <function returnType="QString" access="pritave">formatAdapter( const QString &, ULONG, int, int )</function> 161 <function returnType="QString" access="pritave">composeArticle( const QString &, int, int )</function> 159 162 </functions> 160 163 <pixmapinproject/> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMInformationDlg.ui.h
r6652 r6719 36 36 { 37 37 /* creating new information dialog if there is no one existing */ 38 mSelfArray [machine.GetName()] = new VBoxVMInformationDlg (0, 38 mSelfArray [machine.GetName()] = new VBoxVMInformationDlg ( 39 aConsole->topLevelWidget(), 39 40 "VBoxVMInformationDlg", WType_TopLevel | WDestructiveClose); 40 41 /* read new machine data for this information dialog */ … … 72 73 /* logs list creation */ 73 74 mInfoStack = new QTabWidget (mInfoFrame, "mInfoStack"); 75 mInfoStack->setMargin (10); 74 76 QVBoxLayout *infoFrameLayout = new QVBoxLayout (mInfoFrame); 75 77 infoFrameLayout->addWidget (mInfoStack); … … 77 79 /* details view creation */ 78 80 mDetailsText = new QTextBrowser(); 79 mDetailsText->setFrameShape (QFrame::NoFrame); 80 mDetailsText->setMargin (3); 81 mDetailsText->setFrameShape (QFrame::NoFrame); 81 82 mDetailsText->setPaper (backgroundBrush()); 82 83 mInfoStack->addTab (mDetailsText, 83 VBoxGlobal::iconSet (" help_16px.png"),84 VBoxGlobal::iconSet ("settings_16px.png"), 84 85 QString::null); 85 86 86 87 /* statistic view creation */ 87 88 mStatisticText = new QTextBrowser(); 88 mStatisticText->setFrameShape (QFrame::NoFrame); 89 mStatisticText->setMargin (3); 89 mStatisticText->setFrameShape (QFrame::NoFrame); 90 90 mStatisticText->setPaper (backgroundBrush()); 91 91 mInfoStack->addTab (mStatisticText, … … 95 95 /* full list of statistics counters to get total info */ 96 96 // mDefStatText = new QTextBrowser(); 97 // mDefStatText->setFrameShape (QFrame::NoFrame); 98 // mDefStatText->setMargin (3); 97 // mDefStatText->setFrameShape (QFrame::NoFrame); 99 98 // mDefStatText->setPaper (backgroundBrush()); 100 99 // mInfoStack->addTab (mDefStatText, … … 105 104 languageChangeImp(); 106 105 107 resize (800, 550); 106 /* make initial resize */ 107 resize (600, 450); 108 109 /* show statistics page and make it focused */ 110 connect (mInfoStack, SIGNAL (currentChanged (QWidget*)), 111 this, SLOT (onPageChanged (QWidget*))); 112 mInfoStack->showPage (mStatisticText); 108 113 } 109 114 … … 111 116 void VBoxVMInformationDlg::destroy() 112 117 { 113 mSelfArray.erase (mSession.GetMachine().GetName()); 118 if (!mSession.isNull() && !mSession.GetMachine().isNull()) 119 mSelfArray.erase (mSession.GetMachine().GetName()); 114 120 } 115 121 … … 153 159 154 160 /* Setup a tabwidget page names. */ 155 mInfoStack->changeTab (mDetailsText, tr ("& Basic"));161 mInfoStack->changeTab (mDetailsText, tr ("&Details")); 156 162 mInfoStack->changeTab (mStatisticText, tr ("&Runtime")); 157 // mInfoStack->changeTab (mDefStatText, tr (" &Default Stat"));163 // mInfoStack->changeTab (mDefStatText, tr ("De&fault Stat")); 158 164 159 165 /* Clear counter names initially. */ … … 183 189 mNamesMap ["/Devices/PCNet0/TransmitBytes"] = tr ("Amount of bytes transmitted"); 184 190 mNamesMap ["/Devices/PCNet0/ReceiveBytes"] = tr ("Amount of bytes received"); 191 185 192 mNamesMap ["/Devices/PCNet1/TransmitBytes"] = tr ("Amount of bytes transmitted"); 186 193 mNamesMap ["/Devices/PCNet1/ReceiveBytes"] = tr ("Amount of bytes received"); 194 195 mNamesMap ["/Devices/PCNet2/TransmitBytes"] = tr ("Amount of bytes transmitted"); 196 mNamesMap ["/Devices/PCNet2/ReceiveBytes"] = tr ("Amount of bytes received"); 197 198 mNamesMap ["/Devices/PCNet3/TransmitBytes"] = tr ("Amount of bytes transmitted"); 199 mNamesMap ["/Devices/PCNet3/ReceiveBytes"] = tr ("Amount of bytes received"); 187 200 188 201 /* Statistics page update. */ … … 324 337 325 338 339 void VBoxVMInformationDlg::onPageChanged (QWidget *aPage) 340 { 341 /* focusing the browser on shown page */ 342 aPage->setFocus(); 343 } 344 345 326 346 void VBoxVMInformationDlg::processStatistics() 327 347 { … … 345 365 } 346 366 367 347 368 QString VBoxVMInformationDlg::parseStatistics (const QString &aText) 348 369 { … … 350 371 QRegExp query ("^.+<Statistics>\n(.+)\n</Statistics>.*$"); 351 372 if (query.search (aText) == -1) 352 {353 AssertMsgFailed (("Statistics format doesn't match.\n"));354 373 return QString::null; 355 } 374 356 375 QStringList wholeList = QStringList::split ("\n", query.cap (1)); 357 376 … … 386 405 } 387 406 407 408 void VBoxVMInformationDlg::refreshStatistics() 409 { 410 if (mSession.isNull()) 411 return; 412 413 QString table = "<p><table border=0 cellspacing=0 cellpadding=0 width=100%>%1</table></p>"; 414 QString hdrRow = "<tr><td align=left><img src='%1'></td><td colspan=2><b>%2</b></td></tr>"; 415 QString bdyRow = "<tr><td></td><td><nobr>%1</nobr></td><td width=100%><nobr>%2</nobr></td></tr>"; 416 QString paragraph = "<tr><td colspan=3></td></tr>"; 417 QString interline = "<tr><td colspan=3><font size=1> </font></td></tr>"; 418 QString result; 419 420 /* Screen & VT-X Runtime Parameters */ 421 { 422 CConsole console = mSession.GetConsole(); 423 ULONG bpp = console.GetDisplay().GetBitsPerPixel(); 424 QString resolution = QString ("%1x%2") 425 .arg (console.GetDisplay().GetWidth()) 426 .arg (console.GetDisplay().GetHeight()); 427 if (bpp) 428 resolution += QString ("x%1").arg (bpp); 429 QString virt = console.GetDebugger().GetHWVirtExEnabled() ? 430 tr ("Enabled") : tr ("Disabled"); 431 432 result += hdrRow.arg ("state_running_16px.png").arg (tr ("Runtime Attributes")); 433 result += bdyRow.arg (tr ("Screen Resolution")).arg (resolution) + 434 bdyRow.arg (tr ("Hardware Virtualization")).arg (virt); 435 result += paragraph; 436 } 437 438 /* Hard Disk Statistics. */ 439 result += hdrRow.arg ("hd_16px.png").arg (tr ("Hard Disks Statistics")); 440 result += formatHardDisk (tr ("Primary Master"), CEnums::IDE0Controller, 0, 0, 1); 441 result += interline; 442 result += formatHardDisk (tr ("Primary Slave"), CEnums::IDE0Controller, 1, 4, 5); 443 result += interline; 444 result += formatHardDisk (tr ("Secondary Master"), CEnums::IDE1Controller, 0, 8, 9); 445 result += interline; 446 result += formatHardDisk (tr ("Secondary Slave"), CEnums::IDE1Controller, 1, 12, 13); 447 result += paragraph; 448 449 /* Network Adapters Statistics. */ 450 result += hdrRow.arg ("nw_16px.png").arg (tr ("Network Adapters Statistics")); 451 result += formatAdapter (tr ("Adapter 1"), 0, 16, 17); 452 result += interline; 453 result += formatAdapter (tr ("Adapter 2"), 1, 18, 19); 454 result += interline; 455 result += formatAdapter (tr ("Adapter 3"), 2, 20, 21); 456 result += interline; 457 result += formatAdapter (tr ("Adapter 4"), 3, 22, 23); 458 459 /* Show full composed page. */ 460 mStatisticText->setText (table.arg (result)); 461 } 462 463 464 QString VBoxVMInformationDlg::formatHardDisk (const QString &aName, 465 CEnums::DiskControllerType aType, 466 LONG aSlot, int aStart, int aFinish) 467 { 468 if (mSession.isNull()) 469 return QString::null; 470 471 QString header = "<tr><td></td><td colspan=2><nobr><u>%1</u></nobr></td></tr>"; 472 CMachine machine = mSession.GetMachine(); 473 474 QString result = header.arg (aName); 475 CHardDisk hd = machine.GetHardDisk (aType, aSlot); 476 if (!hd.isNull() || (aType == CEnums::IDE1Controller && aSlot == 0)) 477 { 478 result += composeArticle (QString::null, aStart, aFinish); 479 result += composeArticle ("B", aStart + 2, aFinish + 2); 480 } 481 else 482 result += composeArticle (tr ("Not attached"), -1, -1); 483 return result; 484 } 485 486 QString VBoxVMInformationDlg::formatAdapter (const QString &aName, 487 ULONG aSlot, 488 int aStart, int aFinish) 489 490 { 491 if (mSession.isNull()) 492 return QString::null; 493 494 QString header = "<tr><td></td><td colspan=2><nobr><u>%1</u></nobr></td></tr>"; 495 CMachine machine = mSession.GetMachine(); 496 497 QString result = header.arg (aName); 498 CNetworkAdapter na = machine.GetNetworkAdapter (aSlot); 499 result += na.GetEnabled() ? 500 composeArticle ("B", aStart, aFinish) : 501 composeArticle (tr ("Disabled"), -1, -1); 502 return result; 503 } 504 505 506 QString VBoxVMInformationDlg::composeArticle (const QString &aUnits, 507 int aStart, int aFinish) 508 { 509 QString body = "<tr><td></td><td><nobr>%1</nobr></td><td width=100%><nobr>%2</nobr></td></tr>"; 510 511 QString result; 512 513 if (aStart == -1 && aFinish == -1) 514 result += body.arg (aUnits).arg (QString::null); 515 else for (int id = aStart; id <= aFinish; ++ id) 516 { 517 QString line = body; 518 if (mValuesMap.contains (mNamesMap.keys() [id])) 519 { 520 line = line.arg (mNamesMap.values() [id]); 521 ULONG64 value = mValuesMap.values() [id].toULongLong(); 522 line = aUnits.isNull() ? 523 line.arg (QString ("%L1").arg (value)) : 524 line.arg (QString ("%L1 %2").arg (value).arg (aUnits)); 525 } 526 result += line; 527 } 528 529 return result; 530 } 531 532 533 /* Old code for two columns support */ 534 #if 0 388 535 void VBoxVMInformationDlg::refreshStatistics() 389 536 { … … 411 558 tr ("Enabled") : tr ("Disabled"); 412 559 413 result += hdrRow.arg ("s ettings_16px.png").arg (tr ("Runtime Attributes"));560 result += hdrRow.arg ("state_running_16px.png").arg (tr ("Runtime Attributes")); 414 561 result += bdyRow.arg (tr ("Screen Resolution")) .arg (resolution) 415 562 .arg (tr ("Hardware Virtualization")).arg (virt); … … 439 586 } 440 587 588 441 589 QString VBoxVMInformationDlg::composeArticle (const QString &aUnits, 442 590 int aStart1, int aFinish1, … … 452 600 { 453 601 QString line = bdyRow; 602 /* Processing first column */ 454 603 if (id1 > aFinish1) 455 604 { 456 line = line.arg (QString::null).arg (QString::null).arg (QString::null); 605 line = line.arg (QString::null).arg (QString::null) 606 .arg (QString::null).arg (QString::null); 457 607 } 458 608 else if (mValuesMap.contains (mNamesMap.keys() [id1])) … … 464 614 line.arg (QString ("%L1 %2").arg (value).arg (aUnits)); 465 615 } 616 /* Processing second column */ 466 617 if (id2 > aFinish2) 467 618 { 468 line = line.arg (QString::null).arg (QString::null).arg (QString::null); 619 line = line.arg (QString::null).arg (QString::null) 620 .arg (QString::null).arg (QString::null); 469 621 } 470 622 else if (mValuesMap.contains (mNamesMap.keys() [id2])) … … 482 634 return result; 483 635 } 484 636 #endif 637
Note:
See TracChangeset
for help on using the changeset viewer.