VirtualBox

Changeset 2864 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 25, 2007 11:06:20 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21520
Message:

1750: Add CDROM configuration to "Create VM" wizard:

First Run Wizard implemented.
This dialog allows user to select and temporarily mount the booting source for the VM to be started for the first time. The booting source could be:

  1. CD/DVD-ROM host drive.
  2. CD/DVD-ROM image file.
  3. Floppy host drive.
  4. Floppy image file.

It also allows user to invoke Virtual Disk Manager Dialog to add additional CD/FD images as booting sources.

The dialog will only be executed for the VM which has a GUI/FirstRun=”yes” extra data flag in it's configuration file. This flag currently will be auto-added only for the new VM created by the “New VM Wizard”. After the “First Run Wizard” will be proposed for the first time, the flag will be erased from the VM configuration file. This flag will also be erased from the configuration file in case of there is any other value rather than “yes” for it.

TODO: The flag should also be erased from the configuration file in case of user manually changes the boot sequence or the CD/FD/HD configuration through the VM Settings Dialog.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r2801 r2864  
    8383
    8484# Sources containing local definitions of classes that use the Q_OBJECT macro
    85 VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp \
    86                                                 src/VBoxConsoleWnd.cpp
     85VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
    8786ifneq ($(BUILD_TARGET),win)
    8887VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r2823 r2864  
    3737        ui/VBoxNewHDWzd.ui \
    3838        ui/VBoxSnapshotsWgt.ui \
    39         ui/VBoxAboutDlg.ui
     39        ui/VBoxAboutDlg.ui \
     40        ui/VBoxVMFirstRunWzd.ui
    4041
    4142IMAGES  = images/tpixel.png \
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h

    • Property svn:keywords set to Date Revision Author Id
    r868 r2864  
    4646    QUuid getBelongsTo();
    4747    void  setCurrentItem (const QUuid &);
     48    void  setType (int);
    4849
    4950protected slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r2835 r2864  
    3131#include "VBoxTakeSnapshotDlg.h"
    3232#include "VBoxDiskImageManagerDlg.h"
     33#include "VBoxVMFirstRunWzd.h"
    3334#include "VBoxSharedFoldersSettings.h"
    3435#include "VBoxUtils.h"
     
    190191
    191192    QString mTip;
    192 };
    193 
    194 /**
    195  *  Bootable CD/DVD ISO Selection Dialog class.
    196  *  Allows user to select temporarily mounted image or host drive
    197  *  to load the system from.
    198  */
    199 class BootDVDDialog : public QDialog
    200 {
    201     Q_OBJECT
    202 
    203 public:
    204 
    205     BootDVDDialog (QWidget *aParent, CMachine &aMachine)
    206         : QDialog (aParent, "BootDVDDialog", true /* modal */)
    207         , mMachine (aMachine)
    208         , mGrpBox (0)
    209         , mRbHost (0), mRbImage (0)
    210         , mCbHost (0), mCbImage (0)
    211         , mTbVDM (0), mPbOk (0)
    212     {
    213         /* Setup Dialog's title */
    214         setCaption (tr ("Select Boot Source"));
    215         setIcon (QPixmap::fromMimeSource ("select_file_16px.png"));
    216 
    217         /* Setup main group-box */
    218         mGrpBox = new QButtonGroup (this, "mGrpBox");
    219         mGrpBox->setCheckable (true);
    220         mGrpBox->setChecked (false);
    221         mGrpBox->setColumnLayout (0, Qt::Vertical);
    222         mGrpBox->setTitle (tr ("&Mount CD/DVD Drive"));
    223         mGrpBox->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
    224         connect (mGrpBox, SIGNAL (toggled (bool)), this, SLOT (grpBoxToggled (bool)));
    225 
    226         /* Setup group box widgets */
    227         mRbHost = new QRadioButton (tr ("Host CD/DVD &Drive"), mGrpBox, "mRbHost");
    228         connect (mRbHost,  SIGNAL (clicked()), this, SLOT (rbClicked()));
    229         mCbHost = new QComboBox (mGrpBox, "mCbHost");
    230         CHostDVDDriveCollection coll = vboxGlobal().virtualBox().GetHost().GetDVDDrives();
    231         mHostDVDs.resize (coll.GetCount());
    232         int id = 0;
    233         CHostDVDDriveEnumerator en = coll.Enumerate();
    234         while (en.HasMore())
    235         {
    236             CHostDVDDrive hostDVD = en.GetNext();
    237             mCbHost->insertItem (hostDVD.GetName(), id);
    238             mHostDVDs [id] = hostDVD;
    239             ++ id;
    240         }
    241 
    242         mRbImage = new QRadioButton (tr ("&ISO Image File"), mGrpBox, "mRbImage");
    243         connect (mRbImage, SIGNAL (clicked()), this, SLOT (rbClicked()));
    244         mCbImage = new VBoxMediaComboBox (mGrpBox, "sel", VBoxDefs::CD);
    245         if (!vboxGlobal().isMediaEnumerationStarted())
    246             vboxGlobal().startEnumeratingMedia();
    247         else
    248             mCbImage->refresh();
    249         mTbVDM = new QToolButton (mGrpBox, "mTbVDM");
    250         mTbVDM->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
    251                                                  "select_file_dis_16px.png"));
    252         mTbVDM->setFocusPolicy (QWidget::TabFocus);
    253         connect (mTbVDM, SIGNAL (clicked()), this, SLOT (vdmOpen()));
    254 
    255         /* Setup group box layout */
    256         QGridLayout *grbLayout = new QGridLayout (mGrpBox->layout(), 2, 3, 10, "grbLayout");
    257         grbLayout->addWidget (mRbHost, 0, 0);
    258         grbLayout->addWidget (mCbHost, 0, 1);
    259         grbLayout->addWidget (mRbImage, 1, 0);
    260         grbLayout->addWidget (mCbImage, 1, 1);
    261         grbLayout->addWidget (mTbVDM, 1, 2);
    262 
    263         /* Setup dialog buttons */
    264         mPbOk = new QPushButton (tr ("OK"), this, "mPbOk");
    265         QSpacerItem *spacer = new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
    266         QPushButton *pbCancel = new QPushButton (tr ("Cancel"), this, "pbCancel");
    267         connect (mPbOk, SIGNAL (clicked()), this, SLOT (accept()));
    268         connect (pbCancel, SIGNAL (clicked()), this, SLOT (reject()));
    269 
    270         /* Setup main layout */
    271         QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout");
    272         mainLayout->addWidget (mGrpBox);
    273         QSpacerItem *btSpacer =
    274             new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    275         mainLayout->addItem (btSpacer);
    276 
    277         /* Setup buttons layout */
    278         QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout");
    279         buttonLayout->addWidget (mPbOk);
    280         buttonLayout->addItem (spacer);
    281         buttonLayout->addWidget (pbCancel);
    282     }
    283 
    284 private slots:
    285 
    286     void grpBoxToggled (bool aOn)
    287     {
    288         if (aOn)
    289             mRbHost->animateClick();
    290         else
    291         {
    292             mRbHost->setChecked (false);
    293             mRbImage->setChecked (false);
    294             validate();
    295         }
    296     }
    297 
    298     void rbClicked()
    299     {
    300         mCbHost->setEnabled (sender() == mRbHost);
    301         mCbImage->setEnabled (sender() == mRbImage);
    302         mTbVDM->setEnabled (sender() == mRbImage);
    303         validate();
    304     }
    305 
    306     void vdmOpen()
    307     {
    308         VBoxDiskImageManagerDlg vdm (this, "VBoxDiskImageManagerDlg",
    309                                      WType_Dialog | WShowModal);
    310                 QUuid machineId = mMachine.GetId();
    311         vdm.setup (VBoxDefs::CD, true, &machineId);
    312         if (vdm.exec() == VBoxDiskImageManagerDlg::Accepted)
    313             mCbImage->setCurrentItem (vdm.getSelectedUuid());
    314     }
    315 
    316     void accept()
    317     {
    318         if (mGrpBox->isChecked() && mRbHost->isChecked())
    319         {
    320             CHostDVDDrive hostDrive = mHostDVDs [mCbHost->currentItem()];
    321             if (!hostDrive.isNull())
    322             {
    323                 CDVDDrive virtualDrive = mMachine.GetDVDDrive();
    324                 virtualDrive.CaptureHostDrive (hostDrive);
    325             }
    326         }
    327         else if (mGrpBox->isChecked() && mRbImage->isChecked())
    328         {
    329             CDVDDrive virtualDrive = mMachine.GetDVDDrive();
    330             virtualDrive.MountImage (mCbImage->getId());
    331         }
    332 
    333         QDialog::accept();
    334     }
    335 
    336 private:
    337 
    338     void validate()
    339     {
    340         bool valid =
    341             !mGrpBox->isChecked() ||
    342             (mGrpBox->isChecked() && mRbHost->isChecked()
    343              && !mCbHost->currentText().isEmpty()) ||
    344             (mGrpBox->isChecked() && mRbImage->isChecked()
    345              && !mCbImage->currentText().isEmpty());
    346         mPbOk->setEnabled (valid);
    347     }
    348 
    349     CMachine mMachine;
    350     QButtonGroup *mGrpBox;
    351     QRadioButton *mRbHost, *mRbImage;
    352     QComboBox *mCbHost;
    353     VBoxMediaComboBox *mCbImage;
    354     QToolButton *mTbVDM;
    355     QPushButton *mPbOk;
    356     QValueVector <CHostDVDDrive> mHostDVDs;
    357193};
    358194
     
    392228    , was_max (false)
    393229    , console_style (0)
    394     , mIsFirstTimeStarted (true)
     230    , mIsFirstTimeStarted (false)
    395231#ifdef VBOX_WITH_DEBUGGER_GUI
    396232    , dbg_gui (NULL)
     
    843679static const char *GUI_Fullscreen = "GUI/Fullscreen";
    844680static const char *GUI_AutoresizeGuest = "GUI/AutoresizeGuest";
    845 static const char *GUI_FirstRun = "GUI/FirstRun";
     681extern const char *GUI_FirstRun = "GUI/FirstRun";
    846682
    847683/**
     
    897733
    898734        str = cmachine.GetExtraData (GUI_FirstRun);
    899         if (str == "no")
    900             mIsFirstTimeStarted = false;
     735        if (str == "yes")
     736            mIsFirstTimeStarted = true;
     737        else if (!str.isEmpty())
     738            cmachine.SetExtraData (GUI_FirstRun, QString::null);
    901739
    902740        str = cmachine.GetExtraData (GUI_LastWindowPosition);
     
    1070908    if (mIsFirstTimeStarted)
    1071909    {
    1072         BootDVDDialog dlg (this, cmachine);
    1073         dlg.exec();
     910        VBoxVMFirstRunWzd wzd (this, "VBoxVMFirstRunWzd");
     911        wzd.setup (cmachine);
     912        wzd.exec();
    1074913    }
    1075914
     
    11751014        machine.SetExtraData (GUI_AutoresizeGuest,
    11761015                              vmAutoresizeGuestAction->isOn() ? "on" : "off");
    1177         machine.SetExtraData (GUI_FirstRun, "no");
    11781016    }
    11791017
     
    28992737    VBoxGlobal::centerWidget (this, parentWidget());
    29002738}
    2901 
    2902 #include "VBoxConsoleWnd.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp

    • Property svn:keywords set to Date Revision Author Id
    r1381 r2864  
    293293    }
    294294}
     295
     296void VBoxMediaComboBox::setType (int aType)
     297{
     298    mType = aType;
     299}
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h

    r2593 r2864  
    3333*****************************************************************************/
    3434
     35extern const char *GUI_FirstRun;
     36
    3537/**
    3638 *  Calculates a suitable page step size for the given max value.
     
    313315            return false;
    314316        }
     317        cmachine.SetExtraData (GUI_FirstRun, "yes");
    315318    }
    316319
Note: See TracChangeset for help on using the changeset viewer.

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