- Timestamp:
- Jun 14, 2023 8:13:43 AM (18 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp
r98103 r100174 51 51 #include "CPerformanceCollector.h" 52 52 #include "CPerformanceMetric.h" 53 #include <iprt/string.h> 53 54 54 55 /* External includes: */ … … 1237 1238 void UIVMActivityMonitor::sltGuestAdditionsStateChange() 1238 1239 { 1239 bool fGuestAdditionsAvailable = guestAdditionsAvailable( 6 /* minimum major version */);1240 bool fGuestAdditionsAvailable = guestAdditionsAvailable("6.1"); 1240 1241 if (m_fGuestAdditionsAvailable == fGuestAdditionsAvailable) 1241 1242 return; … … 1311 1312 } 1312 1313 1313 bool UIVMActivityMonitor::guestAdditionsAvailable( int iMinimumMajorVersion)1314 { 1315 if (m_comGuest.isNull() )1314 bool UIVMActivityMonitor::guestAdditionsAvailable(const char *pszMinimumVersion) 1315 { 1316 if (m_comGuest.isNull() || !pszMinimumVersion) 1316 1317 return false; 1317 1318 bool fGuestAdditionsStatus = m_comGuest.GetAdditionsStatus(m_comGuest.GetAdditionsRunLevel()); 1318 if (fGuestAdditionsStatus) 1319 { 1320 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) 1321 QStringList versionStrings = m_comGuest.GetAdditionsVersion().split('.', Qt::SkipEmptyParts); 1322 #else 1323 QStringList versionStrings = m_comGuest.GetAdditionsVersion().split('.', QString::SkipEmptyParts); 1324 #endif 1325 if (!versionStrings.isEmpty()) 1326 { 1327 bool fConvert = false; 1328 int iMajorVersion = versionStrings[0].toInt(&fConvert); 1329 if (fConvert && iMajorVersion >= iMinimumMajorVersion) 1330 return true; 1331 } 1319 if (fGuestAdditionsStatus && m_comGuest.isOk()) 1320 { 1321 QString strGAVersion = m_comGuest.GetAdditionsVersion(); 1322 if (m_comGuest.isOk()) 1323 return (RTStrVersionCompare(strGAVersion.toUtf8().constData(), pszMinimumVersion) >= 0); 1332 1324 } 1333 1325 return false; … … 1591 1583 return; 1592 1584 1593 m_fGuestAdditionsAvailable = guestAdditionsAvailable( 6 /* minimum major version */);1585 m_fGuestAdditionsAvailable = guestAdditionsAvailable("6.1"); 1594 1586 enableDisableGuestAdditionDependedWidgets(m_fGuestAdditionsAvailable); 1595 1587 if (m_pTimer) -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h
r98103 r100174 169 169 void prepareMetrics(); 170 170 void prepareActions(); 171 bool guestAdditionsAvailable( int iMinimumMajorVersion);171 bool guestAdditionsAvailable(const char *pszMinimumVersion); 172 172 void enableDisableGuestAdditionDependedWidgets(bool fEnable); 173 173 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r100082 r100174 424 424 , m_pGuestSessionWidget(0) 425 425 , m_fIsCurrent(false) 426 , pszMinimumGuestAdditionVersion("6.1") 426 427 { 427 428 if (!m_comMachine.isNull()) … … 484 485 break; 485 486 case State_NoGuestAdditions: 486 strWarningText = UIFileManager::tr("File manager cannot work since the selected guest does not have the guest additions."); 487 strWarningText = UIFileManager::tr("File manager cannot work since no guest additions were detected."); 488 icon = UIIconPool::iconSet(":/status_error_16px.png"); 489 break; 490 case State_GuestAdditionsTooOld: 491 strWarningText = UIFileManager::tr("File manager cannot work. The guest additions need to be updated."); 487 492 icon = UIIconPool::iconSet(":/status_error_16px.png"); 488 493 break; … … 1293 1298 } 1294 1299 1295 bool UIFileManagerGuestTable::isGuestAdditionsAvailable() 1296 { 1297 if (m_comGuest.isNull()) 1298 return false; 1299 return m_comGuest.GetAdditionsStatus(m_comGuest.GetAdditionsRunLevel()); 1300 int UIFileManagerGuestTable::isGuestAdditionsAvailable(const char* pszMinimumVersion) 1301 { 1302 if (m_comGuest.isNull() || !pszMinimumVersion) 1303 return 0; 1304 bool fGuestAdditionsStatus = m_comGuest.GetAdditionsStatus(m_comGuest.GetAdditionsRunLevel()); 1305 if (fGuestAdditionsStatus && m_comGuest.isOk()) 1306 { 1307 QString strGAVersion = m_comGuest.GetAdditionsVersion(); 1308 if (m_comGuest.isOk()) 1309 { 1310 int iCode = RTStrVersionCompare(strGAVersion.toUtf8().constData(), pszMinimumVersion); 1311 if (iCode >= 0) 1312 return 1; 1313 else 1314 return -1; 1315 } 1316 } 1317 return 0; 1300 1318 } 1301 1319 … … 1396 1414 setStateAndEnableWidgets(); 1397 1415 1398 if (m_comGuestSession.isOk()) 1399 { 1400 emit sigLogOutput(QString("%1: %2").arg("Guest session status has changed").arg(gpConverter->toString(m_comGuestSession.GetStatus())), 1401 m_strTableName, FileManagerLogType_Info); 1402 1403 switch (m_comGuestSession.GetStatus()) 1404 { 1405 case KGuestSessionStatus_Started: 1416 if (m_comGuestSession.isNull()) 1417 emit sigLogOutput("Guest session is invalid!", m_strTableName, FileManagerLogType_Error); 1418 else 1419 { 1420 if (m_comGuestSession.isOk()) 1421 { 1422 emit sigLogOutput(QString("%1: %2").arg("Guest session status has changed").arg(gpConverter->toString(m_comGuestSession.GetStatus())), 1423 m_strTableName, FileManagerLogType_Info); 1424 1425 switch (m_comGuestSession.GetStatus()) 1406 1426 { 1407 initFileTable(); 1408 break; 1427 case KGuestSessionStatus_Started: 1428 { 1429 initFileTable(); 1430 break; 1431 } 1432 case KGuestSessionStatus_Terminating: 1433 case KGuestSessionStatus_Terminated: 1434 case KGuestSessionStatus_TimedOutKilled: 1435 case KGuestSessionStatus_TimedOutAbnormally: 1436 case KGuestSessionStatus_Down: 1437 case KGuestSessionStatus_Error: 1438 { 1439 cleanupGuestSessionListener(); 1440 closeGuestSession(); 1441 break; 1442 } 1443 case KGuestSessionStatus_Undefined: 1444 case KGuestSessionStatus_Starting: 1445 case KGuestSessionStatus_Max: 1446 default: 1447 break; 1409 1448 } 1410 case KGuestSessionStatus_Terminating: 1411 case KGuestSessionStatus_Terminated: 1412 case KGuestSessionStatus_TimedOutKilled: 1413 case KGuestSessionStatus_TimedOutAbnormally: 1414 case KGuestSessionStatus_Down: 1415 case KGuestSessionStatus_Error: 1416 { 1417 cleanupGuestSessionListener(); 1418 closeGuestSession(); 1419 break; 1420 } 1421 case KGuestSessionStatus_Undefined: 1422 case KGuestSessionStatus_Starting: 1423 case KGuestSessionStatus_Max: 1424 default: 1425 break; 1426 } 1427 } 1428 else 1429 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession), m_strTableName, FileManagerLogType_Error); 1449 } 1450 else 1451 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession), m_strTableName, FileManagerLogType_Error); 1452 } 1430 1453 } 1431 1454 … … 1459 1482 return; 1460 1483 } 1461 if (!isGuestAdditionsAvailable()) 1484 1485 int iGADetectCode = isGuestAdditionsAvailable(pszMinimumGuestAdditionVersion); 1486 if (iGADetectCode == 0) 1462 1487 { 1463 1488 m_enmState = State_NoGuestAdditions; 1464 1489 return; 1465 1490 } 1491 else if (iGADetectCode == -1) 1492 { 1493 m_enmState = State_GuestAdditionsTooOld; 1494 return; 1495 } 1496 1466 1497 if (!m_comGuestSession.isNull() && m_comGuestSession.GetStatus() == KGuestSessionStatus_Started) 1467 1498 { … … 1538 1569 } 1539 1570 1540 if (!isGuestAdditionsAvailable()) 1541 { 1542 emit sigLogOutput("Could not find Guest Additions", m_strTableName, FileManagerLogType_Error); 1571 int iGADetectCode = isGuestAdditionsAvailable(pszMinimumGuestAdditionVersion); 1572 if (iGADetectCode == 0) 1573 { 1574 emit sigLogOutput("Could not find Guest Additions", 1575 m_strTableName, FileManagerLogType_Error); 1576 if (m_pGuestSessionWidget) 1577 m_pGuestSessionWidget->markForError(true); 1578 return false; 1579 } 1580 else if (iGADetectCode == -1) 1581 { 1582 emit sigLogOutput(QString("%1 %2").arg("The Guest Additions are older than ").arg(pszMinimumGuestAdditionVersion), 1583 m_strTableName, FileManagerLogType_Error); 1543 1584 if (m_pGuestSessionWidget) 1544 1585 m_pGuestSessionWidget->markForError(true); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r98103 r100174 121 121 State_MachineNotRunning, 122 122 State_NoGuestAdditions, 123 State_GuestAdditionsTooOld, 123 124 State_SessionPossible, 124 125 State_SessionRunning, … … 151 152 bool openMachineSession(); 152 153 bool closeMachineSession(); 153 bool isGuestAdditionsAvailable(); 154 /* Return 0 if GA is not detected, -1 if it is there but older than @p pszMinimumGuestAdditionVersion, and 1 otherwise. */ 155 int isGuestAdditionsAvailable(const char* pszMinimumVersion); 154 156 void setStateAndEnableWidgets(); 155 157 … … 173 175 bool m_fIsCurrent; 174 176 State m_enmState; 177 const char *pszMinimumGuestAdditionVersion; 175 178 }; 176 179 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.cpp
r99784 r100174 585 585 void UIGuestControlInterface::putCommand(const QString &strCommand) 586 586 { 587 if (!isGuestAdditionsAvailable(m_comGuest ))587 if (!isGuestAdditionsAvailable(m_comGuest, "6.1")) 588 588 { 589 589 emit sigOutputString("No guest addtions detected. Guest control requires guest additions"); … … 699 699 700 700 /* static */ 701 bool UIGuestControlInterface::isGuestAdditionsAvailable(const CGuest &guest) 702 { 703 if (!guest.isOk()) 704 return false; 701 bool UIGuestControlInterface::isGuestAdditionsAvailable(const CGuest &guest, const char *pszMinimumVersion) 702 { 705 703 CGuest guestNonConst = const_cast<CGuest&>(guest); 706 return guestNonConst.GetAdditionsStatus(guestNonConst.GetAdditionsRunLevel()); 704 705 if (guestNonConst.isNull() || !pszMinimumVersion) 706 return false; 707 bool fGuestAdditionsStatus = guestNonConst.GetAdditionsStatus(guestNonConst.GetAdditionsRunLevel()); 708 if (fGuestAdditionsStatus && guestNonConst.isOk()) 709 { 710 QString strGAVersion = guestNonConst.GetAdditionsVersion(); 711 if (guestNonConst.isOk()) 712 return (RTStrVersionCompare(strGAVersion.toUtf8().constData(), pszMinimumVersion) >= 0); 713 } 714 return false; 707 715 } 708 716 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.h
r98103 r100174 67 67 /** Pass a non-const ref since for some reason CGuest::GetAdditionsStatus 68 68 is non-const?! */ 69 static bool isGuestAdditionsAvailable(const CGuest &guest );69 static bool isGuestAdditionsAvailable(const CGuest &guest, const char *pszMinimumVersion); 70 70 static QString getFsObjTypeString(KFsObjType type); 71 71 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.