Changeset 47831 in vbox
- Timestamp:
- Aug 18, 2013 4:19:10 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 88092
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r47510 r47831 849 849 } 850 850 851 voidUIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const851 bool UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const 852 852 { 853 853 error(0, MessageType_Error, … … 855 855 .arg(strSnapshotName, strMachineName), 856 856 formatErrorInfo(console)); 857 } 858 859 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const 857 return false; 858 } 859 860 bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const 860 861 { 861 862 error(0, MessageType_Error, … … 863 864 .arg(strSnapshotName, strMachineName), 864 865 formatErrorInfo(progress)); 866 return false; 865 867 } 866 868 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r47510 r47831 205 205 void cannotTakeSnapshot(const CConsole &console, const QString &strMachineName, QWidget *pParent = 0) const; 206 206 void cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const; 207 voidcannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const;208 voidcannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;207 bool cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const; 208 bool cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; 209 209 void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const; 210 210 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r47775 r47831 107 107 #include "CMediumFormat.h" 108 108 #include "CSharedFolder.h" 109 #include "CConsole.h" 110 #include "CSnapshot.h" 109 111 110 112 /* Other VBox includes: */ … … 266 268 , mMediaEnumThread (NULL) 267 269 , mIsKWinManaged (false) 270 #if defined(DEBUG_bird) 271 , mAgressiveCaching(false) 272 #else 273 , mAgressiveCaching(true) 274 #endif 275 , mRestoreCurrentSnapshot(false) 268 276 , mDisablePatm(false) 269 277 , mDisableCsam(false) … … 384 392 AssertMsg(mValid, ("VBoxGlobal is invalid")); 385 393 AssertMsg(!m_pVirtualMachine, ("Machine already started")); 394 395 /* Restore current snapshot if asked to do so: */ 396 if (mRestoreCurrentSnapshot) 397 { 398 CSession session = vboxGlobal().openSession(strMachineId, KLockType_VM); 399 if (session.isNull()) 400 return false; 401 402 CConsole console = session.GetConsole(); 403 CMachine machine = session.GetMachine(); 404 CSnapshot snapshot = machine.GetCurrentSnapshot(); 405 CProgress progress = console.RestoreSnapshot(snapshot); 406 if (!console.isOk()) 407 return msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName()); 408 409 /* Show the snapshot-discard progress: */ 410 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png"); 411 if (progress.GetResultCode() != 0) 412 return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName()); 413 session.UnlockMachine(); 414 415 /* Clear the restore flag so media enum can be started, should be safe now. */ 416 mRestoreCurrentSnapshot = false; 417 } 386 418 387 419 /* Create VM session: */ … … 948 980 { 949 981 /* Medium may be new and not already in the media list, request refresh */ 950 startEnumeratingMedia( );982 startEnumeratingMedia(true /*fReallyNecessary*/); 951 983 if (!findMedium (cmedium, medium)) 952 984 /* Medium might be deleted already, return null string */ … … 1736 1768 * described above. 1737 1769 * 1770 * @param fReallyNecessary Whether the caller actually needs the media info 1771 * now, or is just trying to be nice and start the 1772 * IPC storm... er... caching process early. 1773 * 1738 1774 * @sa #currentMediaList() 1739 1775 * @sa #isMediaEnumerationStarted() 1740 1776 */ 1741 void VBoxGlobal::startEnumeratingMedia( )1777 void VBoxGlobal::startEnumeratingMedia(bool fReallyNecessary) 1742 1778 { 1743 1779 AssertReturnVoid (mValid); … … 1749 1785 /* Ignore the request during VBoxGlobal cleanup: */ 1750 1786 if (m_sfCleanupInProgress) 1787 return; 1788 1789 /* If asked to restore snapshot, don't do this till *after* we're done 1790 * restoring or the code with have a heart attack. */ 1791 if (shouldRestoreCurrentSnapshot()) 1792 return; 1793 1794 /* Developer doesn't want any unnecessary media caching! */ 1795 if (!fReallyNecessary && !agressiveCaching()) 1751 1796 return; 1752 1797 … … 4455 4500 } 4456 4501 } 4457 else if (!::strcmp 4502 else if (!::strcmp(arg, "--no-startvm-errormsgbox")) 4458 4503 mShowStartVMErrors = false; 4504 else if (!::strcmp(arg, "--aggressive-caching")) 4505 mAgressiveCaching = true; 4506 else if (!::strcmp(arg, "--no-aggressive-caching")) 4507 mAgressiveCaching = false; 4508 else if (!::strcmp(arg, "--restore-current")) 4509 mRestoreCurrentSnapshot = true; 4459 4510 else if (!::strcmp(arg, "--disable-patm")) 4460 4511 mDisablePatm = true; … … 4475 4526 } 4476 4527 #ifdef VBOX_WITH_DEBUGGER_GUI 4477 else if (!::strcmp 4528 else if (!::strcmp(arg, "-dbg") || !::strcmp (arg, "--dbg")) 4478 4529 setDebuggerVar(&mDbgEnabled, true); 4479 4530 else if (!::strcmp( arg, "-debug") || !::strcmp (arg, "--debug")) … … 4485 4536 mStartPaused = true; 4486 4537 } 4487 else if (!::strcmp 4538 else if (!::strcmp(arg, "--debug-command-line")) 4488 4539 { 4489 4540 setDebuggerVar(&mDbgEnabled, true); … … 4492 4543 mStartPaused = true; 4493 4544 } 4494 else if (!::strcmp 4545 else if (!::strcmp(arg, "--debug-statistics")) 4495 4546 { 4496 4547 setDebuggerVar(&mDbgEnabled, true); … … 4499 4550 mStartPaused = true; 4500 4551 } 4501 else if (!::strcmp (arg, "-no-debug") || !::strcmp(arg, "--no-debug"))4552 else if (!::strcmp(arg, "-no-debug") || !::strcmp(arg, "--no-debug")) 4502 4553 { 4503 4554 setDebuggerVar(&mDbgEnabled, false); … … 4507 4558 } 4508 4559 /* Not quite debug options, but they're only useful with the debugger bits. */ 4509 else if (!::strcmp 4560 else if (!::strcmp(arg, "--start-paused")) 4510 4561 mStartPaused = true; 4511 else if (!::strcmp 4562 else if (!::strcmp(arg, "--start-running")) 4512 4563 mStartPaused = false; 4513 4564 #endif … … 4576 4627 * but this method should be run anyway just to enumerate null UIMedium object, 4577 4628 * used by some VBox smart widgets, like VBoxMediaComboBox: */ 4578 vboxGlobal().startEnumeratingMedia( );4629 vboxGlobal().startEnumeratingMedia(false /*fReallyNecessary*/); 4579 4630 4580 4631 /* Prepare global settings change handler: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r47478 r47831 124 124 const QRect availableGeometry(int iScreen = 0) const; 125 125 126 bool agressiveCaching() const { return mAgressiveCaching; } 127 bool shouldRestoreCurrentSnapshot() const { return mRestoreCurrentSnapshot; } 126 128 bool isPatmDisabled() const { return mDisablePatm; } 127 129 bool isCsamDisabled() const { return mDisableCsam; } … … 239 241 CSession openExistingSession(const QString &aId) { return openSession(aId, KLockType_Shared); } 240 242 241 void startEnumeratingMedia( );243 void startEnumeratingMedia(bool fReallyNecessary); 242 244 243 245 void reloadProxySettings(); … … 474 476 bool mIsKWinManaged; 475 477 478 /** The --aggressive-caching / --no-aggressive-caching option. */ 479 bool mAgressiveCaching; 480 /** The --restore-current option. */ 481 bool mRestoreCurrentSnapshot; 476 482 /** The --disable-patm option. */ 477 483 bool mDisablePatm; -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r46430 r47831 251 251 " --rmode %-18s select different render mode (default is %s)\n" 252 252 " --no-startvm-errormsgbox do not show a message box for VM start errors\n" 253 " --restore-current restore the current snapshot before starting\n" 254 " --no-aggressive-caching delays caching media info in VM processes\n" 253 255 # ifdef VBOX_GUI_WITH_PIDFILE 254 256 " --pidfile <file> create a pidfile file when a VM is up and running\n" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r46831 r47831 511 511 512 512 if (aRefresh && !vboxGlobal().isMediaEnumerationStarted()) 513 vboxGlobal().startEnumeratingMedia( );513 vboxGlobal().startEnumeratingMedia(true /*fReallyNecessary*/); 514 514 else 515 515 { … … 616 616 { 617 617 /* Start enumerating media */ 618 vboxGlobal().startEnumeratingMedia( );618 vboxGlobal().startEnumeratingMedia(true /*fReallyNecessary*/); 619 619 } 620 620 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r47478 r47831 383 383 384 384 /* Cache IMedium data: */ 385 vboxGlobal().startEnumeratingMedia( );385 vboxGlobal().startEnumeratingMedia(false /*fReallyNecessary*/); 386 386 387 387 /* Load machine settings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r47478 r47831 376 376 CSnapshot snapshot = machine.GetCurrentSnapshot(); 377 377 CProgress progress = console.RestoreSnapshot(snapshot); 378 if (console.isOk()) 379 { 380 /* Show the snapshot-discard progress: */ 381 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png"); 382 if (progress.GetResultCode() != 0) 383 { 384 /* Failed in progress: */ 385 msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName()); 386 return false; 387 } 388 } 389 else 390 { 391 /* Failed in console: */ 392 msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName()); 393 return false; 394 } 378 if (!console.isOk()) 379 return msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName()); 380 381 /* Show the snapshot-discard progress: */ 382 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png"); 383 if (progress.GetResultCode() != 0) 384 return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName()); 395 385 } 396 386 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r47573 r47831 1735 1735 * lasted point, where we can start. The rest of the media checking is done 1736 1736 * in a background thread. */ 1737 vboxGlobal().startEnumeratingMedia( );1737 vboxGlobal().startEnumeratingMedia(true /*fReallyNecessary*/); 1738 1738 1739 1739 /* Initialize pixmap pool */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
r44528 r47831 90 90 { 91 91 if (!vboxGlobal().isMediaEnumerationStarted()) 92 vboxGlobal().startEnumeratingMedia( );92 vboxGlobal().startEnumeratingMedia(true /*fReallyNecessary*/); 93 93 else 94 94 refresh();
Note:
See TracChangeset
for help on using the changeset viewer.