Changeset 39261 in vbox
- Timestamp:
- Nov 10, 2011 12:01:01 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 74796
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r39225 r39261 224 224 /* Assign corresponding vector values: */ 225 225 m_machines[i] = machine; 226 m_changeable[i] = machine.isNull() ? false :226 m_changeable[i] = machine.isNull() || !machine.GetAccessible() ? false : 227 227 machine.GetState() != KMachineState_Stuck && 228 228 machine.GetState() != KMachineState_Saved /* for now! */; … … 370 370 if (!machine.isNull()) 371 371 { 372 QString item = sSectionItemTpl2.arg(tr("Name", "details report"), machine.GetName()) 373 + sSectionItemTpl2.arg(tr("OS Type", "details report"), vboxGlobal().vmGuestOSTypeDescription(machine.GetOSTypeId())); 372 QString item; 373 if (machine.GetAccessible()) 374 { 375 item = sSectionItemTpl2.arg(tr("Name", "details report"), machine.GetName()) 376 + sSectionItemTpl2.arg(tr("OS Type", "details report"), vboxGlobal().vmGuestOSTypeDescription(machine.GetOSTypeId())); 377 } 378 else 379 { 380 item = QString(sSectionItemTpl1).arg(tr("Information inaccessible", "details report")); 381 } 374 382 pLabel->setText(sTableTpl.arg(item)); 375 383 } … … 403 411 if (!machine.isNull()) 404 412 { 405 QString item = sSectionItemTpl2.arg(tr("Base Memory", "details report"), tr("<nobr>%1 MB</nobr>", "details report")) 406 .arg(machine.GetMemorySize()); 407 408 int cCPU = machine.GetCPUCount(); 409 if (cCPU > 1) 410 item += sSectionItemTpl2.arg(tr("Processors", "details report"), tr("<nobr>%1</nobr>", "details report")) 411 .arg(cCPU); 412 413 int iCPUExecCap = machine.GetCPUExecutionCap(); 414 if (iCPUExecCap < 100) 415 item += sSectionItemTpl2.arg(tr("Execution Cap", "details report"), tr("<nobr>%1%</nobr>", "details report")) 416 .arg(iCPUExecCap); 417 418 /* Boot order: */ 419 QStringList bootOrder; 420 for (ulong i = 1; i <= m_vbox.GetSystemProperties().GetMaxBootPosition(); ++i) 413 QString item; 414 if (machine.GetAccessible()) 421 415 { 422 KDeviceType device = machine.GetBootOrder(i); 423 if (device == KDeviceType_Null) 424 continue; 425 bootOrder << vboxGlobal().toString(device); 416 item = sSectionItemTpl2.arg(tr("Base Memory", "details report"), tr("<nobr>%1 MB</nobr>", "details report")) 417 .arg(machine.GetMemorySize()); 418 419 int cCPU = machine.GetCPUCount(); 420 if (cCPU > 1) 421 item += sSectionItemTpl2.arg(tr("Processors", "details report"), tr("<nobr>%1</nobr>", "details report")) 422 .arg(cCPU); 423 424 int iCPUExecCap = machine.GetCPUExecutionCap(); 425 if (iCPUExecCap < 100) 426 item += sSectionItemTpl2.arg(tr("Execution Cap", "details report"), tr("<nobr>%1%</nobr>", "details report")) 427 .arg(iCPUExecCap); 428 429 /* Boot order: */ 430 QStringList bootOrder; 431 for (ulong i = 1; i <= m_vbox.GetSystemProperties().GetMaxBootPosition(); ++i) 432 { 433 KDeviceType device = machine.GetBootOrder(i); 434 if (device == KDeviceType_Null) 435 continue; 436 bootOrder << vboxGlobal().toString(device); 437 } 438 if (bootOrder.isEmpty()) 439 bootOrder << vboxGlobal().toString(KDeviceType_Null); 440 441 item += sSectionItemTpl2.arg(tr("Boot Order", "details report"), bootOrder.join(", ")); 442 443 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 444 /* BIOS Settings holder: */ 445 const CBIOSSettings &biosSettings = machine.GetBIOSSettings(); 446 QStringList bios; 447 448 /* ACPI: */ 449 if (biosSettings.GetACPIEnabled()) 450 bios << tr("ACPI", "details report"); 451 452 /* IO APIC: */ 453 if (biosSettings.GetIOAPICEnabled()) 454 bios << tr("IO APIC", "details report"); 455 456 if (!bios.isEmpty()) 457 item += sSectionItemTpl2.arg(tr("BIOS", "details report"), bios.join(", ")); 458 #endif /* VBOX_WITH_FULL_DETAILS_REPORT */ 459 460 QStringList accel; 461 if (m_vbox.GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx)) 462 { 463 /* VT-x/AMD-V: */ 464 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)) 465 { 466 accel << tr("VT-x/AMD-V", "details report"); 467 468 /* Nested Paging (only when hw virt is enabled): */ 469 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)) 470 accel << tr("Nested Paging", "details report"); 471 } 472 } 473 474 /* PAE/NX: */ 475 if (machine.GetCPUProperty(KCPUPropertyType_PAE)) 476 accel << tr("PAE/NX", "details report"); 477 478 if (!accel.isEmpty()) 479 item += sSectionItemTpl2.arg(tr("Acceleration", "details report"), accel.join(", ")); 426 480 } 427 if (bootOrder.isEmpty()) 428 bootOrder << vboxGlobal().toString(KDeviceType_Null); 429 430 item += sSectionItemTpl2.arg(tr("Boot Order", "details report"), bootOrder.join(", ")); 431 432 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 433 /* BIOS Settings holder: */ 434 const CBIOSSettings &biosSettings = machine.GetBIOSSettings(); 435 QStringList bios; 436 437 /* ACPI: */ 438 if (biosSettings.GetACPIEnabled()) 439 bios << tr("ACPI", "details report"); 440 441 /* IO APIC: */ 442 if (biosSettings.GetIOAPICEnabled()) 443 bios << tr("IO APIC", "details report"); 444 445 if (!bios.isEmpty()) 446 item += sSectionItemTpl2.arg(tr("BIOS", "details report"), bios.join(", ")); 447 #endif /* VBOX_WITH_FULL_DETAILS_REPORT */ 448 449 QStringList accel; 450 if (m_vbox.GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx)) 481 else 451 482 { 452 /* VT-x/AMD-V: */ 453 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)) 454 { 455 accel << tr("VT-x/AMD-V", "details report"); 456 457 /* Nested Paging (only when hw virt is enabled): */ 458 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)) 459 accel << tr("Nested Paging", "details report"); 460 } 483 item = QString(sSectionItemTpl1).arg(tr("Information inaccessible", "details report")); 461 484 } 462 463 /* PAE/NX: */464 if (machine.GetCPUProperty(KCPUPropertyType_PAE))465 accel << tr("PAE/NX", "details report");466 467 if (!accel.isEmpty())468 item += sSectionItemTpl2.arg(tr("Acceleration", "details report"), accel.join(", "));469 470 485 pLabel->setText(sTableTpl.arg(item)); 471 486 } … … 1150 1165 pPopup->setProperty("block-number", iBlockNumber); 1151 1166 pPopup->setProperty("section-type", static_cast<int>(section)); 1167 if (!m_machines[iBlockNumber].GetAccessible()) 1168 pPopup->setWarningIcon(UIIconPool::iconSet(":/state_aborted_16px.png")); 1152 1169 1153 1170 /* Configure the popup box: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMPreviewWindow.cpp
r39225 r39261 7 7 8 8 /* 9 * Copyright (C) 2010 Oracle Corporation9 * Copyright (C) 2010-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 */ 19 19 20 /* Local includes */ 20 /* Global includes: */ 21 #include <QContextMenuEvent> 22 #include <QMenu> 23 #include <QPainter> 24 #include <QTimer> 25 26 /* Local includes: */ 21 27 #include "UIVMPreviewWindow.h" 22 28 #include "UIVirtualBoxEventHandler.h" … … 24 30 #include "VBoxGlobal.h" 25 31 26 /* Global includes */ 27 #include <QContextMenuEvent> 28 #include <QMenu> 29 #include <QPainter> 30 #include <QTimer> 31 32 /* Initialize map: */ 33 UpdateIntervalMap UpdateIntervalMapConstructor() 34 { 35 UpdateIntervalMap map; 36 map[UpdateInterval_Disabled] = "disabled"; 37 map[UpdateInterval_500ms] = "500"; 38 map[UpdateInterval_1000ms] = "1000"; 39 map[UpdateInterval_2000ms] = "2000"; 40 map[UpdateInterval_5000ms] = "5000"; 41 map[UpdateInterval_10000ms] = "10000"; 42 return map; 43 } 44 UpdateIntervalMap UIVMPreviewWindow::m_intervals = UpdateIntervalMapConstructor(); 45 46 /* Constructor: */ 32 47 UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent) 33 48 : QIWithRetranslateUI<QWidget>(pParent) … … 39 54 , m_pGlossyImg(0) 40 55 { 41 m_session.createInstance(CLSID_Session); 42 56 /* Setup contents: */ 43 57 setContentsMargins(0, 5, 0, 5); 44 58 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 45 /* Connect the update timer */ 46 connect(m_pUpdateTimer, SIGNAL(timeout()), 47 this, SLOT(sltRecreatePreview())); 48 /* Connect the machine state event */ 49 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), 50 this, SLOT(sltMachineStateChange(QString, KMachineState))); 51 /* Create the context menu */ 59 60 /* Create session instance: */ 61 m_session.createInstance(CLSID_Session); 62 63 /* Create the context menu: */ 52 64 setContextMenuPolicy(Qt::DefaultContextMenu); 53 65 m_pUpdateTimerMenu = new QMenu(this); 54 66 QActionGroup *pUpdateTimeG = new QActionGroup(this); 55 67 pUpdateTimeG->setExclusive(true); 56 for(int i = 0; i < Update End; ++i)68 for(int i = 0; i < UpdateInterval_Max; ++i) 57 69 { 58 70 QAction *pUpdateTime = new QAction(pUpdateTimeG); … … 63 75 m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime; 64 76 } 65 m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(Update 500ms)]);66 /* Default value */ 67 UpdateInterval interval = Update1000ms;77 m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(UpdateInterval_500ms)]); 78 79 /* Load preview update interval: */ 68 80 QString strInterval = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PreviewUpdate); 69 if (strInterval == "disabled") 70 interval = UpdateDisabled; 71 else if (strInterval == "500") 72 interval = Update500ms; 73 else if (strInterval == "1000") 74 interval = Update1000ms; 75 else if (strInterval == "2000") 76 interval = Update2000ms; 77 else if (strInterval == "5000") 78 interval = Update5000ms; 79 else if (strInterval == "10000") 80 interval = Update10000ms; 81 /* Initialize with the new update interval */ 81 /* Parse loaded value: */ 82 UpdateInterval interval = m_intervals.key(strInterval, UpdateInterval_1000ms); 83 /* Initialize with the new update interval: */ 82 84 setUpdateInterval(interval, false); 85 86 /* Setup connections: */ 87 connect(m_pUpdateTimer, SIGNAL(timeout()), this, SLOT(sltRecreatePreview())); 88 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), 89 this, SLOT(sltMachineStateChange(QString, KMachineState))); 83 90 84 91 /* Retranslate the UI */ … … 88 95 UIVMPreviewWindow::~UIVMPreviewWindow() 89 96 { 90 /* Close any open session */97 /* Close any open session: */ 91 98 if (m_session.GetState() == KSessionState_Locked) 92 99 m_session.UnlockMachine(); … … 101 108 void UIVMPreviewWindow::setMachine(const CMachine& machine) 102 109 { 103 m_pUpdateTimer->stop();110 stop(); 104 111 m_machine = machine; 105 112 restart(); … … 118 125 void UIVMPreviewWindow::retranslateUi() 119 126 { 120 m_actions.value(Update Disabled)->setText(tr("Update Disabled"));121 m_actions.value(Update 500ms)->setText(tr("Every 0.5 s"));122 m_actions.value(Update 1000ms)->setText(tr("Every 1 s"));123 m_actions.value(Update 2000ms)->setText(tr("Every 2 s"));124 m_actions.value(Update 5000ms)->setText(tr("Every 5 s"));125 m_actions.value(Update 10000ms)->setText(tr("Every 10 s"));127 m_actions.value(UpdateInterval_Disabled)->setText(tr("Update Disabled")); 128 m_actions.value(UpdateInterval_500ms)->setText(tr("Every 0.5 s")); 129 m_actions.value(UpdateInterval_1000ms)->setText(tr("Every 1 s")); 130 m_actions.value(UpdateInterval_2000ms)->setText(tr("Every 2 s")); 131 m_actions.value(UpdateInterval_5000ms)->setText(tr("Every 5 s")); 132 m_actions.value(UpdateInterval_10000ms)->setText(tr("Every 10 s")); 126 133 } 127 134 … … 135 142 void UIVMPreviewWindow::showEvent(QShowEvent *pEvent) 136 143 { 137 /* Make sure there is some valid preview image when shown .*/144 /* Make sure there is some valid preview image when shown: */ 138 145 restart(); 139 146 QWidget::showEvent(pEvent); … … 142 149 void UIVMPreviewWindow::hideEvent(QHideEvent *pEvent) 143 150 { 144 /* Stop the update time when we aren't visible */145 m_pUpdateTimer->stop();151 /* Stop the update time when we aren't visible: */ 152 stop(); 146 153 QWidget::hideEvent(pEvent); 147 154 } … … 171 178 /* Fill rectangle with black color: */ 172 179 painter.fillRect(m_vRect, Qt::black); 173 } 174 175 /* Compose name: */ 176 QString strName = tr("No Preview"); 177 if (!m_machine.isNull()) 178 strName = m_machine.GetName(); 179 /* Paint that name: */ 180 QFont font = painter.font(); 181 font.setBold(true); 182 int fFlags = Qt::AlignCenter | Qt::TextWordWrap; 183 float h = m_vRect.size().height() * .2; 184 QRect r; 185 /* Make a little magic to find out if the given text fits into our rectangle. 186 * Decrease the font pixel size as long as it doesn't fit. */ 187 int cMax = 30; 188 do 189 { 190 h = h * .8; 191 font.setPixelSize((int)h); 192 painter.setFont(font); 193 r = painter.boundingRect(m_vRect, fFlags, strName); 194 } 195 while ((r.height() > m_vRect.height() || r.width() > m_vRect.width()) && cMax-- != 0); 196 painter.setPen(Qt::white); 197 painter.drawText(m_vRect, fFlags, strName); 180 181 /* Compose name: */ 182 QString strName = tr("No Preview"); 183 if (!m_machine.isNull()) 184 strName = m_machine.GetAccessible() ? m_machine.GetName() : 185 QApplication::translate("UIVMListView", "Inaccessible"); 186 /* Paint that name: */ 187 QFont font = painter.font(); 188 font.setBold(true); 189 int fFlags = Qt::AlignCenter | Qt::TextWordWrap; 190 float h = m_vRect.size().height() * .2; 191 QRect r; 192 /* Make a little magic to find out if the given text fits into our rectangle. 193 * Decrease the font pixel size as long as it doesn't fit. */ 194 int cMax = 30; 195 do 196 { 197 h = h * .8; 198 font.setPixelSize((int)h); 199 painter.setFont(font); 200 r = painter.boundingRect(m_vRect, fFlags, strName); 201 } 202 while ((r.height() > m_vRect.height() || r.width() > m_vRect.width()) && cMax-- != 0); 203 painter.setPen(Qt::white); 204 painter.drawText(m_vRect, fFlags, strName); 205 } 198 206 199 207 /* Draw the glossy overlay last: */ … … 215 223 void UIVMPreviewWindow::sltMachineStateChange(QString strId, KMachineState state) 216 224 { 217 if ( !m_machine.isNull() 218 && m_machine.GetId() == strId) 219 { 220 /* Cache the machine state */ 225 if (!m_machine.isNull() && m_machine.GetId() == strId) 226 { 227 /* Cache the machine state: */ 221 228 m_machineState = state; 222 229 restart(); … … 226 233 void UIVMPreviewWindow::sltRecreatePreview() 227 234 { 228 /* Only do this if we are visible */235 /* Only do this if we are visible: */ 229 236 if (!isVisible()) 230 237 return; 231 238 239 /* Remove preview if any: */ 232 240 if (m_pPreviewImg) 233 241 { … … 236 244 } 237 245 238 if ( !m_machine.isNull() 239 && m_vRect.width() > 0 240 && m_vRect.height() > 0) 241 { 242 Assert(m_machineState != KMachineState_Null); 246 /* We are not creating preview for inaccessible VMs: */ 247 if (m_machineState == KMachineState_Null) 248 return; 249 250 if (!m_machine.isNull() && m_vRect.width() > 0 && m_vRect.height() > 0) 251 { 243 252 QImage image(size(), QImage::Format_ARGB32); 244 253 image.fill(Qt::transparent); … … 322 331 switch (interval) 323 332 { 324 case UpdateDisabled: 325 { 326 if (fSave) 327 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, "disabled"); 333 case UpdateInterval_Disabled: 334 { 328 335 m_pUpdateTimer->setInterval(0); 329 336 m_pUpdateTimer->stop(); … … 331 338 break; 332 339 } 333 case Update500ms: 334 { 335 if (fSave) 336 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, "500"); 340 case UpdateInterval_500ms: 341 { 337 342 m_pUpdateTimer->setInterval(500); 338 343 m_actions[interval]->setChecked(true); 339 344 break; 340 345 } 341 case Update1000ms: 342 { 343 if (fSave) 344 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, "1000"); 346 case UpdateInterval_1000ms: 347 { 345 348 m_pUpdateTimer->setInterval(1000); 346 349 m_actions[interval]->setChecked(true); 347 350 break; 348 351 } 349 case Update2000ms: 350 { 351 if (fSave) 352 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, "2000"); 352 case UpdateInterval_2000ms: 353 { 353 354 m_pUpdateTimer->setInterval(2000); 354 355 m_actions[interval]->setChecked(true); 355 356 break; 356 357 } 357 case Update5000ms: 358 { 359 if (fSave) 360 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, "5000"); 358 case UpdateInterval_5000ms: 359 { 361 360 m_pUpdateTimer->setInterval(5000); 362 361 m_actions[interval]->setChecked(true); 363 362 break; 364 363 } 365 case Update10000ms: 366 { 367 if (fSave) 368 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, "10000"); 364 case UpdateInterval_10000ms: 365 { 369 366 m_pUpdateTimer->setInterval(10000); 370 367 m_actions[interval]->setChecked(true); 371 368 break; 372 369 } 373 case UpdateEnd: break; 374 } 370 case UpdateInterval_Max: break; 371 } 372 if (fSave && m_intervals.contains(interval)) 373 vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_PreviewUpdate, m_intervals[interval]); 375 374 } 376 375 377 376 void UIVMPreviewWindow::restart() 378 377 { 379 /* Close any open session*/378 /* Reopen session if necessary: */ 380 379 if (m_session.GetState() == KSessionState_Locked) 381 380 m_session.UnlockMachine(); 382 381 if (!m_machine.isNull()) 383 382 { 384 /* Fetch the latest machine state */383 /* Fetch the latest machine state: */ 385 384 m_machineState = m_machine.GetState(); 386 /* Lock the session for the current machine */387 if ( 388 // 385 /* Lock the session for the current machine: */ 386 if (m_machineState == KMachineState_Running 387 // || m_machineState == KMachineState_Saving /* Not sure if this is valid */ 389 388 || m_machineState == KMachineState_Paused) 390 389 m_machine.LockMachine(m_session, KLockType_Shared); 391 390 } 392 391 393 /* Recreate the preview image */392 /* Recreate the preview image: */ 394 393 sltRecreatePreview(); 395 /* Start the timer */ 394 395 /* Start the timer if necessary: */ 396 396 if (!m_machine.isNull()) 397 397 { 398 if ( m_pUpdateTimer->interval() > 0 399 && m_machineState == KMachineState_Running) 398 if (m_pUpdateTimer->interval() > 0 && m_machineState == KMachineState_Running) 400 399 m_pUpdateTimer->start(); 401 400 } 402 401 } 403 402 403 void UIVMPreviewWindow::stop() 404 { 405 /* Stop the timer: */ 406 m_pUpdateTimer->stop(); 407 } 408 404 409 void UIVMPreviewWindow::repaintBGImages() 405 410 { 406 /* Delete the old images */411 /* Delete the old images: */ 407 412 if (m_pbgImage) 408 413 { … … 416 421 } 417 422 418 /* Check that there is enough room for our fancy stuff. If not we just419 * draw nothing (the border and the blur radius). */423 /* Check that there is enough room for our fancy stuff. 424 * If not we just draw nothing (the border and the blur radius). */ 420 425 QRect cr = contentsRect(); 421 if ( cr.width() < 41 422 || cr.height() < 41) 426 if (cr.width() < 41 || cr.height() < 41) 423 427 return; 424 428 … … 427 431 m_vRect = m_wRect.adjusted(m_vMargin, m_vMargin, -m_vMargin, -m_vMargin).adjusted(-3, -3, 3, 3); 428 432 429 /* First draw the shadow. Its a rounded rectangle which get blurred .*/433 /* First draw the shadow. Its a rounded rectangle which get blurred: */ 430 434 QImage imageW(cr.size(), QImage::Format_ARGB32); 431 435 QColor bg = pal.color(QPalette::Base); … … 442 446 QPainter pO(&imageO); 443 447 444 #if 1 445 /* Now paint the border with a gradient to get a look of a monitor. */ 448 /* Now paint the border with a gradient to get a look of a monitor: */ 446 449 QRect rr = QRect(QPoint(0, 0), cr.size()).adjusted(10, 10, -10, -10); 447 450 QLinearGradient lg(0, rr.y(), 0, rr.height()); 448 451 QColor base(200, 200, 200); /* light variant */ 449 // 452 // QColor base(80, 80, 80); /* Dark variant */ 450 453 lg.setColorAt(0, base); 451 454 lg.setColorAt(0.4, base.darker(300)); … … 457 460 pO.drawRoundedRect(rr, m_vMargin, m_vMargin); 458 461 pO.end(); 459 #endif 460 /* Make a copy of the new bg image */462 463 /* Make a copy of the new bg image: */ 461 464 m_pbgImage = new QImage(imageO); 462 465 463 /* Now the glossy overlay has to be created. Start with defining a nice464 * looking painter path. */466 /* Now the glossy overlay has to be created. 467 * Start with defining a nice looking painter path. */ 465 468 QRect gRect = QRect(QPoint(0, 0), m_vRect.size()); 466 469 QPainterPath glossyPath(QPointF(gRect.x(), gRect.y())); … … 472 475 glossyPath.closeSubpath(); 473 476 474 /* Paint the glossy path on a QImage */477 /* Paint the glossy path on a QImage: */ 475 478 QImage image(m_vRect.size(), QImage::Format_ARGB32); 476 479 QColor bg1(Qt::white); /* We want blur to transparent _and_ white. */ … … 485 488 m_pGlossyImg = new QImage(image1); 486 489 487 /* Repaint */490 /* Repaint: */ 488 491 update(); 489 492 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMPreviewWindow.h
r31056 r39261 6 6 7 7 /* 8 * Copyright (C) 2010 Oracle Corporation8 * Copyright (C) 2010-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #include "COMDefs.h" 25 25 26 /* Global includes */26 /* Global includes: */ 27 27 #include <QWidget> 28 28 #include <QHash> 29 29 30 /* Global forward declarations*/30 /* Forward declarations: */ 31 31 class QAction; 32 32 class QImage; … … 34 34 class QTimer; 35 35 36 /* Update interval type: */ 37 enum UpdateInterval 38 { 39 UpdateInterval_Disabled, 40 UpdateInterval_500ms, 41 UpdateInterval_1000ms, 42 UpdateInterval_2000ms, 43 UpdateInterval_5000ms, 44 UpdateInterval_10000ms, 45 UpdateInterval_Max 46 }; 47 typedef QMap<UpdateInterval, QString> UpdateIntervalMap; 48 49 /* Preview window class: */ 36 50 class UIVMPreviewWindow : public QIWithRetranslateUI<QWidget> 37 51 { 38 52 Q_OBJECT; 39 40 enum UpdateInterval41 {42 UpdateDisabled,43 Update500ms,44 Update1000ms,45 Update2000ms,46 Update5000ms,47 Update10000ms,48 UpdateEnd49 };50 53 51 54 public: … … 77 80 78 81 void setUpdateInterval(UpdateInterval interval, bool fSave); 79 void restart();80 82 void repaintBGImages(); 81 83 82 /* Private member vars */ 84 void restart(); 85 void stop(); 86 87 /* Variables: */ 83 88 CSession m_session; 84 89 CMachine m_machine; … … 93 98 QImage *m_pPreviewImg; 94 99 QImage *m_pGlossyImg; 100 101 static UpdateIntervalMap m_intervals; 95 102 }; 96 103 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp
r39225 r39261 7 7 8 8 /* 9 * Copyright (C) 2010 Oracle Corporation9 * Copyright (C) 2010-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 40 40 , m_fHeaderHover(false) 41 41 { 42 /* Placing content: */ 42 43 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 43 44 pMainLayout->setContentsMargins(10, 5, 5, 5); 44 45 QHBoxLayout *pTitleLayout = new QHBoxLayout(); 45 46 m_pTitleIcon = new QLabel(this); 47 m_pWarningIcon = new QLabel(this); 46 48 m_pTitleLabel = new QLabel(this); 47 connect(m_pTitleLabel, SIGNAL(linkActivated(const QString)),48 this, SIGNAL(titleClicked(const QString)));49 49 pTitleLayout->addWidget(m_pTitleIcon); 50 pTitleLayout->addWidget(m_pWarningIcon); 50 51 pTitleLayout->addWidget(m_pTitleLabel, Qt::AlignLeft); 51 52 pMainLayout->addLayout(pTitleLayout); 52 53 54 /* Configure widgets: */ 55 m_pWarningIcon->setHidden(true); 53 56 m_arrowPath.lineTo(m_aw / 2.0, m_aw / 2.0); 54 57 m_arrowPath.lineTo(m_aw, 0); 55 58 56 // setMouseTracking(true); 59 /* Setup connections: */ 60 connect(m_pTitleLabel, SIGNAL(linkActivated(const QString)), this, SIGNAL(titleClicked(const QString))); 61 62 /* Install event-filter: */ 57 63 qApp->installEventFilter(this); 58 64 } … … 78 84 void UIPopupBox::setTitleIcon(const QIcon& icon) 79 85 { 80 m_ icon = icon;86 m_titleIcon = icon; 81 87 updateHover(true); 82 88 recalc(); … … 85 91 QIcon UIPopupBox::titleIcon() const 86 92 { 87 return m_icon; 93 return m_titleIcon; 94 } 95 96 void UIPopupBox::setWarningIcon(const QIcon& icon) 97 { 98 m_warningIcon = icon; 99 m_pWarningIcon->setHidden(m_warningIcon.isNull()); 100 updateHover(true); 101 recalc(); 102 } 103 104 QIcon UIPopupBox::warningIcon() const 105 { 106 return m_warningIcon; 88 107 } 89 108 … … 277 296 .arg(m_strTitle)); 278 297 279 QPixmap i = m_icon.pixmap(16, 16); 298 QPixmap titleIcon = m_titleIcon.pixmap(16, 16); 299 QPixmap warningIcon = m_warningIcon.pixmap(16, 16); 280 300 #ifdef Q_WS_MAC 281 /* todo: fix this*/301 /* TODO: Fix this! */ 282 302 // if (!m_fHeaderHover) 283 // i = QPixmap::fromImage(toGray(i.toImage())); 303 // titleIcon = QPixmap::fromImage(toGray(titleIcon.toImage())); 304 // if (!m_fHeaderHover) 305 // warningIcon = QPixmap::fromImage(toGray(warningIcon.toImage())); 284 306 #endif /* Q_WS_MAC */ 285 m_pTitleIcon->setPixmap(i); 307 m_pTitleIcon->setPixmap(titleIcon); 308 m_pWarningIcon->setPixmap(warningIcon); 286 309 update(); 287 310 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h
r39225 r39261 6 6 7 7 /* 8 * Copyright (C) 2010 Oracle Corporation8 * Copyright (C) 2010-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 41 41 void setTitleIcon(const QIcon& icon); 42 42 QIcon titleIcon() const; 43 44 void setWarningIcon(const QIcon& icon); 45 QIcon warningIcon() const; 43 46 44 47 void setTitleLink(const QString& strLink); … … 84 87 QString m_strTitle; 85 88 QLabel *m_pTitleIcon; 86 QIcon m_icon; 89 QLabel *m_pWarningIcon; 90 QIcon m_titleIcon; 91 QIcon m_warningIcon; 87 92 QString m_strLink; 88 93 bool m_fLinkEnabled;
Note:
See TracChangeset
for help on using the changeset viewer.