VirtualBox

Changeset 55678 in vbox


Ignore:
Timestamp:
May 6, 2015 12:34:10 AM (9 years ago)
Author:
vboxsync
Message:

VirtualBox: Added --fdc <image|none> and --dvd <image|none> from VBoxSDL.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r55416 r55678  
    40014001        }
    40024002#endif /* VBOX_GUI_WITH_PIDFILE */
     4003        /* Visual state type options: */
    40034004        else if (!::strcmp(arg, "-normal") || !::strcmp(arg, "--normal"))
    4004         {
    40054005            visualStateType = UIVisualStateType_Normal;
    4006         }
    40074006        else if (!::strcmp(arg, "-fullscreen") || !::strcmp(arg, "--fullscreen"))
    4008         {
    40094007            visualStateType = UIVisualStateType_Fullscreen;
    4010         }
    40114008        else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless"))
    4012         {
    40134009            visualStateType = UIVisualStateType_Seamless;
    4014         }
    40154010        else if (!::strcmp(arg, "-scale") || !::strcmp(arg, "--scale"))
    4016         {
    40174011            visualStateType = UIVisualStateType_Scale;
    4018         }
    4019         else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
    4020         {
    4021             ++i;
    4022         }
     4012        /* Passwords: */
    40234013        else if (!::strcmp (arg, "--settingspw"))
    40244014        {
     
    40634053            }
    40644054        }
     4055        /* Misc options: */
     4056        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
     4057            ++i;
    40654058        else if (!::strcmp(arg, "--no-startvm-errormsgbox"))
    40664059            mShowStartVMErrors = false;
     
    40714064        else if (!::strcmp(arg, "--restore-current"))
    40724065            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: */
    40734078        else if (!::strcmp(arg, "--disable-patm"))
    40744079            mDisablePatm = true;
     
    40894094        }
    40904095#ifdef VBOX_WITH_DEBUGGER_GUI
     4096        /* Debugger/Debugging options: */
    40914097        else if (!::strcmp(arg, "-dbg") || !::strcmp (arg, "--dbg"))
    40924098            setDebuggerVar(&m_fDbgEnabled, true);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r55401 r55678  
    156156    void setShouldRestoreCurrentSnapshot(bool fRestore) { mRestoreCurrentSnapshot = fRestore; }
    157157
     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
    158163    bool isPatmDisabled() const { return mDisablePatm; }
    159164    bool isCsamDisabled() const { return mDisableCsam; }
     
    481486    /** The --restore-current option. */
    482487    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     * @{ */
    483497    /** The --disable-patm option. */
    484498    bool mDisablePatm;
     
    493507    /** The --warp-factor option value. */
    494508    uint32_t mWarpPct;
     509    /** @} */
    495510
    496511#ifdef VBOX_WITH_DEBUGGER_GUI
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r54081 r55678  
    241241            "  --restore-current          restore the current snapshot before starting\n"
    242242            "  --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"
    243245# ifdef VBOX_GUI_WITH_PIDFILE
    244246            "  --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  
    197197            debugger().SetVirtualTimeRate(vboxGlobal().getWarpPct());
    198198    }
     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());
    199205
    200206    /* Power UP if this is NOT separate process: */
     
    18421848}
    18431849
     1850bool 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
    18441911bool UISession::postprocessInitialization()
    18451912{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r55401 r55678  
    2727/* GUI includes: */
    2828#include "UIExtraDataDefs.h"
     29#include "UIMediumDefs.h"
    2930
    3031/* COM includes: */
     
    379380    void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight);
    380381    bool preprocessInitialization();
     382    bool mountAdHocImage(KDeviceType enmDeviceType, enum UIMediumDefs::UIMediumType enmMediumType, QString const &strImage);
    381383    bool postprocessInitialization();
    382384    int countOfVisibleWindows();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette