VirtualBox

Changeset 9889 in vbox


Ignore:
Timestamp:
Jun 23, 2008 6:28:49 PM (17 years ago)
Author:
vboxsync
Message:

Fe/Qt4: Fixed VMSettings selector list changes during VBoxManage language change.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsDlg.h

    r9782 r9889  
    7272    QString dialogTitle() const;
    7373
     74    void updateAvailability();
     75
    7476    /* Common */
    7577    CMachine mMachine;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUSB.h

    r9827 r9889  
    6363                       const QString &aPath);
    6464
     65   ~VBoxVMSettingsUSB();
     66
    6567    void getFromHost();
    6668    void putBackToHost();
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobalSettingsDlg.cpp

    r9886 r9889  
    418418        /* Disable the USB controller category if the USB controller is
    419419         * not available (i.e. in VirtualBox OSE) */
    420         QList<QTreeWidgetItem*> items = mTwSelector->findItems (
    421             "#usb", Qt::MatchExactly, listView_Link);
    422         QTreeWidgetItem *usbItem = items.count() ? items [0] : 0;
     420        QTreeWidgetItem *usbItem = findItem (mTwSelector, "#usb", listView_Link);
    423421        Assert (usbItem);
    424422        if (usbItem)
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsDlg.cpp

    r9827 r9889  
    120120    connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)),
    121121             this, SLOT (onMediaEnumerationDone()));
    122 
    123     /* Parallel Port Page (currently disabled) */
    124     //QTreeWidgetItem *item = findItem (mTwSelector, "#parallelPorts", listView_Link);
    125     //Assert (item);
    126     //if (item) item->setHidden (true);
    127122
    128123    /* Hide unnecessary columns and header */
     
    181176    mMachine = aMachine;
    182177
     178    updateAvailability();
     179
    183180    setWindowTitle (dialogTitle());
    184181
     
    213210
    214211    /* Parallel Ports */
    215     VBoxVMSettingsParallel::getFromMachine (aMachine, mPageParallel,
    216                                             this, pagePath (mPageParallel));
     212    if (mPageParallel->isEnabled())
     213        VBoxVMSettingsParallel::getFromMachine (aMachine, mPageParallel,
     214                                                this, pagePath (mPageParallel));
    217215
    218216    /* USB */
    219     VBoxVMSettingsUSB::getFrom (aMachine, mPageUSB,
    220                                 this, pagePath (mPageUSB));
     217    if (mPageUSB->isEnabled())
     218        VBoxVMSettingsUSB::getFrom (aMachine, mPageUSB,
     219                                    this, pagePath (mPageUSB));
    221220
    222221    /* Shared Folders */
     
    224223
    225224    /* Vrdp */
    226     VBoxVMSettingsVRDP::getFromMachine (aMachine, mPageVrdp,
    227                                         this, pagePath (mPageVrdp));
     225    if (mPageVrdp->isEnabled())
     226        VBoxVMSettingsVRDP::getFromMachine (aMachine, mPageVrdp,
     227                                            this, pagePath (mPageVrdp));
    228228
    229229    /* Finally set the reset First Run Wizard flag to "false" to make sure
     
    288288    /* Set the old index */
    289289    mTwSelector->setCurrentItem (mTwSelector->topLevelItem (ci));
     290
     291    /* Update QTreeWidget with available items */
     292    updateAvailability();
    290293
    291294    /* Adjust selector list */
     
    550553}
    551554
     555void VBoxVMSettingsDlg::updateAvailability()
     556{
     557    if (mMachine.isNull())
     558        return;
     559
     560    /* Parallel Port Page (currently disabled) */
     561    QTreeWidgetItem *parallelItem =
     562        findItem (mTwSelector, "#parallelPorts", listView_Link);
     563    Assert (parallelItem);
     564    if (parallelItem)
     565        parallelItem->setHidden (true);
     566    mPageParallel->setEnabled (false);
     567
     568    /* USB Stuff */
     569    CUSBController ctl = mMachine.GetUSBController();
     570    /* Show an error message (if there is any).
     571     * Note that we don't use the generic cannotLoadMachineSettings()
     572     * call here because we want this message to be suppressable. */
     573    if (!mMachine.isReallyOk())
     574        vboxProblem().cannotAccessUSB (mMachine);
     575    if (ctl.isNull())
     576    {
     577        /* Disable the USB controller category if the USB controller is
     578         * not available (i.e. in VirtualBox OSE) */
     579        QTreeWidgetItem *usbItem =
     580            findItem (mTwSelector, "#usb", listView_Link);
     581        Assert (usbItem);
     582        if (usbItem)
     583            usbItem->setHidden (true);
     584        mPageUSB->setEnabled (false);
     585    }
     586
     587    /* VRDP Stuff */
     588    CVRDPServer vrdp = mMachine.GetVRDPServer();
     589    if (vrdp.isNull())
     590    {
     591        /* Disable the VRDP category if VRDP is
     592         * not available (i.e. in VirtualBox OSE) */
     593        QTreeWidgetItem *vrdpItem =
     594            findItem (mTwSelector, "#vrdp", listView_Link);
     595        Assert (vrdpItem);
     596        if (vrdpItem)
     597            vrdpItem->setHidden (true);
     598        mPageVrdp->setEnabled (false);
     599        /* If mMachine has something to say, show the message */
     600        vboxProblem().cannotLoadMachineSettings (mMachine, false /* strict */);
     601    }
     602}
     603
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsParallel.cpp

    r9751 r9889  
    108108void VBoxVMSettingsParallel::putBackToMachine()
    109109{
    110     for (int index = 0; index < mTabWidget->count(); ++ index)
    111     {
    112         VBoxVMSettingsParallel *page =
    113             (VBoxVMSettingsParallel*) mTabWidget->widget (index);
    114         Assert (page);
    115         page->putBackToPort();
    116     }
     110    if (mTabWidget)
     111        for (int index = 0; index < mTabWidget->count(); ++ index)
     112        {
     113            VBoxVMSettingsParallel *page =
     114                (VBoxVMSettingsParallel*) mTabWidget->widget (index);
     115            Assert (page);
     116            page->putBackToPort();
     117        }
    117118}
    118119
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsUSB.cpp

    r9886 r9889  
    6666                                 const QString &aPath)
    6767{
    68     CUSBController ctl = aMachine.GetUSBController();
    69 
    70     /* Show an error message (if there is any).
    71      * Note that we don't use the generic cannotLoadMachineSettings()
    72      * call here because we want this message to be suppressable. */
    73     if (!aMachine.isReallyOk())
    74         vboxProblem().cannotAccessUSB (aMachine);
    75 
    76     if (ctl.isNull())
    77     {
    78         /* Disable the USB controller category if the USB controller is
    79          * not available (i.e. in VirtualBox OSE) */
    80         QList<QTreeWidgetItem*> items = aDlg->mTwSelector->findItems (
    81             "#usb", Qt::MatchExactly, listView_Link);
    82         QTreeWidgetItem *usbItem = items.count() ? items [0] : 0;
    83         Assert (usbItem);
    84         if (usbItem)
    85             usbItem->setHidden (true);
    86         return;
    87     }
    88 
    8968    mSettings = new VBoxVMSettingsUSB (aPage, MachineType, aDlg, aPath);
    9069    QVBoxLayout *layout = new QVBoxLayout (aPage);
     
    238217    /* Applying language settings */
    239218    retranslateUi();
     219}
     220
     221VBoxVMSettingsUSB::~VBoxVMSettingsUSB()
     222{
     223    mSettings = 0;
    240224}
    241225
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsVRDP.cpp

    r9751 r9889  
    7070                                         const QString &aPath)
    7171{
    72     CVRDPServer vrdp = aMachine.GetVRDPServer();
    73 
    74     if (vrdp.isNull())
    75     {
    76         /* Disable the VRDP category if VRDP is
    77          * not available (i.e. in VirtualBox OSE) */
    78         QList<QTreeWidgetItem*> items = aDlg->mTwSelector->findItems (
    79             "#vrdp", Qt::MatchExactly, listView_Link);
    80         QTreeWidgetItem *vrdpItem = items.count() ? items [0] : 0;
    81         Assert (vrdpItem);
    82         if (vrdpItem)
    83             vrdpItem->setHidden (true);
    84         return;
    85 
    86         /* If aMachine has something to say, show the message */
    87         vboxProblem().cannotLoadMachineSettings (aMachine, false /* strict */);
    88     }
    89 
    9072    mSettings = new VBoxVMSettingsVRDP (aPage, aDlg, aPath);
    9173    QVBoxLayout *layout = new QVBoxLayout (aPage);
     
    10486void VBoxVMSettingsVRDP::putBackToMachine()
    10587{
    106     mSettings->putBackTo();
     88    if (mSettings)
     89        mSettings->putBackTo();
    10790}
    10891
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