VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMInformationDlg.ui.h@ 6724

Last change on this file since 6724 was 6719, checked in by vboxsync, 17 years ago

1761: “Create VM session information dialog”:

  1. The margins around the HTML widget made as thick as on the Details page of the main (VM Selector) window.
  2. "Basic" page renamed to "Details" (gear icon used for it).
  3. "Runtime" page made the default visible.
  4. "Green arrow" icon used for the "Runtime Attributes header".
  5. To avoid large dialog width "one column mode" is used: extended margin and large attributes values leads to enlarging dialog to annoying width in case of two columns.
  6. Disabled adapters are marked "Disabled" now and not attached Hard Disks are marked "Not attached".
  7. HTML widget have the initial focus now. Moreover, switching between pages enables focus to switched page.
  8. Session Info Dialog is now centered relative to it's VM window, not the desktop.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 22.5 KB
Line 
1/**
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * "VirtualBox Information Dialog" dialog UI include (Qt Designer)
5 */
6
7/*
8 * Copyright (C) 2006 innotek GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19/****************************************************************************
20** ui.h extension file, included from the uic-generated form implementation.
21**
22** If you wish to add, delete or rename functions or slots use
23** Qt Designer which will update this file, preserving your code. Create an
24** init() function in place of a constructor, and a destroy() function in
25** place of a destructor.
26*****************************************************************************/
27
28
29VBoxVMInformationDlg::InfoDlgMap VBoxVMInformationDlg::mSelfArray = InfoDlgMap();
30
31void VBoxVMInformationDlg::createInformationDlg (const CSession &aSession,
32 VBoxConsoleView *aConsole)
33{
34 CMachine machine = aSession.GetMachine();
35 if (mSelfArray.find (machine.GetName()) == mSelfArray.end())
36 {
37 /* creating new information dialog if there is no one existing */
38 mSelfArray [machine.GetName()] = new VBoxVMInformationDlg (
39 aConsole->topLevelWidget(),
40 "VBoxVMInformationDlg", WType_TopLevel | WDestructiveClose);
41 /* read new machine data for this information dialog */
42 mSelfArray [machine.GetName()]->setup (aSession, aConsole);
43 }
44
45 VBoxVMInformationDlg *info = mSelfArray [machine.GetName()];
46 info->show();
47 info->raise();
48 info->setWindowState (info->windowState() & ~WindowMinimized);
49 info->setActiveWindow();
50}
51
52
53void VBoxVMInformationDlg::init()
54{
55 /* dialog initially is not polished */
56 mIsPolished = false;
57
58 /* search the default button */
59 mDefaultButton = searchDefaultButton();
60 qApp->installEventFilter (this);
61
62 /* setup a dialog icon */
63 setIcon (QPixmap::fromMimeSource ("description_16px.png"));
64
65 /* statusbar initially disabled */
66 statusBar()->setHidden (true);
67
68 /* setup size grip */
69 mSizeGrip = new QSizeGrip (centralWidget(), "mSizeGrip");
70 mSizeGrip->resize (mSizeGrip->sizeHint());
71 mSizeGrip->stackUnder (mCloseButton);
72
73 /* logs list creation */
74 mInfoStack = new QTabWidget (mInfoFrame, "mInfoStack");
75 mInfoStack->setMargin (10);
76 QVBoxLayout *infoFrameLayout = new QVBoxLayout (mInfoFrame);
77 infoFrameLayout->addWidget (mInfoStack);
78
79 /* details view creation */
80 mDetailsText = new QTextBrowser();
81 mDetailsText->setFrameShape (QFrame::NoFrame);
82 mDetailsText->setPaper (backgroundBrush());
83 mInfoStack->addTab (mDetailsText,
84 VBoxGlobal::iconSet ("settings_16px.png"),
85 QString::null);
86
87 /* statistic view creation */
88 mStatisticText = new QTextBrowser();
89 mStatisticText->setFrameShape (QFrame::NoFrame);
90 mStatisticText->setPaper (backgroundBrush());
91 mInfoStack->addTab (mStatisticText,
92 VBoxGlobal::iconSet ("state_running_16px.png"),
93 QString::null);
94
95 /* full list of statistics counters to get total info */
96 // mDefStatText = new QTextBrowser();
97 // mDefStatText->setFrameShape (QFrame::NoFrame);
98 // mDefStatText->setPaper (backgroundBrush());
99 // mInfoStack->addTab (mDefStatText,
100 // VBoxGlobal::iconSet ("show_logs_16px.png"),
101 // QString::null);
102
103 /* applying language settings */
104 languageChangeImp();
105
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);
113}
114
115
116void VBoxVMInformationDlg::destroy()
117{
118 if (!mSession.isNull() && !mSession.GetMachine().isNull())
119 mSelfArray.erase (mSession.GetMachine().GetName());
120}
121
122
123void VBoxVMInformationDlg::setup (const CSession &aSession,
124 VBoxConsoleView *aConsole)
125{
126 /* store related machine pointers */
127 mSession = aSession;
128 mConsole = aConsole;
129
130 /* loading language constants */
131 languageChangeImp();
132
133 /* details page update */
134 updateDetails();
135
136 /* statistics page update */
137 processStatistics();
138 mStatTimer.start (5000);
139
140 /* setup handlers */
141 connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)),
142 this, SLOT (updateDetails()));
143 connect (mConsole, SIGNAL (mediaChanged (VBoxDefs::DiskType)),
144 this, SLOT (updateDetails()));
145 connect (mConsole, SIGNAL (sharedFoldersChanged()),
146 this, SLOT (updateDetails()));
147
148 connect (&mStatTimer, SIGNAL (timeout()), this, SLOT (processStatistics()));
149 connect (mConsole, SIGNAL (resizeHintDone()), this, SLOT (processStatistics()));
150}
151
152
153void VBoxVMInformationDlg::languageChangeImp()
154{
155 /* Setup a dialog caption. */
156 if (!mSession.isNull() && !mSession.GetMachine().isNull())
157 setCaption (tr ("%1 - Session Information")
158 .arg (mSession.GetMachine().GetName()));
159
160 /* Setup a tabwidget page names. */
161 mInfoStack->changeTab (mDetailsText, tr ("&Details"));
162 mInfoStack->changeTab (mStatisticText, tr ("&Runtime"));
163 // mInfoStack->changeTab (mDefStatText, tr ("De&fault Stat"));
164
165 /* Clear counter names initially. */
166 mNamesMap.clear();
167
168 /* HD statistics: */
169 mNamesMap ["/Devices/ATA0/Unit0/*DMA"] = tr ("Number of DMA transfers");
170 mNamesMap ["/Devices/ATA0/Unit0/*PIO"] = tr ("Number of PIO transfers");
171 mNamesMap ["/Devices/ATA0/Unit0/ReadBytes"] = tr ("Amount of data read");
172 mNamesMap ["/Devices/ATA0/Unit0/WrittenBytes"] = tr ("Amount of data written");
173
174 mNamesMap ["/Devices/ATA0/Unit1/*DMA"] = tr ("Number of DMA transfers");
175 mNamesMap ["/Devices/ATA0/Unit1/*PIO"] = tr ("Number of PIO transfers");
176 mNamesMap ["/Devices/ATA0/Unit1/ReadBytes"] = tr ("Amount of data read");
177 mNamesMap ["/Devices/ATA0/Unit1/WrittenBytes"] = tr ("Amount of data written");
178
179 mNamesMap ["/Devices/ATA1/Unit0/*DMA"] = tr ("Number of ATAPI DMA transfers");
180 mNamesMap ["/Devices/ATA1/Unit0/*PIO"] = tr ("Number of ATAPI PIO transfers");
181 mNamesMap ["/Devices/ATA1/Unit0/ReadBytes"] = tr ("Amount of data read");
182 mNamesMap ["/Devices/ATA1/Unit0/WrittenBytes"] = tr ("Amount of data written");
183
184 mNamesMap ["/Devices/ATA1/Unit1/*DMA"] = tr ("Number of ATAPI DMA transfers");
185 mNamesMap ["/Devices/ATA1/Unit1/*PIO"] = tr ("Number of ATAPI PIO transfers");
186 mNamesMap ["/Devices/ATA1/Unit1/ReadBytes"] = tr ("Amount of data read");
187 mNamesMap ["/Devices/ATA1/Unit1/WrittenBytes"] = tr ("Amount of data written");
188
189 mNamesMap ["/Devices/PCNet0/TransmitBytes"] = tr ("Amount of bytes transmitted");
190 mNamesMap ["/Devices/PCNet0/ReceiveBytes"] = tr ("Amount of bytes received");
191
192 mNamesMap ["/Devices/PCNet1/TransmitBytes"] = tr ("Amount of bytes transmitted");
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");
200
201 /* Statistics page update. */
202 refreshStatistics();
203}
204
205
206QPushButton* VBoxVMInformationDlg::searchDefaultButton()
207{
208 /* this mechanism is used for searching the default dialog button
209 * and similar the same mechanism in Qt::QDialog inner source */
210 QPushButton *button = 0;
211 QObjectList *list = queryList ("QPushButton");
212 QObjectListIt it (*list);
213 while ((button = (QPushButton*)it.current()) && !button->isDefault())
214 ++ it;
215 return button;
216}
217
218
219bool VBoxVMInformationDlg::eventFilter (QObject *aObject, QEvent *aEvent)
220{
221 switch (aEvent->type())
222 {
223 /* auto-default button focus-in processor used to move the "default"
224 * button property into the currently focused button */
225 case QEvent::FocusIn:
226 {
227 if (aObject->inherits ("QPushButton") &&
228 aObject->parent() == centralWidget())
229 {
230 ((QPushButton*)aObject)->setDefault (aObject != mDefaultButton);
231 if (mDefaultButton)
232 mDefaultButton->setDefault (aObject == mDefaultButton);
233 }
234 break;
235 }
236 /* auto-default button focus-out processor used to remove the "default"
237 * button property from the previously focused button */
238 case QEvent::FocusOut:
239 {
240 if (aObject->inherits ("QPushButton") &&
241 aObject->parent() == centralWidget())
242 {
243 if (mDefaultButton)
244 mDefaultButton->setDefault (aObject != mDefaultButton);
245 ((QPushButton*)aObject)->setDefault (aObject == mDefaultButton);
246 }
247 break;
248 }
249 default:
250 break;
251 }
252 return QMainWindow::eventFilter (aObject, aEvent);
253}
254
255
256bool VBoxVMInformationDlg::event (QEvent *aEvent)
257{
258 bool result = QMainWindow::event (aEvent);
259 switch (aEvent->type())
260 {
261 case QEvent::LanguageChange:
262 {
263 languageChangeImp();
264 break;
265 }
266 default:
267 break;
268 }
269 return result;
270}
271
272
273void VBoxVMInformationDlg::keyPressEvent (QKeyEvent *aEvent)
274{
275 if (aEvent->state() == 0 ||
276 (aEvent->state() & Keypad && aEvent->key() == Key_Enter))
277 {
278 switch (aEvent->key())
279 {
280 /* processing the return keypress for the auto-default button */
281 case Key_Enter:
282 case Key_Return:
283 {
284 QPushButton *currentDefault = searchDefaultButton();
285 if (currentDefault)
286 currentDefault->animateClick();
287 break;
288 }
289 /* processing the escape keypress as the close dialog action */
290 case Key_Escape:
291 {
292 close();
293 break;
294 }
295 }
296 }
297 else
298 aEvent->ignore();
299}
300
301
302void VBoxVMInformationDlg::showEvent (QShowEvent *aEvent)
303{
304 QMainWindow::showEvent (aEvent);
305
306 /* one may think that QWidget::polish() is the right place to do things
307 * below, but apparently, by the time when QWidget::polish() is called,
308 * the widget style & layout are not fully done, at least the minimum
309 * size hint is not properly calculated. Since this is sometimes necessary,
310 * we provide our own "polish" implementation. */
311
312 if (mIsPolished)
313 return;
314
315 mIsPolished = true;
316
317 VBoxGlobal::centerWidget (this, parentWidget());
318}
319
320
321void VBoxVMInformationDlg::resizeEvent (QResizeEvent*)
322{
323 /* adjust the size-grip location for the current resize event */
324 mSizeGrip->move (centralWidget()->rect().bottomRight() -
325 QPoint (mSizeGrip->rect().width() - 1,
326 mSizeGrip->rect().height() - 1));
327}
328
329
330void VBoxVMInformationDlg::updateDetails()
331{
332 /* details page update */
333 mDetailsText->setText (
334 vboxGlobal().detailsReport (mSession.GetMachine(), false /* isNewVM */,
335 false /* withLinks */, false /* refresh */));
336}
337
338
339void VBoxVMInformationDlg::onPageChanged (QWidget *aPage)
340{
341 /* focusing the browser on shown page */
342 aPage->setFocus();
343}
344
345
346void VBoxVMInformationDlg::processStatistics()
347{
348 CMachineDebugger dbg = mSession.GetConsole().GetDebugger();
349 QString info;
350
351 /* Look for all statistics for filtering purposes. */
352 // dbg.GetStats ("*", false, info);
353 // mDefStatText->setText (info);
354
355 /* Process selected statistics: */
356 for (DataMapType::const_iterator it = mNamesMap.begin();
357 it != mNamesMap.end(); ++ it)
358 {
359 dbg.GetStats (it.key(), true, info);
360 mValuesMap [it.key()] = parseStatistics (info);
361 }
362
363 /* Statistics page update. */
364 refreshStatistics();
365}
366
367
368QString VBoxVMInformationDlg::parseStatistics (const QString &aText)
369{
370 /* Filters the statistic counters body. */
371 QRegExp query ("^.+<Statistics>\n(.+)\n</Statistics>.*$");
372 if (query.search (aText) == -1)
373 return QString::null;
374
375 QStringList wholeList = QStringList::split ("\n", query.cap (1));
376
377 ULONG64 summa = 0;
378 for (QStringList::Iterator lineIt = wholeList.begin();
379 lineIt != wholeList.end(); ++ lineIt)
380 {
381 QString text = *lineIt;
382 text.remove (1, 1);
383 text.remove (text.length() - 2, 2);
384
385 /* Parse incoming counter and fill the counter-element values. */
386 CounterElementType counter;
387 counter.type = text.section (" ", 0, 0);
388 text = text.section (" ", 1);
389 QStringList list = QStringList::split ("\" ", text);
390 for (QStringList::Iterator it = list.begin(); it != list.end(); ++ it)
391 {
392 QString pair = *it;
393 QRegExp regExp ("^(.+)=\"([^\"]*)\"?$");
394 regExp.search (pair);
395 counter.list.insert (regExp.cap (1), regExp.cap (2));
396 }
397
398 /* Fill the output with the necessary counter's value.
399 * Currently we are using "c" field of simple counter only. */
400 QString result = counter.list.contains ("c") ? counter.list ["c"] : "0";
401 summa += result.toULongLong();
402 }
403
404 return QString::number (summa);
405}
406
407
408void 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>&nbsp;</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
464QString 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
486QString 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
506QString 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
535void VBoxVMInformationDlg::refreshStatistics()
536{
537 QString table = "<p><table border=0 cellspacing=0 cellpadding=0 width=100%>%1</table></p>";
538 QString hdrRow = "<tr><td align=left><img src='%1'></td><td colspan=4><b>%2</b></td></tr>";
539 QString subRow = "<tr><td></td><td colspan=2><nobr><u>%1</u></nobr></td>"
540 "<td colspan=2><nobr><u>%2</u></nobr></td></tr>";
541 QString bdyRow = "<tr><td></td><td><nobr>%1</nobr></td><td width=50%><nobr>%2</nobr></td>"
542 "<td><nobr>%3</nobr></td><td width=50%><nobr>%4</nobr></td></tr>";
543 QString paragraph = "<tr><td colspan=5></td></tr>";
544 QString interline = "<tr><td colspan=5><font size=1>&nbsp;</font></td></tr>";
545 QString result;
546
547 /* Screen & VT-X Runtime Parameters */
548 if (!mSession.isNull())
549 {
550 CConsole console = mSession.GetConsole();
551 ULONG bpp = console.GetDisplay().GetBitsPerPixel();
552 QString resolution = QString ("%1x%2")
553 .arg (console.GetDisplay().GetWidth())
554 .arg (console.GetDisplay().GetHeight());
555 if (bpp)
556 resolution += QString ("x%1").arg (bpp);
557 QString virt = console.GetDebugger().GetHWVirtExEnabled() ?
558 tr ("Enabled") : tr ("Disabled");
559
560 result += hdrRow.arg ("state_running_16px.png").arg (tr ("Runtime Attributes"));
561 result += bdyRow.arg (tr ("Screen Resolution")) .arg (resolution)
562 .arg (tr ("Hardware Virtualization")).arg (virt);
563 result += paragraph;
564 }
565
566 /* Hard Disk Statistics. */
567 result += hdrRow.arg ("hd_16px.png").arg (tr ("Hard Disks Statistics"));
568
569 result += subRow.arg (tr ("Primary Master")).arg (tr ("Primary Slave"));
570 result += composeArticle (QString::null, 0, 1, 4, 5);
571 result += composeArticle ("B", 2, 3, 6, 7);
572 result += interline;
573
574 result += subRow.arg (tr ("Secondary Master")).arg (tr ("Secondary Slave"));
575 result += composeArticle (QString::null, 8, 9, 12, 13);
576 result += composeArticle ("B", 10, 11, 14, 15);
577 result += paragraph;
578
579 /* Network Adapters Statistics. Counters are currently missed. */
580 result += hdrRow.arg ("nw_16px.png").arg (tr ("Network Adapters Statistics"));
581 result += subRow.arg (tr ("Adapter 1")).arg (tr ("Adapter 2"));
582 result += composeArticle ("B", 16, 17, 18, 19);
583
584 /* Show full composed page. */
585 mStatisticText->setText (table.arg (result));
586}
587
588
589QString VBoxVMInformationDlg::composeArticle (const QString &aUnits,
590 int aStart1, int aFinish1,
591 int aStart2, int aFinish2)
592{
593 QString bdyRow = "<tr><td></td><td><nobr>%1</nobr></td><td width=50%><nobr>%2</nobr></td>"
594 "<td><nobr>%3</nobr></td><td width=50%><nobr>%4</nobr></td></tr>";
595
596 QString result;
597
598 int id1 = aStart1, id2 = aStart2;
599 while (id1 <= aFinish1 || id2 <= aFinish2)
600 {
601 QString line = bdyRow;
602 /* Processing first column */
603 if (id1 > aFinish1)
604 {
605 line = line.arg (QString::null).arg (QString::null)
606 .arg (QString::null).arg (QString::null);
607 }
608 else if (mValuesMap.contains (mNamesMap.keys() [id1]))
609 {
610 line = line.arg (mNamesMap.values() [id1]);
611 ULONG64 value = mValuesMap.values() [id1].toULongLong();
612 line = aUnits.isNull() ?
613 line.arg (QString ("%L1").arg (value)) :
614 line.arg (QString ("%L1 %2").arg (value).arg (aUnits));
615 }
616 /* Processing second column */
617 if (id2 > aFinish2)
618 {
619 line = line.arg (QString::null).arg (QString::null)
620 .arg (QString::null).arg (QString::null);
621 }
622 else if (mValuesMap.contains (mNamesMap.keys() [id2]))
623 {
624 line = line.arg (mNamesMap.values() [id2]);
625 ULONG64 value = mValuesMap.values() [id2].toULongLong();
626 line = aUnits.isNull() ?
627 line.arg (QString ("%L1").arg (value)) :
628 line.arg (QString ("%L1 %2").arg (value).arg (aUnits));
629 }
630 result += line;
631 ++ id1; ++ id2;
632 }
633
634 return result;
635}
636#endif
637
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette