Changeset 98485 in vbox
- Timestamp:
- Feb 7, 2023 10:45:42 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155751
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r98103 r98485 37 37 #include "UIDetailsGenerator.h" 38 38 #include "UIErrorString.h" 39 #include "UIMedium.h" 39 40 #include "UITranslator.h" 40 41 … … 73 74 74 75 76 const QString UIDetailsGenerator::e_strTableRow1 = QString("<tr><td colspan='2'><nobr><b>%1</b></nobr></td></tr>"); 77 const QString UIDetailsGenerator::e_strTableRow2 = QString("<tr><td><nobr>%1:</nobr></td><td><nobr>%2</nobr></td></tr>"); 78 const QString UIDetailsGenerator::e_strTableRow3 = QString("<tr><td><nobr> %1:</nobr></td><td><nobr>%2</nobr></td></tr>"); 79 80 75 81 UITextTable UIDetailsGenerator::generateMachineInformationGeneral(CMachine &comMachine, 76 82 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions) … … 1166 1172 return table; 1167 1173 } 1174 1175 void UIDetailsGenerator::acquireHardDiskStatusInfo(CMachine &comMachine, QString &strInfo, 1176 bool &fAttachmentsPresent) 1177 { 1178 /* Enumerate all the controllers: */ 1179 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 1180 { 1181 /* Enumerate all the attachments: */ 1182 QString strAttData; 1183 foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 1184 { 1185 /* Skip unrelated attachments: */ 1186 if (comAttachment.GetType() != KDeviceType_HardDisk) 1187 continue; 1188 /* Append attachment data: */ 1189 strAttData += e_strTableRow3 1190 .arg(gpConverter->toString(StorageSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice()))) 1191 .arg(UIMedium(comAttachment.GetMedium(), UIMediumDeviceType_HardDisk).location()); 1192 fAttachmentsPresent = true; 1193 } 1194 /* Append controller data: */ 1195 if (!strAttData.isNull()) 1196 strInfo += e_strTableRow1.arg(comController.GetName()) + strAttData; 1197 } 1198 } 1199 1200 void UIDetailsGenerator::acquireOpticalDiskStatusInfo(CMachine &comMachine, QString &strInfo, 1201 bool &fAttachmentsPresent, bool &fAttachmentsMounted) 1202 { 1203 /* Enumerate all the controllers: */ 1204 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 1205 { 1206 QString strAttData; 1207 /* Enumerate all the attachments: */ 1208 foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 1209 { 1210 /* Skip unrelated attachments: */ 1211 if (comAttachment.GetType() != KDeviceType_DVD) 1212 continue; 1213 /* Append attachment data: */ 1214 UIMedium vboxMedium(comAttachment.GetMedium(), UIMediumDeviceType_DVD); 1215 strAttData += e_strTableRow3 1216 .arg(gpConverter->toString(StorageSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice()))) 1217 .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location()); 1218 fAttachmentsPresent = true; 1219 if (!vboxMedium.isNull()) 1220 fAttachmentsMounted = true; 1221 } 1222 /* Append controller data: */ 1223 if (!strAttData.isNull()) 1224 strInfo += e_strTableRow1.arg(comController.GetName()) + strAttData; 1225 } 1226 } 1227 1228 void UIDetailsGenerator::acquireFloppyDiskStatusInfo(CMachine &comMachine, QString &strInfo, 1229 bool &fAttachmentsPresent, bool &fAttachmentsMounted) 1230 { 1231 /* Enumerate all the controllers: */ 1232 foreach (const CStorageController &comController, comMachine.GetStorageControllers()) 1233 { 1234 QString strAttData; 1235 /* Enumerate all the attachments: */ 1236 foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachmentsOfController(comController.GetName())) 1237 { 1238 /* Skip unrelated attachments: */ 1239 if (comAttachment.GetType() != KDeviceType_Floppy) 1240 continue; 1241 /* Append attachment data: */ 1242 UIMedium vboxMedium(comAttachment.GetMedium(), UIMediumDeviceType_Floppy); 1243 strAttData += e_strTableRow3 1244 .arg(gpConverter->toString(StorageSlot(comController.GetBus(), comAttachment.GetPort(), comAttachment.GetDevice()))) 1245 .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location()); 1246 fAttachmentsPresent = true; 1247 if (!vboxMedium.isNull()) 1248 fAttachmentsMounted = true; 1249 } 1250 /* Append controller data: */ 1251 if (!strAttData.isNull()) 1252 strInfo += e_strTableRow1.arg(comController.GetName()) + strAttData; 1253 } 1254 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h
r98103 r98485 81 81 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationDescription(CMachine &comMachine, 82 82 const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &fOptions); 83 84 SHARED_LIBRARY_STUFF void acquireHardDiskStatusInfo(CMachine &comMachine, QString &strInfo, 85 bool &fAttachmentsPresent); 86 87 SHARED_LIBRARY_STUFF void acquireOpticalDiskStatusInfo(CMachine &comMachine, QString &strInfo, 88 bool &fAttachmentsPresent, bool &fAttachmentsMounted); 89 90 SHARED_LIBRARY_STUFF void acquireFloppyDiskStatusInfo(CMachine &comMachine, QString &strInfo, 91 bool &fAttachmentsPresent, bool &fAttachmentsMounted); 92 93 /** Holds the table row format 1. */ 94 extern const QString e_strTableRow1; 95 /** Holds the table row format 2. */ 96 extern const QString e_strTableRow2; 97 /** Holds the table row format 3. */ 98 extern const QString e_strTableRow3; 83 99 } 84 100 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r98482 r98485 44 44 #include "UIIndicatorsPool.h" 45 45 #include "UIMachine.h" 46 #include "UIMedium.h"47 46 #include "UISession.h" 48 47 … … 58 57 #include "CMachineDebugger.h" 59 58 #include "CGuest.h" 60 #include "CStorageController.h"61 #include "CMediumAttachment.h"62 59 #include "CNetworkAdapter.h" 63 60 #include "CUSBController.h" … … 195 192 public: 196 193 197 /** Construct or, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */194 /** Constructs indicator passing @a pMachine to the base-class. */ 198 195 UIIndicatorHardDrive(UIMachine *pMachine, UISession *pSession) 199 196 : UISessionStateStatusBarIndicator(IndicatorType_HardDisks, pMachine, pSession) … … 205 202 setStateIcon(KDeviceActivity_Null, UIIconPool::iconSet(":/hd_disabled_16px.png")); 206 203 /* Configure connection: */ 207 connect(p Session, &UISession::sigStorageDeviceChange,204 connect(pMachine, &UIMachine::sigStorageDeviceChange, 208 205 this, &UIIndicatorHardDrive::sltStorageDeviceChange); 209 206 /* Translate finally: */ … … 213 210 private slots: 214 211 215 /** Refresh the tooltip if the device config changes at runtime (hotplugging, 216 * USB storage). */ 217 void sltStorageDeviceChange(const CMediumAttachment &attachment, bool fRemoved, bool fSilent) 218 { 219 RT_NOREF(attachment, fRemoved, fSilent); 212 /** Refreshes the tooltip if the device config changes at runtime (hotplugging, USB storage). */ 213 void sltStorageDeviceChange() 214 { 220 215 updateAppearance(); 221 216 } … … 226 221 void updateAppearance() 227 222 { 228 /* Get machine: */ 229 const CMachine machine = m_pSession->machine(); 230 231 /* Prepare tool-tip: */ 223 /* Acquire data: */ 232 224 QString strFullData; 233 234 /* Enumerate all the controllers: */235 225 bool fAttachmentsPresent = false; 236 foreach (const CStorageController &controller, machine.GetStorageControllers()) 237 { 238 QString strAttData; 239 /* Enumerate all the attachments: */ 240 foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName())) 241 { 242 /* Skip unrelated attachments: */ 243 if (attachment.GetType() != KDeviceType_HardDisk) 244 continue; 245 /* Append attachment data: */ 246 strAttData += s_strTableRow4 247 .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()))) 248 .arg(UIMedium(attachment.GetMedium(), UIMediumDeviceType_HardDisk).location()); 249 fAttachmentsPresent = true; 250 } 251 /* Append controller data: */ 252 if (!strAttData.isNull()) 253 strFullData += s_strTableRow1.arg(controller.GetName()) + strAttData; 254 } 226 m_pMachine->acquireHardDiskStatusInfo(strFullData, fAttachmentsPresent); 255 227 256 228 /* Hide indicator if there are no attachments: */ … … 272 244 public: 273 245 274 /** Construct or, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */246 /** Constructs indicator passing @a pMachine to the base-class. */ 275 247 UIIndicatorOpticalDisks(UIMachine *pMachine, UISession *pSession) 276 248 : UISessionStateStatusBarIndicator(IndicatorType_OpticalDisks, pMachine, pSession) … … 290 262 void updateAppearance() 291 263 { 292 /* Get machine: */293 const CMachine machine = m_pSession->machine();294 295 /* Prepare tool-tip: */296 264 QString strFullData; 297 298 /* Enumerate all the controllers: */299 265 bool fAttachmentsPresent = false; 300 266 bool fAttachmentsMounted = false; 301 foreach (const CStorageController &controller, machine.GetStorageControllers()) 302 { 303 QString strAttData; 304 /* Enumerate all the attachments: */ 305 foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName())) 306 { 307 /* Skip unrelated attachments: */ 308 if (attachment.GetType() != KDeviceType_DVD) 309 continue; 310 /* Append attachment data: */ 311 UIMedium vboxMedium(attachment.GetMedium(), UIMediumDeviceType_DVD); 312 strAttData += s_strTableRow4 313 .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()))) 314 .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location()); 315 fAttachmentsPresent = true; 316 if (!vboxMedium.isNull()) 317 fAttachmentsMounted = true; 318 } 319 /* Append controller data: */ 320 if (!strAttData.isNull()) 321 strFullData += s_strTableRow1.arg(controller.GetName()) + strAttData; 322 } 267 m_pMachine->acquireOpticalDiskStatusInfo(strFullData, fAttachmentsPresent, fAttachmentsMounted); 323 268 324 269 /* Hide indicator if there are no attachments: */ 325 if (!fAttachmentsPresent) 326 hide(); 270 setVisible(fAttachmentsPresent); 327 271 328 272 /* Update tool-tip: */ … … 341 285 public: 342 286 343 /** Construct or, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */287 /** Constructs indicator passing @a pMachine to the base-class. */ 344 288 UIIndicatorFloppyDisks(UIMachine *pMachine, UISession *pSession) 345 289 : UISessionStateStatusBarIndicator(IndicatorType_FloppyDisks, pMachine, pSession) … … 359 303 void updateAppearance() 360 304 { 361 /* Get machine: */362 const CMachine machine = m_pSession->machine();363 364 /* Prepare tool-tip: */365 305 QString strFullData; 366 367 /* Enumerate all the controllers: */368 306 bool fAttachmentsPresent = false; 369 307 bool fAttachmentsMounted = false; 370 foreach (const CStorageController &controller, machine.GetStorageControllers()) 371 { 372 QString strAttData; 373 /* Enumerate all the attachments: */ 374 foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName())) 375 { 376 /* Skip unrelated attachments: */ 377 if (attachment.GetType() != KDeviceType_Floppy) 378 continue; 379 /* Append attachment data: */ 380 UIMedium vboxMedium(attachment.GetMedium(), UIMediumDeviceType_Floppy); 381 strAttData += s_strTableRow4 382 .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()))) 383 .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location()); 384 fAttachmentsPresent = true; 385 if (!vboxMedium.isNull()) 386 fAttachmentsMounted = true; 387 } 388 /* Append controller data: */ 389 if (!strAttData.isNull()) 390 strFullData += s_strTableRow1.arg(controller.GetName()) + strAttData; 391 } 308 m_pMachine->acquireFloppyDiskStatusInfo(strFullData, fAttachmentsPresent, fAttachmentsMounted); 392 309 393 310 /* Hide indicator if there are no attachments: */ 394 if (!fAttachmentsPresent) 395 hide(); 311 setVisible(fAttachmentsPresent); 396 312 397 313 /* Update tool-tip: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98482 r98485 446 446 { 447 447 uisession()->acquireDeviceActivity(deviceTypes, states); 448 } 449 450 void UIMachine::acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent) 451 { 452 uisession()->acquireHardDiskStatusInfo(strInfo, fAttachmentsPresent); 453 } 454 455 void UIMachine::acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted) 456 { 457 uisession()->acquireOpticalDiskStatusInfo(strInfo, fAttachmentsPresent, fAttachmentsMounted); 458 } 459 460 void UIMachine::acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted) 461 { 462 uisession()->acquireFloppyDiskStatusInfo(strInfo, fAttachmentsPresent, fAttachmentsMounted); 448 463 } 449 464 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98482 r98485 378 378 /** Acquires device activity composing a vector of current @a states for device with @a deviceTypes specified. */ 379 379 void acquireDeviceActivity(const QVector<KDeviceType> &deviceTypes, QVector<KDeviceActivity> &states); 380 381 /** Acquires status info for hard disk indicator. */ 382 void acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent); 383 /** Acquires status info for optical disk indicator. */ 384 void acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted); 385 /** Acquires status info for floppy disk indicator. */ 386 void acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted); 380 387 /** @} */ 381 388 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98482 r98485 38 38 #include "UICommon.h" 39 39 #include "UIConsoleEventHandler.h" 40 #include "UIDetailsGenerator.h" 40 41 #include "UIExtraDataManager.h" 41 42 #include "UIFrameBuffer.h" … … 313 314 if (!comConsole.isOk()) 314 315 UINotificationMessage::cannotAcquireConsoleParameter(comConsole); 316 } 317 318 void UISession::acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent) 319 { 320 CMachine comMachine = machine(); 321 UIDetailsGenerator::acquireHardDiskStatusInfo(comMachine, strInfo, fAttachmentsPresent); 322 } 323 324 void UISession::acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted) 325 { 326 CMachine comMachine = machine(); 327 UIDetailsGenerator::acquireOpticalDiskStatusInfo(comMachine, strInfo, fAttachmentsPresent, fAttachmentsMounted); 328 } 329 330 void UISession::acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted) 331 { 332 CMachine comMachine = machine(); 333 UIDetailsGenerator::acquireFloppyDiskStatusInfo(comMachine, strInfo, fAttachmentsPresent, fAttachmentsMounted); 315 334 } 316 335 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98482 r98485 264 264 /** Acquires device activity composing a vector of current @a states for device with @a deviceTypes specified. */ 265 265 void acquireDeviceActivity(const QVector<KDeviceType> &deviceTypes, QVector<KDeviceActivity> &states); 266 267 /** Acquires status info for hard disk indicator. */ 268 void acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent); 269 /** Acquires status info for optical disk indicator. */ 270 void acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted); 271 /** Acquires status info for floppy disk indicator. */ 272 void acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted); 266 273 /** @} */ 267 274
Note:
See TracChangeset
for help on using the changeset viewer.