Changeset 55678 in vbox
- Timestamp:
- May 6, 2015 12:34:10 AM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
-
globals/VBoxGlobal.cpp (modified) (4 diffs)
-
globals/VBoxGlobal.h (modified) (3 diffs)
-
main.cpp (modified) (1 diff)
-
runtime/UISession.cpp (modified) (2 diffs)
-
runtime/UISession.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r55416 r55678 4001 4001 } 4002 4002 #endif /* VBOX_GUI_WITH_PIDFILE */ 4003 /* Visual state type options: */ 4003 4004 else if (!::strcmp(arg, "-normal") || !::strcmp(arg, "--normal")) 4004 {4005 4005 visualStateType = UIVisualStateType_Normal; 4006 }4007 4006 else if (!::strcmp(arg, "-fullscreen") || !::strcmp(arg, "--fullscreen")) 4008 {4009 4007 visualStateType = UIVisualStateType_Fullscreen; 4010 }4011 4008 else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless")) 4012 {4013 4009 visualStateType = UIVisualStateType_Seamless; 4014 }4015 4010 else if (!::strcmp(arg, "-scale") || !::strcmp(arg, "--scale")) 4016 {4017 4011 visualStateType = UIVisualStateType_Scale; 4018 } 4019 else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment")) 4020 { 4021 ++i; 4022 } 4012 /* Passwords: */ 4023 4013 else if (!::strcmp (arg, "--settingspw")) 4024 4014 { … … 4063 4053 } 4064 4054 } 4055 /* Misc options: */ 4056 else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment")) 4057 ++i; 4065 4058 else if (!::strcmp(arg, "--no-startvm-errormsgbox")) 4066 4059 mShowStartVMErrors = false; … … 4071 4064 else if (!::strcmp(arg, "--restore-current")) 4072 4065 mRestoreCurrentSnapshot = true; 4066 /* Ad hoc VM reconfig options: */ 4067 else if (!::strcmp(arg, "--fdc")) 4068 { 4069 if (++i < argc) 4070 m_strFloppyImage = qApp->argv()[i]; 4071 } 4072 else if (!::strcmp(arg, "--dvd") || !::strcmp(arg, "--cdrom")) 4073 { 4074 if (++i < argc) 4075 m_strDvdImage = qApp->argv()[i]; 4076 } 4077 /* VMM Options: */ 4073 4078 else if (!::strcmp(arg, "--disable-patm")) 4074 4079 mDisablePatm = true; … … 4089 4094 } 4090 4095 #ifdef VBOX_WITH_DEBUGGER_GUI 4096 /* Debugger/Debugging options: */ 4091 4097 else if (!::strcmp(arg, "-dbg") || !::strcmp (arg, "--dbg")) 4092 4098 setDebuggerVar(&m_fDbgEnabled, true); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r55401 r55678 156 156 void setShouldRestoreCurrentSnapshot(bool fRestore) { mRestoreCurrentSnapshot = fRestore; } 157 157 158 bool hasFloppyImageToMount() const { return !m_strFloppyImage.isEmpty(); } 159 bool hasDvdImageToMount() const { return !m_strDvdImage.isEmpty(); } 160 QString const &getFloppyImage() const { return m_strFloppyImage; } 161 QString const &getDvdImage() const { return m_strDvdImage; } 162 158 163 bool isPatmDisabled() const { return mDisablePatm; } 159 164 bool isCsamDisabled() const { return mDisableCsam; } … … 481 486 /** The --restore-current option. */ 482 487 bool mRestoreCurrentSnapshot; 488 /** @name Ad-hoc VM reconfiguration. 489 * @{ */ 490 /** Floppy image. */ 491 QString m_strFloppyImage; 492 /** DVD image. */ 493 QString m_strDvdImage; 494 /** @} */ 495 /** @name VMM options 496 * @{ */ 483 497 /** The --disable-patm option. */ 484 498 bool mDisablePatm; … … 493 507 /** The --warp-factor option value. */ 494 508 uint32_t mWarpPct; 509 /** @} */ 495 510 496 511 #ifdef VBOX_WITH_DEBUGGER_GUI -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r54081 r55678 241 241 " --restore-current restore the current snapshot before starting\n" 242 242 " --no-aggressive-caching delays caching media info in VM processes\n" 243 " --fdc <image|none> Mount the specified floppy image\n" 244 " --dvd <image|none> Mount the specified DVD image\n" 243 245 # ifdef VBOX_GUI_WITH_PIDFILE 244 246 " --pidfile <file> create a pidfile file when a VM is up and running\n" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r55214 r55678 197 197 debugger().SetVirtualTimeRate(vboxGlobal().getWarpPct()); 198 198 } 199 200 /* Apply ad-hoc reconfigurations from the command line. */ 201 if (vboxGlobal().hasFloppyImageToMount()) 202 mountAdHocImage(KDeviceType_Floppy, UIMediumType_Floppy, vboxGlobal().getFloppyImage()); 203 if (vboxGlobal().hasDvdImageToMount()) 204 mountAdHocImage(KDeviceType_DVD, UIMediumType_DVD, vboxGlobal().getDvdImage()); 199 205 200 206 /* Power UP if this is NOT separate process: */ … … 1842 1848 } 1843 1849 1850 bool UISession::mountAdHocImage(KDeviceType enmDeviceType, UIMediumType enmMediumType, QString const &strImage) 1851 { 1852 /* 1853 * The 'none' image name means ejecting what ever is in the drive, so leave 1854 * the image variables null. 1855 */ 1856 CVirtualBox vbox = vboxGlobal().virtualBox(); 1857 UIMedium uiImage; 1858 if (strImage != "none") 1859 { 1860 /* 1861 * Open the image. 1862 */ 1863 QString strMediumID; 1864 CVirtualBox vbox = vboxGlobal().virtualBox(); 1865 CMedium vboxImage = vbox.OpenMedium(strImage, enmDeviceType, KAccessMode_ReadWrite, false /* fForceNewUuid */); 1866 if (!vbox.isOk() || vboxImage.isNull()) 1867 { 1868 msgCenter().cannotOpenMedium(vbox, enmMediumType, strImage, mainMachineWindow()); 1869 return false; 1870 } 1871 1872 /* 1873 * Work the cache and use the cached image if possible. 1874 */ 1875 uiImage = vboxGlobal().medium(vboxImage.GetId()); 1876 if (uiImage.isNull()) 1877 { 1878 uiImage = UIMedium(vboxImage, enmMediumType, KMediumState_Created); 1879 vboxGlobal().createMedium(uiImage); 1880 } 1881 } 1882 if (vbox.isOk()) 1883 { 1884 /* 1885 * Find suitable storage controller. 1886 */ 1887 foreach (const CStorageController &controller, machine().GetStorageControllers()) 1888 { 1889 foreach (const CMediumAttachment &attachment, machine().GetMediumAttachmentsOfController(controller.GetName())) 1890 { 1891 if (attachment.GetType() == enmDeviceType) 1892 { 1893 /* 1894 * Mount the image. 1895 */ 1896 machine().MountMedium(controller.GetName(), attachment.GetPort(), attachment.GetDevice(), uiImage.medium(), true /* force */); 1897 if (machine().isOk()) 1898 return true; 1899 msgCenter().cannotRemountMedium(machine(), uiImage, !uiImage.isNull() /*mount*/, false /* retry? */, mainMachineWindow()); 1900 return false; 1901 } 1902 } 1903 } 1904 msgCenter().cannotRemountMedium(machine(), uiImage, !uiImage.isNull() /*mount*/, false /* retry? */, mainMachineWindow()); 1905 } 1906 else 1907 msgCenter().cannotOpenMedium(vbox, enmMediumType, strImage, mainMachineWindow()); 1908 return false; 1909 } 1910 1844 1911 bool UISession::postprocessInitialization() 1845 1912 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r55401 r55678 27 27 /* GUI includes: */ 28 28 #include "UIExtraDataDefs.h" 29 #include "UIMediumDefs.h" 29 30 30 31 /* COM includes: */ … … 379 380 void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight); 380 381 bool preprocessInitialization(); 382 bool mountAdHocImage(KDeviceType enmDeviceType, enum UIMediumDefs::UIMediumType enmMediumType, QString const &strImage); 381 383 bool postprocessInitialization(); 382 384 int countOfVisibleWindows();
Note:
See TracChangeset
for help on using the changeset viewer.

