VirtualBox

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


Ignore:
Timestamp:
Oct 6, 2009 3:56:51 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: Adapting 'New VM Wizard' & 'First Run Wizard' to new [Main] capabilities (multi-storage controllers support); Updating tool-tip for null medium items.

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

Legend:

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

    r23223 r23585  
    186186    VBoxMedium &root() const;
    187187
    188     QString toolTip (bool aNoDiffs = false, bool aCheckRO = false) const;
     188    QString toolTip (bool aNoDiffs = false, bool aCheckRO = false, bool aNullAllowed = false) const;
    189189    QPixmap icon (bool aNoDiffs = false, bool aCheckRO = false) const;
    190190
    191191    /** Shortcut to <tt>#toolTip (aNoDiffs, true)</tt>. */
    192     QString toolTipCheckRO (bool aNoDiffs = false) const { return toolTip (aNoDiffs, true); }
     192    QString toolTipCheckRO (bool aNoDiffs = false, bool aNullAllowed = false) const { return toolTip (aNoDiffs, true, aNullAllowed); }
    193193
    194194    /** Shortcut to <tt>#icon (aNoDiffs, true)</tt>. */
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r23223 r23585  
    250250                                      const CMedium &aHD,
    251251                                      const CProgress &aProgress);
    252     void cannotAttachHardDisk (QWidget *aParent, const CMachine &aMachine,
    253                                const QString &aLocation, KStorageBus aBus,
    254                                LONG aChannel, LONG aDevice);
    255     void cannotDetachHardDisk (QWidget *aParent, const CMachine &aMachine,
    256                                const QString &aLocation, KStorageBus aBus,
    257                                LONG aChannel, LONG aDevice);
    258 
    259     void cannotMountMedium (QWidget *aParent, const CMachine &aMachine,
    260                             const VBoxMedium &aMedium, const COMResult &aResult);
    261     void cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine,
    262                             const VBoxMedium &aMedium, const COMResult &aResult);
     252    void cannotAttachDevice (QWidget *aParent, const CMachine &aMachine,
     253                             VBoxDefs::MediumType aType, const QString &aLocation,
     254                             KStorageBus aBus, LONG aChannel, LONG aDevice);
     255    void cannotDetachDevice (QWidget *aParent, const CMachine &aMachine,
     256                             VBoxDefs::MediumType aType, const QString &aLocation,
     257                             KStorageBus aBus, LONG aChannel, LONG aDevice);
     258
     259    void cannotMountMedium (QWidget *aParent, const CMachine &aMachine, const VBoxMedium &aMedium);
     260    void cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine, const VBoxMedium &aMedium);
    263261    void cannotOpenMedium (QWidget *aParent, const CVirtualBox &aVBox,
    264262                           VBoxDefs::MediumType aType, const QString &aLocation);
     
    358356                           const QString &errorMsg) const;
    359357
    360     static QString toAccusative (VBoxDefs::MediumType aType);
     358    static QString mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive = false);
     359    static QString deviceToAccusative (VBoxDefs::MediumType aType);
    361360
    362361    static QString formatRC (HRESULT aRC);
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMFirstRunWzd.h

    r23223 r23585  
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424#define __VBoxVMFirstRunWzd_h__
    2525
     26/* Local includes */
    2627#include "QIAbstractWizard.h"
    2728#include "VBoxVMFirstRunWzd.gen.h"
    2829#include "COMDefs.h"
    29 #include "QIWidgetValidator.h"
    3030#include "QIWithRetranslateUI.h"
    3131
    32 class VBoxVMFirstRunWzd : public QIWithRetranslateUI<QIAbstractWizard>,
     32/* Local forwardes */
     33class QIWidgetValidator;
     34
     35class VBoxVMFirstRunWzd : public QIWithRetranslateUI <QIAbstractWizard>,
    3336                          public Ui::VBoxVMFirstRunWzd
    3437{
     
    4649
    4750    void accept();
    48     void revalidate (QIWidgetValidator *aWval);
     51    void revalidate (QIWidgetValidator *aValidator);
    4952    void mediaTypeChanged();
    50     void mediaSourceChanged();
    5153    void openMediaManager();
    52     void enableNext (const QIWidgetValidator *aWval);
     54    void enableNext (const QIWidgetValidator *aValidator);
    5355    void onPageShow();
    5456
    5557private:
    5658
    57     QIWidgetValidator         *mWvalType;
    58     CMachine                   mMachine;
    59     QVector <CMedium>          mHostDVDs;
    60     QVector <CMedium>          mHostFloppys;
     59    QIWidgetValidator *mValidator;
     60    CMachine           mMachine;
    6161};
    6262
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp

    r23238 r23585  
    295295
    296296    mMedia.append (Medium (aMedium.id(), aMedium.location(),
    297                            aMedium.toolTipCheckRO (!mShowDiffs)));
     297                           aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != VBoxDefs::MediumType_HardDisk)));
    298298
    299299    insertItem (count(), aMedium.iconCheckRO (!mShowDiffs),
     
    307307    mMedia [aIndex].id = aMedium.id();
    308308    mMedia [aIndex].location = aMedium.location();
    309     mMedia [aIndex].toolTip = aMedium.toolTipCheckRO (!mShowDiffs);
     309    mMedia [aIndex].toolTip = aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != VBoxDefs::MediumType_HardDisk);
    310310
    311311    setItemText (aIndex, aMedium.details (!mShowDiffs));
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp

    r23282 r23585  
    12711271                        CStorageController ctl = machine.GetStorageControllerByName(hda.GetController());
    12721272
    1273                         vboxProblem().cannotDetachHardDisk (
    1274                             this, machine, aMedium.location(), ctl.GetBus(),
    1275                             hda.GetPort(), hda.GetDevice());
     1273                        vboxProblem().cannotDetachDevice (this, machine,
     1274                            VBoxDefs::MediumType_HardDisk, aMedium.location(),
     1275                            ctl.GetBus(), hda.GetPort(), hda.GetDevice());
    12761276                        success = false;
    12771277                        break;
     
    12861286            if (!machine.isOk())
    12871287            {
    1288                 vboxProblem().cannotUnmountMedium (this, machine, aMedium,
    1289                                                    COMResult (machine));
     1288                vboxProblem().cannotUnmountMedium (this, machine, aMedium);
    12901289                success = false;
    12911290            }
     
    12971296            if (!machine.isOk())
    12981297            {
    1299                 vboxProblem().cannotUnmountMedium (this, machine, aMedium,
    1300                                                    COMResult (machine));
     1298                vboxProblem().cannotUnmountMedium (this, machine, aMedium);
    13011299                success = false;
    13021300            }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.cpp

    r23238 r23585  
    7979    mIsHostDrive = mMedium.isNull() ? false : mMedium.GetHostDrive();
    8080
    81     mName = mMedium.isNull() ? VBoxGlobal::tr ("Not Set", "medium") :
     81    mName = mMedium.isNull() ? VBoxGlobal::tr ("Empty", "medium") :
    8282            !mIsHostDrive ? mMedium.GetName() :
    8383            VBoxGlobal::tr ("Host Drive '%1'", "medium").arg (QDir::toNativeSeparators (mMedium.GetLocation()));
     
    195195
    196196    /* Compose the tooltip */
    197     if (mMedium.isNull())
    198     {
    199         mToolTip = VBoxGlobal::tr ("<nobr><b>No&nbsp;Medium&nbsp;Available</b></nobr><br>"
    200                                    "Use the Virtual Media Manager to add medium of the corresponding type.");
    201     }
    202     else
     197    if (!mMedium.isNull())
    203198    {
    204199        mToolTip = QString ("<nobr><b>%1</b></nobr>").arg (mIsHostDrive ? mName : mLocation);
     
    274269 *                  accordingly.
    275270 */
    276 QString VBoxMedium::toolTip (bool aNoDiffs /*= false*/, bool aCheckRO /*= false*/) const
    277 {
    278     unconst (this)->checkNoDiffs (aNoDiffs);
    279 
    280     QString tip = aNoDiffs ? mNoDiffs.toolTip : mToolTip;
    281 
    282     if (aCheckRO && mIsReadOnly)
    283         tip += VBoxGlobal::tr (
    284             "<hr><img src=%1/>&nbsp;Attaching this hard disk will "
    285             "be performed indirectly using a newly created "
    286             "differencing hard disk.", "medium").arg (":/new_16px.png");
     271QString VBoxMedium::toolTip (bool aNoDiffs /*= false*/, bool aCheckRO /*= false*/, bool aNullAllowed /*= false*/) const
     272{
     273    QString tip;
     274
     275    if (mMedium.isNull())
     276    {
     277        tip = aNullAllowed ? VBoxGlobal::tr ("<nobr><b>Not&nbsp;Set</b></nobr><br>"
     278                                             "Required virtual image or host-drive could be mounted at runtime.") :
     279                             VBoxGlobal::tr ("<nobr><b>Not&nbsp;Available</b></nobr><br>"
     280                                             "Use the Virtual Media Manager to add image of the corresponding type.");
     281    }
     282    else
     283    {
     284        unconst (this)->checkNoDiffs (aNoDiffs);
     285
     286        tip = aNoDiffs ? mNoDiffs.toolTip : mToolTip;
     287
     288        if (aCheckRO && mIsReadOnly)
     289            tip += VBoxGlobal::tr ("<hr><img src=%1/>&nbsp;Attaching this hard disk will "
     290                                   "be performed indirectly using a newly created "
     291                                   "differencing hard disk.", "medium").arg (":/new_16px.png");
     292    }
    287293
    288294    return tip;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewVMWzd.cpp

    r23249 r23585  
    352352    }
    353353
     354    /* Create default storage controllers */
     355    QString ideCtrName ("IDE Controller");
     356    QString floppyCtrName ("Floppy Controller");
     357    KStorageBus ideBus = KStorageBus_IDE;
     358    KStorageBus floppyBus = KStorageBus_Floppy;
     359    mMachine.AddStorageController (ideCtrName, ideBus);
     360    mMachine.AddStorageController (floppyCtrName, floppyBus);
     361
    354362    /* Register the VM prior to attaching hard disks */
    355363    vbox.RegisterMachine (mMachine);
     
    360368    }
    361369
    362     /* Boot hard disk (IDE Primary Master) */
    363     if (mGbHDA->isChecked())
     370    /* Attach default devices */
    364371    {
    365372        bool success = false;
     
    369376        {
    370377            CMachine m = session.GetMachine();
    371             m.AttachDevice ("IDE Controller", 0, 0, KDeviceType_HardDisk, mHDCombo->id());
     378
     379            /* Boot hard disk (IDE Primary Master) */
     380            if (mGbHDA->isChecked())
     381            {
     382                m.AttachDevice (ideCtrName, 0, 0, KDeviceType_HardDisk, mHDCombo->id());
     383                if (!m.isOk())
     384                    vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_HardDisk, mHDCombo->location(), ideBus, 0, 0);
     385            }
     386
     387            /* Attach empty CD/DVD ROM Device */
     388            m.AttachDevice (ideCtrName, 1, 0, KDeviceType_DVD, QString());
     389            if (!m.isOk())
     390                vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_DVD, QString(), ideBus, 1, 0);
     391
     392            /* Attach empty Floppy Device */
     393            m.AttachDevice (floppyCtrName, 0, 0, KDeviceType_Floppy, QString());
     394            if (!m.isOk())
     395                vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_Floppy, QString(), floppyBus, 0, 0);
     396
    372397            if (m.isOk())
    373398            {
     
    378403                    vboxProblem().cannotSaveMachineSettings (m, this);
    379404            }
    380             else
    381                 vboxProblem().cannotAttachHardDisk (this, m,
    382                                                     mHDCombo->location(),
    383                                                     KStorageBus_IDE, 0, 0);
     405
    384406            session.Close();
    385407        }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r23438 r23585  
    993993            "<p>This will detach it from the "
    994994            "following virtual machine(s): <b>%3</b>.</p>")
    995             .arg (toAccusative (aMedium.type()))
     995            .arg (mediumToAccusative (aMedium.type()))
    996996            .arg (aMedium.location())
    997997            .arg (aUsage),
     
    10081008        tr ("<p>Are you sure you want to remove the %1 "
    10091009            "<nobr><b>%2</b></nobr> from the list of known media?</p>")
    1010             .arg (toAccusative (aMedium.type()))
     1010            .arg (mediumToAccusative (aMedium.type()))
    10111011            .arg (aMedium.location());
    10121012
     
    11531153}
    11541154
    1155 void VBoxProblemReporter::cannotAttachHardDisk (
    1156     QWidget *aParent, const CMachine &aMachine, const QString &aLocation,
    1157     KStorageBus aBus, LONG aChannel, LONG aDevice)
    1158 {
     1155void VBoxProblemReporter::cannotAttachDevice (QWidget *aParent, const CMachine &aMachine,
     1156                                              VBoxDefs::MediumType aType, const QString &aLocation,
     1157                                              KStorageBus aBus, LONG aChannel, LONG aDevice)
     1158{
     1159    QString what (deviceToAccusative (aType));
     1160    if (!aLocation.isNull())
     1161        what += QString (" (<nobr><b>%1</b></nobr>)").arg (aLocation);
     1162
    11591163    message (aParent, Error,
    1160         tr ("Failed to attach the hard disk <nobr><b>%1</b></nobr> "
    1161             "to the slot <i>%2</i> of the machine <b>%3</b>.")
    1162             .arg (aLocation)
    1163             .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice)))
    1164             .arg (CMachine (aMachine).GetName()),
    1165         formatErrorInfo (aMachine));
    1166 }
    1167 
    1168 void VBoxProblemReporter::cannotDetachHardDisk (
    1169     QWidget *aParent, const CMachine &aMachine, const QString &aLocation,
    1170     KStorageBus aBus, LONG aChannel, LONG aDevice)
    1171 {
     1164             tr ("Failed to attach the %1 to the slot <i>%2</i> of the machine <b>%3</b>.")
     1165                 .arg (what)
     1166                 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice)))
     1167                 .arg (CMachine (aMachine).GetName()),
     1168             formatErrorInfo (aMachine));
     1169}
     1170
     1171void VBoxProblemReporter::cannotDetachDevice (QWidget *aParent, const CMachine &aMachine,
     1172                                              VBoxDefs::MediumType aType, const QString &aLocation,
     1173                                              KStorageBus aBus, LONG aChannel, LONG aDevice)
     1174{
     1175    QString what (deviceToAccusative (aType));
     1176    if (!aLocation.isNull())
     1177        what += QString (" (<nobr><b>%1</b></nobr>)").arg (aLocation);
     1178
    11721179    message (aParent, Error,
    1173         tr ("Failed to detach the hard disk <nobr><b>%1</b></nobr> "
    1174             "from the slot <i>%2</i> of the machine <b>%3</b>.")
    1175             .arg (aLocation)
    1176             .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice)))
    1177             .arg (CMachine (aMachine).GetName()),
    1178          formatErrorInfo (aMachine));
    1179 }
    1180 
    1181 void VBoxProblemReporter::
    1182 cannotMountMedium (QWidget *aParent, const CMachine &aMachine,
    1183                    const VBoxMedium &aMedium, const COMResult &aResult)
     1180             tr ("Failed to detach the $1 from the slot <i>%2</i> of the machine <b>%3</b>.")
     1181                 .arg (what)
     1182                 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice)))
     1183                 .arg (CMachine (aMachine).GetName()),
     1184             formatErrorInfo (aMachine));
     1185}
     1186
     1187void VBoxProblemReporter::cannotMountMedium (QWidget *aParent, const CMachine &aMachine,
     1188                                             const VBoxMedium &aMedium)
    11841189{
    11851190    /** @todo (translation-related): the gender of "the" in translations
    11861191     * will depend on the gender of aMedium.type(). */
    11871192    message (aParent, Error,
    1188         tr ("Failed to mount the %1 <nobr><b>%2</b></nobr> "
    1189             "to the machine <b>%3</b>.")
    1190             .arg (toAccusative (aMedium.type()))
    1191             .arg (aMedium.location())
    1192             .arg (CMachine (aMachine).GetName()),
    1193       formatErrorInfo (aResult));
    1194 }
    1195 
    1196 void VBoxProblemReporter::
    1197 cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine,
    1198                      const VBoxMedium &aMedium, const COMResult &aResult)
     1193             tr ("Failed to mount the %1 <nobr><b>%2</b></nobr> "
     1194                 "to the machine <b>%3</b>.")
     1195                 .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive()))
     1196                 .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
     1197                 .arg (CMachine (aMachine).GetName()),
     1198             formatErrorInfo (aMachine));
     1199}
     1200
     1201void VBoxProblemReporter::cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine,
     1202                                               const VBoxMedium &aMedium)
    11991203{
    12001204    /** @todo (translation-related): the gender of "the" in translations
    12011205     * will depend on the gender of aMedium.type(). */
    12021206    message (aParent, Error,
    1203         tr ("Failed to unmount the %1 <nobr><b>%2</b></nobr> "
    1204             "from the machine <b>%3</b>.")
    1205             .arg (toAccusative (aMedium.type()))
    1206             .arg (aMedium.location())
    1207             .arg (CMachine (aMachine).GetName()),
    1208       formatErrorInfo (aResult));
     1207             tr ("Failed to unmount the %1 <nobr><b>%2</b></nobr> "
     1208                 "from the machine <b>%3</b>.")
     1209                 .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive()))
     1210                 .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
     1211                 .arg (CMachine (aMachine).GetName()),
     1212             formatErrorInfo (aMachine));
    12091213}
    12101214
     
    12171221    message (aParent, Error,
    12181222        tr ("Failed to open the %1 <nobr><b>%2</b></nobr>.")
    1219             .arg (toAccusative (aType))
     1223            .arg (mediumToAccusative (aType))
    12201224            .arg (aLocation),
    12211225        formatErrorInfo (aVBox));
     
    12291233    message (aParent, Error,
    12301234        tr ("Failed to close the %1 <nobr><b>%2</b></nobr>.")
    1231             .arg (toAccusative (aMedium.type()))
     1235            .arg (mediumToAccusative (aMedium.type()))
    12321236            .arg (aMedium.location()),
    12331237        formatErrorInfo (aResult));
     
    21872191
    21882192/* static */
    2189 QString VBoxProblemReporter::toAccusative (VBoxDefs::MediumType aType)
     2193QString VBoxProblemReporter::mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive /* = false */)
    21902194{
    21912195    QString type =
    21922196        aType == VBoxDefs::MediumType_HardDisk ?
    2193             tr ("hard disk", "failed to close ...") :
     2197            tr ("hard disk", "failed to mount ...") :
     2198        aType == VBoxDefs::MediumType_DVD && aIsHostDrive ?
     2199            tr ("CD/DVD", "failed to mount ... host-drive") :
     2200        aType == VBoxDefs::MediumType_DVD && !aIsHostDrive ?
     2201            tr ("CD/DVD image", "failed to mount ...") :
     2202        aType == VBoxDefs::MediumType_Floppy && aIsHostDrive ?
     2203            tr ("floppy", "failed to mount ... host-drive") :
     2204        aType == VBoxDefs::MediumType_Floppy && !aIsHostDrive ?
     2205            tr ("floppy image", "failed to mount ...") :
     2206        QString::null;
     2207
     2208    Assert (!type.isNull());
     2209    return type;
     2210}
     2211
     2212/* static */
     2213QString VBoxProblemReporter::deviceToAccusative (VBoxDefs::MediumType aType)
     2214{
     2215    QString type =
     2216        aType == VBoxDefs::MediumType_HardDisk ?
     2217            tr ("hard disk", "failed to attach ...") :
    21942218        aType == VBoxDefs::MediumType_DVD ?
    2195             tr ("CD/DVD image", "failed to close ...") :
     2219            tr ("CD/DVD device", "failed to attach ...") :
    21962220        aType == VBoxDefs::MediumType_Floppy ?
    2197             tr ("floppy image", "failed to close ...") :
     2221            tr ("floppy device", "failed to close ...") :
    21982222        QString::null;
    21992223
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r23285 r23585  
    917917                {
    918918                    CStorageController ctl = machine.GetStorageControllerByName(ctlName);
    919                     vboxProblem().cannotDetachHardDisk (this, machine,
     919                    vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk,
    920920                        vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(),
    921921                        ctl.GetBus(), hda.GetPort(), hda.GetDevice());
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp

    r23249 r23585  
    66
    77/*
    8  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121 */
    2222
     23/* Local includes */
    2324#include "VBoxVMFirstRunWzd.h"
    2425#include "VBoxGlobal.h"
     26#include "VBoxProblemReporter.h"
    2527#include "VBoxMediaManagerDlg.h"
     28#include "QIWidgetValidator.h"
    2629
    2730VBoxVMFirstRunWzd::VBoxVMFirstRunWzd (const CMachine &aMachine, QWidget *aParent)
    28     : QIWithRetranslateUI<QIAbstractWizard> (aParent)
     31    : QIWithRetranslateUI <QIAbstractWizard> (aParent)
     32    , mValidator (0)
    2933    , mMachine (aMachine)
    3034{
     
    3640
    3741    /* Hide unnecessary text labels */
    38     CMediumAttachmentVector vec = mMachine.GetMediumAttachments();
    39     if (vec.size() != 0)
    40     {
    41         mTextWelcome2->setHidden (true);
    42         mTextType2->setHidden (true);
    43         mTextSource2->setHidden (true);
    44         mTextSummaryHdr2->setHidden (true);
    45         mTextSummaryFtr2->setHidden (true);
    46     }
    47     else
    48     {
    49         mTextWelcome1->setHidden (true);
    50         mTextType1->setHidden (true);
    51         mTextSource1->setHidden (true);
    52         mTextSummaryHdr1->setHidden (true);
    53         mTextSummaryFtr1->setHidden (true);
    54     }
     42    CMediumAttachment hda = mMachine.GetMediumAttachment ("IDE Controller", 0, 0);
     43    mTextWelcome1->setHidden (hda.isNull());
     44    mTextType1->setHidden (hda.isNull());
     45    mTextSource1->setHidden (hda.isNull());
     46    mTextSummaryHdr1->setHidden (hda.isNull());
     47    mTextSummaryFtr1->setHidden (hda.isNull());
     48    mTextWelcome2->setHidden (!hda.isNull());
     49    mTextType2->setHidden (!hda.isNull());
     50    mTextSource2->setHidden (!hda.isNull());
     51    mTextSummaryHdr2->setHidden (!hda.isNull());
     52    mTextSummaryFtr2->setHidden (!hda.isNull());
    5553
    5654    /* Media page */
    57     mCbImage->setMachineId (mMachine.GetId());
    58     mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png",
    59                                           ":/select_file_dis_16px.png"));
    60     mWvalType = new QIWidgetValidator (mPageMedia, this);
    61     connect (mWvalType, SIGNAL (validityChanged (const QIWidgetValidator *)),
     55    mCbMedia->setMachineId (mMachine.GetId());
     56    mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", ":/select_file_dis_16px.png"));
     57    mValidator = new QIWidgetValidator (mPageMedia, this);
     58    connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator *)),
    6259             this, SLOT (enableNext (const QIWidgetValidator *)));
    63     connect (mWvalType, SIGNAL (isValidRequested (QIWidgetValidator *)),
     60    connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator *)),
    6461             this, SLOT (revalidate (QIWidgetValidator *)));
    6562    connect (mRbCdType, SIGNAL (clicked()), this, SLOT (mediaTypeChanged()));
    6663    connect (mRbFdType, SIGNAL (clicked()), this, SLOT (mediaTypeChanged()));
    67     connect (mRbHost, SIGNAL (clicked()), this, SLOT (mediaSourceChanged()));
    68     connect (mRbImage, SIGNAL (clicked()), this, SLOT (mediaSourceChanged()));
    6964    connect (mTbVmm, SIGNAL (clicked()), this, SLOT (openMediaManager()));
    7065    mRbCdType->animateClick();
    71     mRbHost->animateClick();
    7266
    73     /* Summary page */
    74     /* Update the next button state for pages with validation
    75      * (validityChanged() connected to enableNext() will do the job) */
    76     mWvalType->revalidate();
     67    /* Revalidate updated page */
     68    mValidator->revalidate();
    7769
    7870    /* Initialize wizard ftr */
     
    9183    if (page == mPageSummary)
    9284    {
    93         /* compose summary */
    94         QString type =
    95             mRbCdType->isChecked() ? tr ("CD/DVD-ROM Device") :
    96             mRbFdType->isChecked() ? tr ("Floppy Device") :
    97             QString::null;
    98         QString source =
    99             mRbHost->isChecked() ? tr ("Host Drive %1").arg (mCbHost->currentText()) :
    100             mRbImage->isChecked() ? mCbImage->currentText() : QString::null;
    101         QString summary = QString (
    102             "<table>"
    103             "<tr><td>%1:&nbsp;</td><td>%2</td></tr>"
    104             "<tr><td>%3:&nbsp;</td><td>%4</td></tr>"
    105             "</table>"
    106         )
    107             .arg (tr ("Type", "summary"), type)
    108             .arg (tr ("Source", "summary"), source);
    109 
     85        /* Compose Summary */
     86        QString type = mRbCdType->isChecked() ? tr ("CD/DVD-ROM Device") : tr ("Floppy Device");
     87        QString source = mCbMedia->currentText();
     88        QString summary = QString ("<table>"
     89                                   "<tr><td>%1:&nbsp;</td><td>%2</td></tr>"
     90                                   "<tr><td>%3:&nbsp;</td><td>%4</td></tr>"
     91                                   "</table>")
     92                                   .arg (tr ("Type", "summary"), type)
     93                                   .arg (tr ("Source", "summary"), source);
    11094        mTeSummary->setText (summary);
    11195    }
     
    11498void VBoxVMFirstRunWzd::accept()
    11599{
    116     /* CD/DVD Media selected */
    117     if (mRbCdType->isChecked())
    118     {
    119         if (mRbHost->isChecked())
    120         {
    121             CMedium hostDrive = mHostDVDs [mCbHost->currentIndex()];
    122             if (!hostDrive.isNull())
    123                 mMachine.MountMedium ("IDE Controller", 1, 0, hostDrive.GetId());
    124         }
    125         else if (mRbImage->isChecked())
    126             mMachine.MountMedium ("IDE Controller", 1, 0, mCbImage->id());
    127     }
    128     /* Floppy Media selected */
    129     else if (mRbFdType->isChecked())
    130     {
    131         if (mRbHost->isChecked())
    132         {
    133             CMedium hostDrive = mHostFloppys [mCbHost->currentIndex()];
    134             if (!hostDrive.isNull())
    135                 mMachine.MountMedium ("IDE Controller", 1, 0, hostDrive.GetId());
    136         }
    137         else if (mRbImage->isChecked())
    138             mMachine.MountMedium ("IDE Controller", 1, 0, mCbImage->id());
    139     }
    140 
    141     QIAbstractWizard::accept();
     100    /* Composing default controller name */
     101    QString ctrName (mRbCdType->isChecked() ? "IDE Controller" : "Floppy Controller");
     102    LONG ctrPort = mRbCdType->isChecked() ? 1 : 0;
     103    LONG ctrDevice = 0;
     104    /* Default should present */
     105    CStorageController ctr = mMachine.GetStorageControllerByName (ctrName);
     106    Assert (!ctr.isNull());
     107    /* Mount medium to the predefined port/device */
     108    mMachine.MountMedium (ctrName, ctrPort, ctrDevice, mCbMedia->id());
     109    if (mMachine.isOk())
     110        QIAbstractWizard::accept();
     111    else
     112        vboxProblem().cannotMountMedium (this, mMachine, vboxGlobal().findMedium (mCbMedia->id()));
    142113}
    143114
    144 void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *aWval)
     115void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *aValidator)
    145116{
    146     /* do individual validations for pages */
    147     QWidget *pg = aWval->widget();
    148     bool valid = aWval->isOtherValid();
     117    /* Do individual validations for pages */
     118    QWidget *pg = aValidator->widget();
     119    bool valid = aValidator->isOtherValid();
    149120
     121    /* Allow to go to Summary only if non-null medium selected */
    150122    if (pg == mPageMedia)
    151     {
    152         valid = (mRbHost->isChecked() && !mCbHost->currentText().isEmpty()) ||
    153                 (mRbImage->isChecked() && !mCbImage->currentText().isEmpty());
    154     }
     123        valid = !vboxGlobal().findMedium (mCbMedia->id()).isNull();
    155124
    156     aWval->setOtherValid (valid);
     125    aValidator->setOtherValid (valid);
    157126}
    158127
    159128void VBoxVMFirstRunWzd::mediaTypeChanged()
    160129{
    161     /* CD/DVD Media type selected */
    162     mCbHost->clear();
     130    /* CD/DVD media type selected */
    163131    if (sender() == mRbCdType)
    164132    {
    165         /* Search for the host dvd-drives */
    166         CMediumVector coll =
    167             vboxGlobal().virtualBox().GetHost().GetDVDDrives();
    168         mHostDVDs.resize (coll.size());
    169 
    170         for (int id = 0; id < coll.size(); ++id)
    171         {
    172             CMedium hostDVD = coll[id];
    173             QString name = hostDVD.GetName();
    174             QString description = hostDVD.GetDescription();
    175             QString fullName = description.isEmpty() ?
    176                 name : QString ("%1 (%2)").arg (description, name);
    177             mCbHost->insertItem (id, fullName);
    178             mHostDVDs [id] = hostDVD;
    179         }
    180 
    181         /* Switch media images type to DVD */
    182         mCbImage->setType (VBoxDefs::MediumType_DVD);
     133        /* Switch media combo-box type to CD/DVD */
     134        mCbMedia->setType (VBoxDefs::MediumType_DVD);
    183135    }
    184136    /* Floppy media type selected */
    185137    else if (sender() == mRbFdType)
    186138    {
    187         /* Search for the host floppy-drives */
    188         CMediumVector coll =
    189             vboxGlobal().virtualBox().GetHost().GetFloppyDrives();
    190         mHostFloppys.resize (coll.size());
    191 
    192         for (int id = 0; id < coll.size(); ++id)
    193         {
    194             CMedium hostFloppy = coll[id];
    195             QString name = hostFloppy.GetName();
    196             QString description = hostFloppy.GetDescription();
    197             QString fullName = description.isEmpty() ?
    198                 name : QString ("%1 (%2)").arg (description, name);
    199             mCbHost->insertItem (id, fullName);
    200             mHostFloppys [id] = hostFloppy;
    201         }
    202 
    203         /* Switch media images type to FD */
    204         mCbImage->setType (VBoxDefs::MediumType_Floppy);
     139        /* Switch media combo-box type to Floppy */
     140        mCbMedia->setType (VBoxDefs::MediumType_Floppy);
    205141    }
    206142
    207     /* Repopulate the media list */
    208     mCbImage->repopulate();
     143    /* Update the media combo-box */
     144    mCbMedia->repopulate();
    209145
    210146    /* Revalidate updated page */
    211     mWvalType->revalidate();
    212 }
    213 
    214 void VBoxVMFirstRunWzd::mediaSourceChanged()
    215 {
    216     mCbHost->setEnabled (sender() == mRbHost);
    217     mCbImage->setEnabled (sender() == mRbImage);
    218     mTbVmm->setEnabled (sender() == mRbImage);
    219 
    220     /* Revalidate updated page */
    221     mWvalType->revalidate();
     147    mValidator->revalidate();
    222148}
    223149
    224150void VBoxVMFirstRunWzd::openMediaManager()
    225151{
    226     VBoxDefs::MediumType type =
    227         mRbCdType->isChecked() ? VBoxDefs::MediumType_DVD :
    228         mRbFdType->isChecked() ? VBoxDefs::MediumType_Floppy :
    229         VBoxDefs::MediumType_Invalid;
     152    /* Create & open VMM */
     153    VBoxMediaManagerDlg dlg (this);
     154    dlg.setup (mCbMedia->type(), true /* aDoSelect */);
     155    if (dlg.exec() == QDialog::Accepted)
     156        mCbMedia->setCurrentItem (dlg.selectedId());
    230157
    231     AssertReturnVoid (type != VBoxDefs::MediumType_Invalid);
    232 
    233     VBoxMediaManagerDlg dlg (this);
    234     dlg.setup (type, true /* aDoSelect */);
    235     if (dlg.exec() == QDialog::Accepted)
    236     {
    237         mCbImage->setCurrentItem (dlg.selectedId());
    238 
    239         /* Revalidate updated page */
    240         mWvalType->revalidate();
    241     }
     158    /* Revalidate updated page */
     159    mValidator->revalidate();
    242160}
    243161
    244 void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *aWval)
     162void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *aValidator)
    245163{
    246     nextButton (aWval->widget())->setEnabled (aWval->isValid());
     164    nextButton (aValidator->widget())->setEnabled (aValidator->isValid());
    247165}
    248166
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp

    r23581 r23585  
    778778    /* Cache medium information */
    779779    mAttName = medium.name (!mAttIsShowDiffs);
    780     mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs);
     780    mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs, mAttDeviceType != KDeviceType_HardDisk);
    781781    mAttPixmap = medium.iconCheckRO (!mAttIsShowDiffs);
    782782    mAttIsHostDrive = medium.isHostDrive();
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMFirstRunWzd.ui

    r23333 r23585  
    33 VBox frontends: Qt4 GUI ("VirtualBox"):
    44
    5  Copyright (C) 2008 Sun Microsystems, Inc.
     5 Copyright (C) 2008-2009 Sun Microsystems, Inc.
    66
    77 This file is part of VirtualBox Open Source Edition (OSE), as
     
    439439              <string>Media Source</string>
    440440             </property>
    441              <layout class="QVBoxLayout" >
     441             <layout class="QHBoxLayout" >
    442442              <property name="topMargin" >
    443443               <number>4</number>
    444444              </property>
    445445              <item>
    446                <layout class="QHBoxLayout" >
    447                 <item>
    448                  <widget class="QRadioButton" name="mRbHost" >
    449                   <property name="text" >
    450                    <string>&amp;Host Drive</string>
    451                   </property>
    452                  </widget>
    453                 </item>
    454                 <item>
    455                  <widget class="QComboBox" name="mCbHost" >
    456                   <property name="sizeAdjustPolicy" >
    457                    <enum>QComboBox::AdjustToContentsOnFirstShow</enum>
    458                   </property>
    459                  </widget>
    460                 </item>
    461                 <item>
    462                  <spacer>
    463                   <property name="orientation" >
    464                    <enum>Qt::Horizontal</enum>
    465                   </property>
    466                   <property name="sizeHint" >
    467                    <size>
    468                     <width>40</width>
    469                     <height>5</height>
    470                    </size>
    471                   </property>
    472                  </spacer>
    473                 </item>
    474                </layout>
     446               <widget class="VBoxMediaComboBox" name="mCbMedia" />
    475447              </item>
    476448              <item>
    477                <widget class="QRadioButton" name="mRbImage" >
    478                 <property name="text" >
    479                  <string>&amp;Image File</string>
     449               <widget class="QToolButton" name="mTbVmm" >
     450                <property name="icon" >
     451                 <iconset resource="../VirtualBox1.qrc" >:/select_file_16px.png</iconset>
    480452                </property>
    481453               </widget>
    482               </item>
    483               <item>
    484                <layout class="QHBoxLayout" >
    485                 <item>
    486                  <widget class="VBoxMediaComboBox" name="mCbImage" />
    487                 </item>
    488                 <item>
    489                  <widget class="QToolButton" name="mTbVmm" >
    490                   <property name="icon" >
    491                    <iconset resource="../VirtualBox1.qrc" >:/select_file_16px.png</iconset>
    492                   </property>
    493                  </widget>
    494                 </item>
    495                </layout>
    496454              </item>
    497455             </layout>
     
    721679             </property>
    722680             <property name="text" >
    723               <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
    724 p, li { white-space: pre-wrap; }
    725 &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;">
    726 &lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the above is correct, press the &lt;span style=" font-weight:600;">Finish&lt;/span> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.&lt;/p>
    727 &lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.&lt;/p>
    728 &lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Depending on the type of the setup program, you may need to manually unmount (eject) the media after the setup program reboots the virtual machine, to prevent the installation process from starting again. You can do this by selecting the corresponding &lt;span style=" font-weight:600;">Unmount...&lt;/span> action in the &lt;span style=" font-weight:600;">Devices&lt;/span> menu&lt;span style=" font-weight:600;">.&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
     681              <string>&lt;p>If the above is correct, press the &lt;b>Finish&lt;/b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.&lt;/p>&lt;p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.&lt;/p>&lt;p>Depending on the type of the setup program, you may need to manually unmount (eject) the media after the setup program reboots the virtual machine, to prevent the installation process from starting again. You can do this by selecting the corresponding &lt;b>Unmount...&lt;/b> action in the &lt;b>Devices&lt;/b> menu.&lt;/p></string>
    729682             </property>
    730683             <property name="alignment" >
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