VirtualBox

Changeset 18080 in vbox


Ignore:
Timestamp:
Mar 18, 2009 9:38:05 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: 3734: New VM wizard: HDD selection - implemented.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewVMWzd.h

    r16867 r18080  
    5050    void accept();
    5151    void showMediaManager();
    52     void showNewHDWizard();
    5352    void onOSTypeChanged();
    5453    void slRAMValueChanged (int aValue);
    5554    void leRAMTextChanged (const QString &aTtext);
     55    void hdTypeChanged();
    5656    void revalidate (QIWidgetValidator *aWval);
    5757    void enableNext (const QIWidgetValidator *aWval);
    5858    void onPageShow();
     59    void showBackPage();
    5960    void showNextPage();
    6061
    6162private:
    6263
     64    bool showNewHDWizard();
    6365    bool constructMachine();
    6466    void ensureNewHardDiskDeleted();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewVMWzd.cpp

    r17943 r18080  
    8888
    8989    /* HDD Images page */
     90    QStyleOptionButton options;
     91    options.initFrom (mNewVDIRadio);
     92    QGridLayout *hdLayout = qobject_cast <QGridLayout*> (mGbHDA->layout());
     93    int wid = mNewVDIRadio->style()->subElementRect (QStyle::SE_RadioButtonIndicator, &options, mNewVDIRadio).width() +
     94              mNewVDIRadio->style()->pixelMetric (QStyle::PM_RadioButtonLabelSpacing, &options, mNewVDIRadio) -
     95              hdLayout->spacing() - 1;
     96    QSpacerItem *spacer = new QSpacerItem (wid, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
     97    hdLayout->addItem (spacer, 2, 0);
    9098    mHDCombo->setType (VBoxDefs::MediaType_HardDisk);
    9199    mHDCombo->repopulate();
     100    mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png",
     101                                          ":/select_file_dis_16px.png"));
    92102
    93103    mWvalHDD = new QIWidgetValidator (mPageHDD, this);
     
    97107             this, SLOT (revalidate (QIWidgetValidator*)));
    98108    connect (mGbHDA, SIGNAL (toggled (bool)), mWvalHDD, SLOT (revalidate()));
     109    connect (mNewVDIRadio, SIGNAL (toggled (bool)), this, SLOT (hdTypeChanged()));
     110    connect (mExistRadio, SIGNAL (toggled (bool)), this, SLOT (hdTypeChanged()));
    99111    connect (mHDCombo, SIGNAL (currentIndexChanged (int)),
    100112             mWvalHDD, SLOT (revalidate()));
    101     connect (mPbNewHD, SIGNAL (clicked()), this, SLOT (showNewHDWizard()));
    102     connect (mPbExistingHD, SIGNAL (clicked()), this, SLOT (showMediaManager()));
     113    connect (mTbVmm, SIGNAL (clicked()), this, SLOT (showMediaManager()));
    103114
    104115    /* Name and OS page */
     
    107118    /* Memory page */
    108119    slRAMValueChanged (mSlRAM->value());
     120
     121    /* HDD Images page */
     122    hdTypeChanged();
    109123
    110124    /* Initial revalidation */
     
    201215}
    202216
    203 void VBoxNewVMWzd::showNewHDWizard()
    204 {
    205     VBoxNewHDWzd dlg (this);
    206 
    207     dlg.setRecommendedFileName (mLeName->text());
    208     dlg.setRecommendedSize (mOSTypeSelector->type().GetRecommendedHDD());
    209 
    210     if (dlg.exec() == QDialog::Accepted)
    211     {
    212         ensureNewHardDiskDeleted();
    213         mHardDisk = dlg.hardDisk();
    214         mHDCombo->setCurrentItem (mHardDisk.GetId());
    215     }
    216 
    217     mHDCombo->setFocus();
    218 }
    219 
    220217void VBoxNewVMWzd::onOSTypeChanged()
    221218{
     
    231228{
    232229    mSlRAM->setValue (aText.toInt());
     230}
     231
     232void VBoxNewVMWzd::hdTypeChanged()
     233{
     234    mHDCombo->setEnabled (mExistRadio->isChecked());
     235    mTbVmm->setEnabled (mExistRadio->isChecked());
     236    if (mExistRadio->isChecked())
     237        mHDCombo->setFocus();
    233238}
    234239
     
    287292}
    288293
     294void VBoxNewVMWzd::showBackPage()
     295{
     296    /* Delete temporary HD if present */
     297    if (sender() == mBtnBack5)
     298        ensureNewHardDiskDeleted();
     299
     300    /* Switch to the back page */
     301    QIAbstractWizard::showBackPage();
     302}
     303
    289304void VBoxNewVMWzd::showNextPage()
    290305{
     
    294309        return;
    295310
     311    /* Show the New Hard Disk wizard */
     312    if (sender() == mBtnNext4 && mNewVDIRadio->isChecked() &&
     313        !showNewHDWizard())
     314        return;
     315
    296316    /* Switch to the next page */
    297317    QIAbstractWizard::showNextPage();
    298318}
    299319
     320
     321bool VBoxNewVMWzd::showNewHDWizard()
     322{
     323    VBoxNewHDWzd dlg (this);
     324
     325    dlg.setRecommendedFileName (mLeName->text());
     326    dlg.setRecommendedSize (mOSTypeSelector->type().GetRecommendedHDD());
     327
     328    if (dlg.exec() == QDialog::Accepted)
     329    {
     330        ensureNewHardDiskDeleted();
     331        mHardDisk = dlg.hardDisk();
     332        mHDCombo->setCurrentItem (mHardDisk.GetId());
     333        return true;
     334    }
     335
     336    return false;
     337}
    300338
    301339bool VBoxNewVMWzd::constructMachine()
     
    360398        {
    361399            CMachine m = session.GetMachine();
    362             m.AttachHardDisk(mHDCombo->id(), QString("IDE"), 0, 0);
     400            m.AttachHardDisk (mHDCombo->id(), QString("IDE"), 0, 0);
    363401            if (m.isOk())
    364402            {
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui

    r14437 r18080  
    824824             </property>
    825825             <layout class="QGridLayout" >
    826               <property name="topMargin" >
    827                <number>4</number>
    828               </property>
    829               <item row="1" column="0" >
    830                <widget class="QPushButton" name="mPbNewHD" >
     826              <item row="0" column="0" colspan="3" >
     827               <widget class="QRadioButton" name="mNewVDIRadio" >
    831828                <property name="text" >
    832                  <string>N&amp;ew...</string>
     829                 <string>&amp;Create new hard disk</string>
     830                </property>
     831                <property name="checked">
     832                 <bool>true</bool>
    833833                </property>
    834834               </widget>
    835835              </item>
    836               <item row="1" column="1" >
    837                <widget class="QPushButton" name="mPbExistingHD" >
     836              <item row="1" column="0" colspan="3" >
     837               <widget class="QRadioButton" name="mExistRadio" >
    838838                <property name="text" >
    839                  <string>E&amp;xisting...</string>
     839                 <string>&amp;Use existing hard disk</string>
    840840                </property>
    841841               </widget>
    842842              </item>
    843               <item row="1" column="2" >
    844                <spacer>
    845                 <property name="orientation" >
    846                  <enum>Qt::Horizontal</enum>
    847                 </property>
    848                 <property name="sizeHint" >
    849                  <size>
    850                   <width>0</width>
    851                   <height>0</height>
    852                  </size>
    853                 </property>
    854                </spacer>
    855               </item>
    856               <item row="0" column="0" colspan="3" >
     843              <item row="2" column="1" >
    857844               <widget class="VBoxMediaComboBox" name="mHDCombo" >
    858845                <property name="sizePolicy" >
     
    861848                  <verstretch>0</verstretch>
    862849                 </sizepolicy>
     850                </property>
     851               </widget>
     852              </item>
     853              <item row="2" column="2" >
     854               <widget class="QToolButton" name="mTbVmm" >
     855                <property name="autoRaise" >
     856                 <bool>true</bool>
    863857                </property>
    864858               </widget>
     
    11991193  <tabstop>mBtnNext3</tabstop>
    12001194  <tabstop>mBtnCancel3</tabstop>
     1195  <tabstop>mNewVDIRadio</tabstop>
     1196  <tabstop>mExistRadio</tabstop>
    12011197  <tabstop>mHDCombo</tabstop>
    1202   <tabstop>mPbNewHD</tabstop>
    1203   <tabstop>mPbExistingHD</tabstop>
     1198  <tabstop>mTbVmm</tabstop>
    12041199  <tabstop>mBtnBack4</tabstop>
    12051200  <tabstop>mBtnNext4</tabstop>
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