VirtualBox

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


Ignore:
Timestamp:
May 17, 2011 1:56:50 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 3887: Make certain settings editable during runtime: Fix availability states for all VM settings pages for switching between online and offline modes.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r37109 r37126  
    193193            /* If such page present we should fetch internal page cache: */
    194194            if (m_pages.contains(iPageId))
    195             {
    196195                m_pages[iPageId]->getFromCache();
    197                 m_pages[iPageId]->polishPage();
    198             }
    199196        }
    200197        /* If thats the page we are waiting for,
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp

    r37051 r37126  
    7070    mCbAudioDriver->setCurrentIndex(mCbAudioDriver->findText(vboxGlobal().toString(audioData.m_audioDriverType)));
    7171    mCbAudioController->setCurrentIndex(mCbAudioController->findText(vboxGlobal().toString(audioData.m_audioControllerType)));
     72
     73    /* Polish page finally: */
     74    polishPage();
    7275}
    7376
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r37051 r37126  
    197197    /* Load display data to page: */
    198198    mSlMonitors->setValue(displayData.m_cMonitorCount);
    199     mCb3D->setEnabled(vboxGlobal().virtualBox().GetHost().GetAcceleration3DAvailable());
    200199    mCb3D->setChecked(displayData.m_f3dAccelerationEnabled);
    201200#ifdef VBOX_WITH_VIDEOHWACCEL
    202     mCb2DVideo->setEnabled(VBoxGlobal::isAcceleration2DVideoAvailable());
    203201    mCb2DVideo->setChecked(displayData.m_f2dAccelerationEnabled);
    204202#endif /* VBOX_WITH_VIDEOHWACCEL */
     
    216214        mTwDisplay->removeTab(1);
    217215
     216    /* Polish page finally: */
     217    polishPage();
     218
    218219    /* Revalidate if possible: */
    219     if (mValidator) mValidator->revalidate();
     220    if (mValidator)
     221        mValidator->revalidate();
    220222}
    221223
     
    474476    mLeMonitors->setEnabled(isMachineOffline());
    475477    mLbOptions->setEnabled(isMachineOffline());
    476     mCb3D->setEnabled(isMachineOffline());
    477 #ifdef VBOX_WITH_VIDEOHWACCEL
    478     mCb2DVideo->setEnabled(isMachineOffline());
     478    mCb3D->setEnabled(isMachineOffline() && vboxGlobal().virtualBox().GetHost().GetAcceleration3DAvailable());
     479#ifdef VBOX_WITH_VIDEOHWACCEL
     480    mCb2DVideo->setEnabled(isMachineOffline() && VBoxGlobal::isAcceleration2DVideoAvailable());
    479481#endif /* VBOX_WITH_VIDEOHWACCEL */
    480482    /* VRDE tab: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r37051 r37126  
    115115    mCbShowToolBar->setChecked(generalData.m_fShowMiniToolBar);
    116116    mCbToolBarAlignment->setChecked(generalData.m_fMiniToolBarAtTop);
    117     mCbToolBarAlignment->setEnabled(mCbShowToolBar->isChecked());
    118117    mPsSnapshot->setPath(generalData.m_strSnapshotsFolder);
    119118    mPsSnapshot->setHomeDir(generalData.m_strSnapshotsHomeDir);
     
    121120    mTeDescription->setPlainText(generalData.m_strDescription);
    122121
     122    /* Polish page finally: */
     123    polishPage();
     124
    123125    /* Revalidate if possible: */
    124     if (mValidator) mValidator->revalidate();
     126    if (mValidator)
     127        mValidator->revalidate();
    125128}
    126129
     
    245248    mLbToolBar->setEnabled(isMachineInValidMode());
    246249    mCbShowToolBar->setEnabled(isMachineInValidMode());
    247     mCbToolBarAlignment->setEnabled(mCbShowToolBar->isChecked() && isMachineInValidMode());
    248 }
    249 
     250    mCbToolBarAlignment->setEnabled(isMachineInValidMode() && mCbShowToolBar->isChecked());
     251}
     252
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r37051 r37126  
    8787    m_pMACEditor->setEnabled(m_pParent->isMachineOffline());
    8888    m_pMACButton->setEnabled(m_pParent->isMachineOffline());
     89
     90    m_pPortForwardingButton->setEnabled(m_pParent->isMachineInValidMode() &&
     91                                        attachmentType() == KNetworkAttachmentType_NAT);
    8992
    9093    /* Postprocessing: */
     
    856859    retranslateUi();
    857860
     861    /* Polish page finally: */
     862    polishPage();
     863
    858864    /* Revalidate if possible: */
    859     if (m_pValidator) m_pValidator->revalidate();
     865    if (m_pValidator)
     866        m_pValidator->revalidate();
    860867}
    861868
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r37051 r37126  
    260260    retranslateUi();
    261261
     262    /* Polish page finally: */
     263    polishPage();
     264
    262265    /* Revalidate if possible: */
    263     if (mValidator) mValidator->revalidate();
     266    if (mValidator)
     267        mValidator->revalidate();
    264268}
    265269
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r37051 r37126  
    295295    mTwFolders->setCurrentItem(mTwFolders->topLevelItem(0));
    296296    processCurrentChanged(mTwFolders->currentItem());
     297
     298    /* Polish page finally: */
     299    polishPage();
    297300}
    298301
     
    521524}
    522525
    523 void UIMachineSettingsSF::showContextMenu (const QPoint &aPos)
     526void UIMachineSettingsSF::showContextMenu(const QPoint &pos)
    524527{
    525528    QMenu menu;
    526     QTreeWidgetItem *item = mTwFolders->itemAt (aPos);
    527     if (item && item->flags() & Qt::ItemIsSelectable)
    528     {
    529         menu.addAction (mEdtAction);
    530         menu.addAction (mDelAction);
     529    QTreeWidgetItem *pItem = mTwFolders->itemAt(pos);
     530    if (mTwFolders->isEnabled() && pItem && pItem->flags() & Qt::ItemIsSelectable)
     531    {
     532        menu.addAction(mEdtAction);
     533        menu.addAction(mDelAction);
    531534    }
    532535    else
    533536    {
    534         menu.addAction (mNewAction);
    535     }
    536     menu.exec (mTwFolders->viewport()->mapToGlobal (aPos));
     537        menu.addAction(mNewAction);
     538    }
     539    if (!menu.isEmpty())
     540        menu.exec(mTwFolders->viewport()->mapToGlobal(pos));
    537541}
    538542
     
    694698void UIMachineSettingsSF::polishPage()
    695699{
     700    /* Update widgets availability: */
     701    mNameSeparator->setEnabled(isMachineInValidMode());
     702    mTwFolders->setEnabled(isMachineInValidMode());
     703    mTbFolders->setEnabled(isMachineInValidMode());
     704
    696705    /* Update root items visibility: */
    697706    updateRootItemsVisibility();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r37051 r37126  
    296296    retranslateUi();
    297297
     298    /* Polish page finally: */
     299    polishPage();
     300
    298301    /* Revalidate if possible: */
    299     if (mValidator) mValidator->revalidate();
     302    if (mValidator)
     303        mValidator->revalidate();
    300304}
    301305
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r37051 r37126  
    19101910    updateActionsState();
    19111911
     1912    /* Polish page finally: */
     1913    polishPage();
     1914
    19121915    /* Revalidate if possible: */
    1913     if (mValidator) mValidator->revalidate();
     1916    if (mValidator)
     1917        mValidator->revalidate();
    19141918}
    19151919
     
    34403444void UIMachineSettingsStorage::setDialogType(SettingsDialogType settingsDialogType)
    34413445{
     3446    /* Update model 'settings dialog type': */
     3447    mStorageModel->setDialogType(settingsDialogType);
    34423448    /* Update 'settings dialog type' of base class: */
    34433449    UISettingsPageMachine::setDialogType(settingsDialogType);
    3444     /* Update model 'settings dialog type': */
    3445     mStorageModel->setDialogType(dialogType());
    3446     /* Update action states: */
    3447     updateActionsState();
    34483450}
    34493451
    34503452void UIMachineSettingsStorage::polishPage()
    34513453{
     3454    /* Declare required variables: */
     3455    QModelIndex index = mTwStorageTree->currentIndex();
     3456    KDeviceType device = mStorageModel->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
     3457
    34523458    /* Left pane: */
    34533459    mLsLeftPane->setEnabled(isMachineInValidMode());
     
    34653471    /* Attachments pane: */
    34663472    mLsAttributes->setEnabled(isMachineInValidMode());
    3467     mLbMedium->setEnabled(isMachineInValidMode());
     3473    mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
    34683474    mCbSlot->setEnabled(isMachineOffline());
    3469     mTbOpen->setEnabled(isMachineInValidMode());
     3475    mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
    34703476    mCbPassthrough->setEnabled(isMachineOffline());
    34713477    mLsInformation->setEnabled(isMachineInValidMode());
     
    34843490    mLbUsage->setEnabled(isMachineInValidMode());
    34853491    mLbUsageValue->setEnabled(isMachineInValidMode());
     3492
     3493    /* Update action states: */
     3494    updateActionsState();
    34863495}
    34873496
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r37051 r37126  
    246246    mCbTCUseUTC->setChecked(systemData.m_fUTCEnabled);
    247247    mCbUseAbsHID->setChecked(systemData.m_fUseAbsHID);
    248     mSlCPU->setEnabled(systemData.m_fPFHwVirtExSupported);
    249     mLeCPU->setEnabled(systemData.m_fPFHwVirtExSupported);
    250     mCbPae->setEnabled(systemData.m_fPFPAESupported);
    251248    mCbPae->setChecked(systemData.m_fPAEEnabled);
    252     mCbVirt->setEnabled(systemData.m_fPFHwVirtExSupported);
    253249    mCbVirt->setChecked(systemData.m_fHwVirtExEnabled);
    254     mCbNestedPaging->setEnabled(systemData.m_fPFHwVirtExSupported && systemData.m_fHwVirtExEnabled);
    255250    mCbNestedPaging->setChecked(systemData.m_fNestedPagingEnabled);
    256251    mSlMemory->setValue(systemData.m_iRAMSize);
     
    258253    int iChipsetPositionPos = mCbChipset->findData(systemData.m_chipsetType);
    259254    mCbChipset->setCurrentIndex(iChipsetPositionPos == -1 ? 0 : iChipsetPositionPos);
    260     if (!systemData.m_fPFHwVirtExSupported)
    261         mTwSystem->removeTab(2);
     255
     256    /* Polish page finally: */
     257    polishPage();
    262258
    263259    /* Revalidate if possible: */
    264     if (mValidator) mValidator->revalidate();
     260    if (mValidator)
     261        mValidator->revalidate();
    265262}
    266263
     
    566563void UIMachineSettingsSystem::polishPage()
    567564{
     565    /* Get system data from cache: */
     566    const UIDataSettingsMachineSystem &systemData = m_cache.base();
     567
    568568    /* Motherboard tab: */
    569569    mLbMemory->setEnabled(isMachineOffline());
     
    575575    mLbBootOrder->setEnabled(isMachineOffline());
    576576    mTwBootOrder->setEnabled(isMachineOffline());
    577     mTbBootItemUp->setEnabled(isMachineOffline());
    578     mTbBootItemDown->setEnabled(isMachineOffline());
     577    mTbBootItemUp->setEnabled(isMachineOffline() && mTwBootOrder->hasFocus() && mTwBootOrder->currentRow() > 0);
     578    mTbBootItemDown->setEnabled(isMachineOffline() && mTwBootOrder->hasFocus() && (mTwBootOrder->currentRow() < mTwBootOrder->count() - 1));
    579579    mLbChipset->setEnabled(isMachineOffline());
    580580    mCbChipset->setEnabled(isMachineOffline());
     
    588588    mLbCPUMin->setEnabled(isMachineOffline());
    589589    mLbCPUMax->setEnabled(isMachineOffline());
    590     mSlCPU->setEnabled(isMachineOffline());
    591     mLeCPU->setEnabled(isMachineOffline());
     590    mSlCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
     591    mLeCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
    592592    mLbProcessorExtended->setEnabled(isMachineOffline());
    593     mCbPae->setEnabled(isMachineOffline());
     593    mCbPae->setEnabled(isMachineOffline() && systemData.m_fPFPAESupported);
    594594    /* Acceleration tab: */
     595    mTwSystem->setTabEnabled(2, systemData.m_fPFHwVirtExSupported);
    595596    mLbVirt->setEnabled(isMachineOffline());
    596597    mCbVirt->setEnabled(isMachineOffline());
    597     mCbNestedPaging->setEnabled(mCbVirt->isChecked() && isMachineOffline());
    598 }
    599 
     598    mCbNestedPaging->setEnabled(isMachineOffline() && mCbVirt->isChecked());
     599}
     600
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r37051 r37126  
    3333    : UISettingsPage(type)
    3434    , mValidator(0)
     35    , m_pToolBar(0)
    3536    , mNewAction(0), mAddAction(0), mEdtAction(0), mDelAction(0)
    3637    , mMupAction(0), mMdnAction(0)
    37     , mMenu(0), mUSBDevicesMenu(0)
     38    , mUSBDevicesMenu(0)
    3839{
    3940    /* Apply UI decorations */
     
    6869                                            ":/usb_movedown_disabled_16px.png"));
    6970
    70     /* Prepare menu and toolbar */
    71     mMenu = new QMenu (mTwFilters);
    72     mMenu->addAction (mNewAction);
    73     mMenu->addAction (mAddAction);
    74     mMenu->addSeparator();
    75     mMenu->addAction (mEdtAction);
    76     mMenu->addSeparator();
    77     mMenu->addAction (mDelAction);
    78     mMenu->addSeparator();
    79     mMenu->addAction (mMupAction);
    80     mMenu->addAction (mMdnAction);
    81 
    8271    /* Prepare toolbar */
    83     UIToolBar *toolBar = new UIToolBar (mWtFilterHandler);
    84     toolBar->setUsesTextLabel (false);
    85     toolBar->setIconSize (QSize (16, 16));
    86     toolBar->setOrientation (Qt::Vertical);
    87     toolBar->addAction (mNewAction);
    88     toolBar->addAction (mAddAction);
    89     toolBar->addAction (mEdtAction);
    90     toolBar->addAction (mDelAction);
    91     toolBar->addAction (mMupAction);
    92     toolBar->addAction (mMdnAction);
    93     toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
    94     toolBar->updateGeometry();
     72    m_pToolBar = new UIToolBar (mWtFilterHandler);
     73    m_pToolBar->setUsesTextLabel (false);
     74    m_pToolBar->setIconSize (QSize (16, 16));
     75    m_pToolBar->setOrientation (Qt::Vertical);
     76    m_pToolBar->addAction (mNewAction);
     77    m_pToolBar->addAction (mAddAction);
     78    m_pToolBar->addAction (mEdtAction);
     79    m_pToolBar->addAction (mDelAction);
     80    m_pToolBar->addAction (mMupAction);
     81    m_pToolBar->addAction (mMdnAction);
     82    m_pToolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
     83    m_pToolBar->updateGeometry();
    9584#ifdef Q_WS_MAC
    9685    /* On the Mac this has to be slightly higher, than what sizeHint returned.
    9786     * No idea why. */
    98     toolBar->setMinimumHeight(toolBar->sizeHint().height() + 4);
     87    m_pToolBar->setMinimumHeight(m_pToolBar->sizeHint().height() + 4);
    9988#else
    100     toolBar->setMinimumHeight(toolBar->sizeHint().height());
     89    m_pToolBar->setMinimumHeight(m_pToolBar->sizeHint().height());
    10190#endif /* Q_WS_MAC */
    102     mWtFilterHandler->layout()->addWidget (toolBar);
     91    mWtFilterHandler->layout()->addWidget (m_pToolBar);
    10392
    10493    /* Setup connections */
     
    296285    /* Update page: */
    297286    usbAdapterToggled(mGbUSB->isChecked());
     287
     288    /* Polish page finally: */
     289    polishPage();
    298290
    299291    /* Revalidate if possible: */
     
    793785}
    794786
    795 void UIMachineSettingsUSB::showContextMenu (const QPoint &aPos)
    796 {
    797     mMenu->exec (mTwFilters->mapToGlobal (aPos));
     787void UIMachineSettingsUSB::showContextMenu(const QPoint &pos)
     788{
     789    QMenu menu;
     790    if (mTwFilters->isEnabled())
     791    {
     792        menu.addAction(mNewAction);
     793        menu.addAction(mAddAction);
     794        menu.addSeparator();
     795        menu.addAction(mEdtAction);
     796        menu.addSeparator();
     797        menu.addAction(mDelAction);
     798        menu.addSeparator();
     799        menu.addAction(mMupAction);
     800        menu.addAction(mMdnAction);
     801    }
     802    if (!menu.isEmpty())
     803        menu.exec(mTwFilters->mapToGlobal(pos));
    798804}
    799805
     
    914920{
    915921    mGbUSB->setEnabled(isMachineOffline());
    916     mCbUSB2->setEnabled(isMachineOffline());
    917     mGbUSBFilters->setEnabled(isMachineInValidMode());
    918     mTwFilters->setEnabled(isMachineInValidMode());
    919 }
    920 
     922    mUSBChild->setEnabled(isMachineInValidMode() && mGbUSB->isChecked());
     923    mCbUSB2->setEnabled(isMachineOffline() && mGbUSB->isChecked());
     924}
     925
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h

    r36936 r37126  
    2525
    2626class VBoxUSBMenu;
     27class UIToolBar;
    2728
    2829/* Common settings / USB page / USB filter data: */
     
    156157    void mupClicked();
    157158    void mdnClicked();
    158     void showContextMenu (const QPoint &aPos);
     159    void showContextMenu(const QPoint &pos);
    159160    void sltUpdateActivityState(QTreeWidgetItem *pChangedItem);
    160161
     
    184185    /* Other variables: */
    185186    QIWidgetValidator *mValidator;
     187    UIToolBar *m_pToolBar;
    186188    QAction *mNewAction;
    187189    QAction *mAddAction;
     
    190192    QAction *mMupAction;
    191193    QAction *mMdnAction;
    192     QMenu *mMenu;
    193194    VBoxUSBMenu *mUSBDevicesMenu;
    194195    QString mUSBFilterName;
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