Changeset 105546 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 30, 2024 11:59:31 PM (6 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r105152 r105546 163 163 , m_fAgressiveCaching(true) 164 164 #endif 165 , m_fNoKeyboardGrabbing(false) 165 166 , m_fRestoreCurrentSnapshot(false) 166 , m_fNoKeyboardGrabbing(false)167 167 , m_fExecuteAllInIem(false) 168 168 , m_uWarpPct(100) … … 430 430 enmOptType = OptType_VMRunner; 431 431 m_fRestoreCurrentSnapshot = true; 432 m_strSnapshotToRestore.clear(); 433 } 434 else if ( !::strcmp(arg, "--restore-snapshot") 435 || !::strncmp(arg, RT_STR_TUPLE("--restore-snapshot=")) 436 || !::strncmp(arg, RT_STR_TUPLE("--restore-snapshot:"))) 437 { 438 enmOptType = OptType_VMRunner; 439 const char * const pszSep = &arg[sizeof("--restore-snapshot") - 1]; 440 if (*pszSep != '\0') 441 m_strSnapshotToRestore = &pszSep[1]; 442 else if (++i < argc) 443 m_strSnapshotToRestore = arguments.at(i); 444 else 445 m_strSnapshotToRestore.clear(); 446 m_fRestoreCurrentSnapshot = false; 432 447 } 433 448 else if (!::strcmp(arg, "--no-keyboard-grabbing")) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r105152 r105546 168 168 /** Returns the --restore-current option value (whether we should restore current snapshot before VM started). */ 169 169 bool shouldRestoreCurrentSnapshot() const { return m_fRestoreCurrentSnapshot; } 170 /** Defines whether we should fRestore current snapshot before VM started. */ 171 void setShouldRestoreCurrentSnapshot(bool fRestore) { m_fRestoreCurrentSnapshot = fRestore; } 170 /** Returns the --restore-snapshot option value (whether to restore named snapshot before starting VM). */ 171 QString const &getSnapshotToRestore() const { return m_strSnapshotToRestore; } 172 /** Clears the --restore-current and --restore-snapshot option values. */ 173 void clearSnapshotRestoreOptions() { m_fRestoreCurrentSnapshot = false; m_strSnapshotToRestore.clear(); } 172 174 173 175 /** Returns the --no-keyboard-grabbing option value (whether we should restore … … 403 405 bool m_fAgressiveCaching; 404 406 405 /** Holds the --restore-current option value. */406 bool m_fRestoreCurrentSnapshot;407 408 407 /** Holds the --no-keyboard-grabbing option value. */ 409 408 bool m_fNoKeyboardGrabbing; 409 410 /** Holds the --restore-current option value. */ 411 bool m_fRestoreCurrentSnapshot; 412 /** Holds the --restore-snapshot option value. */ 413 QString m_strSnapshotToRestore; 410 414 411 415 /** Holds the --fda option value (floppy image). */ -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r105103 r105546 281 281 " --no-startvm-errormsgbox do not show a message box for VM start errors\n" 282 282 " --restore-current restore the current snapshot before starting\n" 283 " --restore-snapshot=<name> restore the named snapshot before starting\n" 283 284 " --no-aggressive-caching delays caching media info in VM processes\n" 284 285 " --fda <image|none> Mount the specified floppy image\n" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r105265 r105546 123 123 124 124 /* Restore current snapshot if requested: */ 125 if (uiCommon().shouldRestoreCurrentSnapshot()) 125 if ( uiCommon().shouldRestoreCurrentSnapshot() 126 || !uiCommon().getSnapshotToRestore().isEmpty()) 126 127 { 127 128 /* Create temporary session: */ … … 132 133 /* Which VM we operate on? */ 133 134 CMachine comMachine = comSession.GetMachine(); 134 /* Which snapshot we are restoring? */ 135 CSnapshot comSnapshot = comMachine.GetCurrentSnapshot(); 135 /* Which snapshot are we restoring? */ 136 CSnapshot comSnapshot = uiCommon().shouldRestoreCurrentSnapshot() 137 ? comMachine.GetCurrentSnapshot() 138 : comMachine.FindSnapshot(uiCommon().getSnapshotToRestore()); 136 139 137 140 /* Prepare restore-snapshot progress: */ 138 141 CProgress comProgress = comMachine.RestoreSnapshot(comSnapshot); 139 142 if (!comMachine.isOk()) 140 return msgCenter().cannotRestoreSnapshot(comMachine, comSnapshot.GetName(), comMachine.GetName()); 143 return msgCenter().cannotRestoreSnapshot(comMachine, 144 comSnapshot.isOk() ? comSnapshot.GetName() 145 /** @todo deal better with snapshot-not found issues: */ 146 : uiCommon().shouldRestoreCurrentSnapshot() ? "current" 147 : uiCommon().getSnapshotToRestore(), 148 comMachine.GetName()); 141 149 142 150 /* Show the snapshot-discarding progress: */ … … 149 157 150 158 /* Clear snapshot-restoring request: */ 151 uiCommon(). setShouldRestoreCurrentSnapshot(false);159 uiCommon().clearSnapshotRestoreOptions(); 152 160 } 153 161
Note:
See TracChangeset
for help on using the changeset viewer.