Changeset 98488 in vbox
- Timestamp:
- Feb 7, 2023 11:33:52 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155754
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r98487 r98488 47 47 #include "CChoiceFormValue.h" 48 48 #include "CCloudMachine.h" 49 #include "CConsole.h" 49 50 #include "CForm.h" 50 51 #include "CFormValue.h" 51 52 #include "CGraphicsAdapter.h" 53 #include "CGuest.h" 52 54 #include "CMachine.h" 53 55 #include "CMediumAttachment.h" … … 66 68 #include "CUefiVariableStore.h" 67 69 #include "CUSBController.h" 70 #include "CUSBDevice.h" 68 71 #include "CUSBDeviceFilter.h" 69 72 #include "CUSBDeviceFilters.h" … … 1339 1342 } 1340 1343 1344 void UIDetailsGenerator::acquireUsbStatusInfo(CMachine &comMachine, CConsole &comConsole, 1345 QString &strInfo, bool &fUsbEnabled) 1346 { 1347 /* Check whether there is at least one USB controller with an available proxy: */ 1348 fUsbEnabled = !comMachine.GetUSBDeviceFilters().isNull() 1349 && !comMachine.GetUSBControllers().isEmpty() 1350 && comMachine.GetUSBProxyAvailable(); 1351 if (fUsbEnabled) 1352 { 1353 /* Enumerate all the USB devices: */ 1354 foreach (const CUSBDevice &comUsbDevice, comConsole.GetUSBDevices()) 1355 strInfo += e_strTableRow1.arg(uiCommon().usbDetails(comUsbDevice)); 1356 /* Handle 'no-usb-devices' case: */ 1357 if (strInfo.isNull()) 1358 strInfo = e_strTableRow1 1359 .arg(QApplication::translate("UIIndicatorsPool", "No USB devices attached", "USB tooltip")); 1360 } 1361 } 1362 1363 void UIDetailsGenerator::acquireSharedFoldersStatusInfo(CMachine &comMachine, CConsole &comConsole, CGuest &comGuest, 1364 QString &strInfo, bool &fFoldersPresent) 1365 { 1366 /* Enumerate all the folders: */ 1367 QMap<QString, QString> folders; 1368 foreach (const CSharedFolder &comPermanentFolder, comMachine.GetSharedFolders()) 1369 folders.insert(comPermanentFolder.GetName(), comPermanentFolder.GetHostPath()); 1370 foreach (const CSharedFolder &comTemporaryFolder, comConsole.GetSharedFolders()) 1371 folders.insert(comTemporaryFolder.GetName(), comTemporaryFolder.GetHostPath()); 1372 fFoldersPresent = !folders.isEmpty(); 1373 1374 /* Append attachment data: */ 1375 for (QMap<QString, QString>::const_iterator it = folders.constBegin(); it != folders.constEnd(); ++it) 1376 { 1377 /* Select slashes depending on the OS type: */ 1378 if (UICommon::isDOSType(comGuest.GetOSTypeId())) 1379 strInfo += e_strTableRow2.arg(QString("<b>\\\\vboxsvr\\%1</b>").arg(it.key()), it.value()); 1380 else 1381 strInfo += e_strTableRow2.arg(QString("<b>%1</b>").arg(it.key()), it.value()); 1382 } 1383 1384 /* Handle 'no-folders' case: */ 1385 if (!fFoldersPresent) 1386 strInfo = e_strTableRow1 1387 .arg(QApplication::translate("UIIndicatorsPool", "No shared folders", "Shared folders tooltip")); 1388 } 1389 1341 1390 void UIDetailsGenerator::acquireDisplayStatusInfo(CMachine &comMachine, QString &strInfo, 1342 1391 bool &fAcceleration3D) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h
r98487 r98488 38 38 /* Forward declarations: */ 39 39 class CCloudMachine; 40 class CConsole; 40 41 class CFormValue; 42 class CGuest; 41 43 class CMachine; 42 44 … … 97 99 bool &fAdaptersPresent, bool &fCablesDisconnected); 98 100 101 SHARED_LIBRARY_STUFF void acquireUsbStatusInfo(CMachine &comMachine, CConsole &comConsole, 102 QString &strInfo, bool &fUsbEnableds); 103 104 SHARED_LIBRARY_STUFF void acquireSharedFoldersStatusInfo(CMachine &comMachine, CConsole &comConsole, CGuest &comGuest, 105 QString &strInfo, bool &fFoldersPresent); 106 99 107 SHARED_LIBRARY_STUFF void acquireDisplayStatusInfo(CMachine &comMachine, QString &strInfo, 100 108 bool &fAcceleration3D); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r98487 r98488 30 30 #include <QHBoxLayout> 31 31 #include <QPainter> 32 #include <QStyle>33 32 #include <QTimer> 34 33 … … 49 48 #include "CRecordingSettings.h" 50 49 #include "CRecordingScreenSettings.h" 51 #include "CConsole.h"52 50 #include "CMachine.h" 53 51 #include "CMachineDebugger.h" 54 #include "CGuest.h"55 #include "CUSBController.h"56 #include "CUSBDeviceFilters.h"57 #include "CUSBDevice.h"58 #include "CSharedFolder.h"59 52 60 53 … … 452 445 public: 453 446 454 /** Construct or, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */447 /** Constructs indicator passing @a pMachine to the base-class. */ 455 448 UIIndicatorUSB(UIMachine *pMachine, UISession *pSession) 456 449 : UISessionStateStatusBarIndicator(IndicatorType_USB, pMachine, pSession) … … 470 463 void updateAppearance() 471 464 { 472 /* Get machine: */473 const CMachine machine = m_pSession->machine();474 475 /* Prepare tool-tip: */476 465 QString strFullData; 477 478 /* Check whether there is at least one USB controller with an available proxy. */ 479 bool fUSBEnabled = !machine.GetUSBDeviceFilters().isNull() 480 && !machine.GetUSBControllers().isEmpty() 481 && machine.GetUSBProxyAvailable(); 482 if (fUSBEnabled) 483 { 484 /* Enumerate all the USB devices: */ 485 const CConsole console = m_pSession->console(); 486 foreach (const CUSBDevice &usbDevice, console.GetUSBDevices()) 487 strFullData += s_strTableRow1.arg(uiCommon().usbDetails(usbDevice)); 488 /* Handle 'no-usb-devices' case: */ 489 if (strFullData.isNull()) 490 strFullData = s_strTableRow1 491 .arg(QApplication::translate("UIIndicatorsPool", "No USB devices attached", "USB tooltip")); 492 } 493 494 /* Hide indicator if there are USB controllers: */ 495 if (!fUSBEnabled) 496 hide(); 466 bool fUsbEnabled = false; 467 m_pMachine->acquireUsbStatusInfo(strFullData, fUsbEnabled); 468 469 /* Hide indicator if no USB enabled: */ 470 setVisible(fUsbEnabled); 497 471 498 472 /* Update tool-tip: */ 499 473 setToolTip(s_strTable.arg(strFullData)); 500 474 /* Update indicator state: */ 501 setState(fU SBEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);475 setState(fUsbEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null); 502 476 } 503 477 }; … … 511 485 public: 512 486 513 /** Construct or, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */487 /** Constructs indicator passing @a pMachine to the base-class. */ 514 488 UIIndicatorSharedFolders(UIMachine *pMachine, UISession *pSession) 515 489 : UISessionStateStatusBarIndicator(IndicatorType_SharedFolders, pMachine, pSession) … … 529 503 void updateAppearance() 530 504 { 531 /* Get objects: */532 const CMachine machine = m_pSession->machine();533 const CConsole console = m_pSession->console();534 const CGuest guest = m_pSession->guest();535 536 /* Prepare tool-tip: */537 505 QString strFullData; 538 539 /* Enumerate all the folders: */ 540 QMap<QString, QString> sfs; 541 foreach (const CSharedFolder &sf, machine.GetSharedFolders()) 542 sfs.insert(sf.GetName(), sf.GetHostPath()); 543 foreach (const CSharedFolder &sf, console.GetSharedFolders()) 544 sfs.insert(sf.GetName(), sf.GetHostPath()); 545 546 /* Append attachment data: */ 547 for (QMap<QString, QString>::const_iterator it = sfs.constBegin(); it != sfs.constEnd(); ++it) 548 { 549 /* Select slashes depending on the OS type: */ 550 if (UICommon::isDOSType(guest.GetOSTypeId())) 551 strFullData += s_strTableRow2.arg(QString("<b>\\\\vboxsvr\\%1</b>").arg(it.key()), it.value()); 552 else 553 strFullData += s_strTableRow2.arg(QString("<b>%1</b>").arg(it.key()), it.value()); 554 } 555 /* Handle 'no-folders' case: */ 556 if (sfs.isEmpty()) 557 strFullData = s_strTableRow1 558 .arg(QApplication::translate("UIIndicatorsPool", "No shared folders", "Shared folders tooltip")); 506 bool fFoldersPresent = false; 507 m_pMachine->acquireSharedFoldersStatusInfo(strFullData, fFoldersPresent); 559 508 560 509 /* Update tool-tip: */ 561 510 setToolTip(s_strTable.arg(strFullData)); 562 511 /* Update indicator state: */ 563 setState( !sfs.isEmpty()? KDeviceActivity_Idle : KDeviceActivity_Null);512 setState(fFoldersPresent ? KDeviceActivity_Idle : KDeviceActivity_Null); 564 513 } 565 514 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98487 r98488 471 471 { 472 472 uisession()->acquireNetworkStatusInfo(strInfo, fAdaptersPresent, fCablesDisconnected); 473 } 474 475 void UIMachine::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds) 476 { 477 uisession()->acquireUsbStatusInfo(strInfo, fUsbEnableds); 478 } 479 480 void UIMachine::acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent) 481 { 482 uisession()->acquireSharedFoldersStatusInfo(strInfo, fFoldersPresent); 473 483 } 474 484 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98487 r98488 389 389 /** Acquires status info for network indicator. */ 390 390 void acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected); 391 /** Acquires status info for USB indicator. */ 392 void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds); 393 /** Acquires status info for Shared Folders indicator. */ 394 void acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent); 391 395 /** Acquires status info for Display indicator. */ 392 396 void acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98487 r98488 344 344 CMachine comMachine = machine(); 345 345 UIDetailsGenerator::acquireNetworkStatusInfo(comMachine, strInfo, fAdaptersPresent, fCablesDisconnected); 346 } 347 348 void UISession::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds) 349 { 350 CMachine comMachine = machine(); 351 CConsole comConsole = console(); 352 UIDetailsGenerator::acquireUsbStatusInfo(comMachine, comConsole, strInfo, fUsbEnableds); 353 } 354 355 void UISession::acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent) 356 { 357 CMachine comMachine = machine(); 358 CConsole comConsole = console(); 359 CGuest comGuest = guest(); 360 UIDetailsGenerator::acquireSharedFoldersStatusInfo(comMachine, comConsole, comGuest, strInfo, fFoldersPresent); 346 361 } 347 362 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98487 r98488 275 275 /** Acquires status info for network indicator. */ 276 276 void acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected); 277 /** Acquires status info for USB indicator. */ 278 void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds); 279 /** Acquires status info for Shared Folders indicator. */ 280 void acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent); 277 281 /** Acquires status info for Display indicator. */ 278 282 void acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D);
Note:
See TracChangeset
for help on using the changeset viewer.