- Timestamp:
- Mar 13, 2023 10:05:36 AM (23 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r98885 r98926 1334 1334 } 1335 1335 1336 CSession UICommon::openSession( const QUuid &uId, KLockType lockType /* = KLockType_Shared*/)1336 CSession UICommon::openSession(QUuid uId, KLockType enmLockType /* = KLockType_Write */) 1337 1337 { 1338 1338 /* Prepare session: */ 1339 1339 CSession comSession; 1340 1341 /* Make sure uId isn't null: */ 1342 if (uId.isNull()) 1343 uId = managedVMUuid(); 1344 if (uId.isNull()) 1345 return comSession; 1340 1346 1341 1347 /* Simulate try-catch block: */ … … 1359 1365 } 1360 1366 1361 if ( lockType == KLockType_VM)1367 if (enmLockType == KLockType_VM) 1362 1368 comSession.SetName("GUI/Qt"); 1363 1369 1364 1370 /* Lock found machine to session: */ 1365 comMachine.LockMachine(comSession, lockType);1371 comMachine.LockMachine(comSession, enmLockType); 1366 1372 if (!comMachine.isOk()) 1367 1373 { … … 1391 1397 /* Return session: */ 1392 1398 return comSession; 1399 } 1400 1401 CSession UICommon::openSession(KLockType enmLockType /* = KLockType_Write */) 1402 { 1403 /* Pass to function above: */ 1404 return openSession(managedVMUuid(), enmLockType); 1393 1405 } 1394 1406 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r98885 r98926 336 336 337 337 /** Opens session of certain @a enmLockType for VM with certain @a uId. */ 338 CSession openSession(const QUuid &uId, KLockType enmLockType = KLockType_Write); 338 CSession openSession(QUuid uId, KLockType enmLockType = KLockType_Write); 339 /** Opens session of certain @a enmLockType for currently chosen VM. */ 340 CSession openSession(KLockType enmLockType = KLockType_Write); 339 341 /** Opens session of KLockType_Shared type for VM with certain @a uId. */ 340 342 CSession openExistingSession(const QUuid &uId) { return openSession(uId, KLockType_Shared); } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.cpp
r98890 r98926 101 101 102 102 /* Try to start virtual machine, quit if failed: */ 103 if (!UIMachine::startMachine( uiCommon().managedVMUuid()))103 if (!UIMachine::startMachine()) 104 104 return QApplication::quit(); 105 105 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98903 r98926 113 113 114 114 /* static */ 115 bool UIMachine::startMachine( const QUuid &uID)115 bool UIMachine::startMachine() 116 116 { 117 117 /* Make sure machine is not created: */ … … 122 122 { 123 123 /* Create temporary session: */ 124 CSession session = uiCommon().openSession(uID,KLockType_VM);125 if ( session.isNull())124 CSession comSession = uiCommon().openSession(KLockType_VM); 125 if (comSession.isNull()) 126 126 return false; 127 127 128 128 /* Which VM we operate on? */ 129 CMachine machine = session.GetMachine();129 CMachine comMachine = comSession.GetMachine(); 130 130 /* Which snapshot we are restoring? */ 131 CSnapshot snapshot = machine.GetCurrentSnapshot();131 CSnapshot comSnapshot = comMachine.GetCurrentSnapshot(); 132 132 133 133 /* Prepare restore-snapshot progress: */ 134 CProgress progress = machine.RestoreSnapshot(snapshot);135 if (! machine.isOk())136 return msgCenter().cannotRestoreSnapshot( machine, snapshot.GetName(), machine.GetName());134 CProgress comProgress = comMachine.RestoreSnapshot(comSnapshot); 135 if (!comMachine.isOk()) 136 return msgCenter().cannotRestoreSnapshot(comMachine, comSnapshot.GetName(), comMachine.GetName()); 137 137 138 138 /* Show the snapshot-discarding progress: */ 139 msgCenter().showModalProgressDialog( progress, machine.GetName(), ":/progress_snapshot_discard_90px.png");140 if ( progress.GetResultCode() != 0)141 return msgCenter().cannotRestoreSnapshot( progress, snapshot.GetName(), machine.GetName());139 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_snapshot_discard_90px.png"); 140 if (comProgress.GetResultCode() != 0) 141 return msgCenter().cannotRestoreSnapshot(comProgress, comSnapshot.GetName(), comMachine.GetName()); 142 142 143 143 /* Unlock session finally: */ 144 session.UnlockMachine();144 comSession.UnlockMachine(); 145 145 146 146 /* Clear snapshot-restoring request: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98903 r98926 154 154 public: 155 155 156 /** Static factory to start machine with passed @a uID. 157 * @return true if machine was started, false otherwise. */ 158 static bool startMachine(const QUuid &uID); 156 /** Static factory to start machine. */ 157 static bool startMachine(); 159 158 /** Static constructor. */ 160 159 static bool create();
Note:
See TracChangeset
for help on using the changeset viewer.