VirtualBox

Changeset 37712 in vbox


Ignore:
Timestamp:
Jun 30, 2011 2:11:14 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 5763: Create CPU execution cap UI in Machine settings / System page: Initial commit.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp

    r36364 r37712  
    191191        case KVBoxEventType_OnSharedFolderChanged:
    192192        {
    193             CSharedFolderChangedEvent es(pEvent);
    194193            emit sigSharedFolderChange();
    195194            break;
     
    221220            break;
    222221        }
     222        case KVBoxEventType_OnCPUExecutionCapChanged:
     223        {
     224            emit sigCPUExecutionCapChange();
     225            break;
     226        }
    223227        default: break;
    224228    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h

    r36364 r37712  
    7575    void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */
    7676    void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */
     77    void sigCPUExecutionCapChange();
    7778};
    7879
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r37585 r37712  
    16501650                                                       tr ("<nobr>%1</nobr>", "details report"))
    16511651                       .arg (aMachine.GetCPUCount())
     1652                     + QString (sSectionItemTpl2).arg (tr ("CPU Execution Cap", "details report"),
     1653                                                       tr ("<nobr>%1%</nobr>", "details report"))
     1654                       .arg (aMachine.GetCPUExecutionCap())
    16521655                     + QString (sSectionItemTpl2).arg (tr ("Boot Order", "details report"), bootOrder)
    16531656#ifdef VBOX_WITH_FULL_DETAILS_REPORT
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp

    r36364 r37712  
    7979        << KVBoxEventType_OnRuntimeError
    8080        << KVBoxEventType_OnCanShowWindow
    81         << KVBoxEventType_OnShowWindow;
     81        << KVBoxEventType_OnShowWindow
     82        << KVBoxEventType_OnCPUExecutionCapChanged;
    8283
    8384    const CConsole &console = m_pSession->session().GetConsole();
     
    144145            this, SLOT(sltShowWindow(LONG64&)),
    145146            Qt::DirectConnection);
     147
     148    connect(pListener->getWrapped(), SIGNAL(sigCPUExecutionCapChange()),
     149            this, SIGNAL(sigCPUExecutionCapChange()),
     150            Qt::QueuedConnection);
    146151}
    147152
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h

    r36364 r37712  
    5050    void sigShowWindow();
    5151#endif /* RT_OS_DARWIN */
     52    void sigCPUExecutionCapChange();
    5253
    5354private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r35761 r37712  
    566566            VBoxGlobal::tr("Disabled", "nested paging");
    567567
    568         QString tip(QApplication::translate("UIIndicatorsPool", "Indicates the status of the hardware virtualization "
    569                        "features used by this virtual machine:"
    570                        "<br><nobr><b>%1:</b>&nbsp;%2</nobr>"
    571                        "<br><nobr><b>%3:</b>&nbsp;%4</nobr>",
    572                        "Virtualization Stuff LED")
    573                        .arg(VBoxGlobal::tr("VT-x/AMD-V", "details report"), virtualization)
    574                        .arg(VBoxGlobal::tr("Nested Paging"), nestedPaging));
     568        QString strCPUExecCap = QString::number(console.GetMachine().GetCPUExecutionCap());
     569
     570        QString tip(QApplication::translate("UIIndicatorsPool",
     571                                            "Indicates the status of different "
     572                                            "features used by this virtual machine:"
     573                                            "<br><nobr><b>%1:</b>&nbsp;%2</nobr>"
     574                                            "<br><nobr><b>%3:</b>&nbsp;%4</nobr>"
     575                                            "<br><nobr><b>%5:</b>&nbsp;%6%</nobr>",
     576                                            "Virtualization Stuff LED")
     577                    .arg(VBoxGlobal::tr("VT-x/AMD-V", "details report"), virtualization)
     578                    .arg(VBoxGlobal::tr("Nested Paging"), nestedPaging)
     579                    .arg(VBoxGlobal::tr("CPU Execution Cap", "details report"), strCPUExecCap));
    575580
    576581        int cpuCount = console.GetMachine().GetCPUCount();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r37525 r37712  
    137137#endif /* Q_WS_MAC */
    138138
     139    connect(gConsoleEvents, SIGNAL(sigCPUExecutionCapChange()),
     140            this, SIGNAL(sigCPUExecutionCapChange()));
     141
    139142    /* Prepare main menu: */
    140143    prepareMenuPool();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r36364 r37712  
    176176    void sigShowWindows();
    177177#endif /* RT_OS_DARWIN */
     178    void sigCPUExecutionCapChange();
    178179
    179180    /* Session signals: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r36083 r37712  
    156156{
    157157    updateAppearanceOf(UIVisualElement_SharedFolderStuff);
     158}
     159
     160void UIMachineWindowNormal::sltCPUExecutionCapChange()
     161{
     162    updateAppearanceOf(UIVisualElement_VirtualizationStuff);
    158163}
    159164
     
    372377    connect(machineLogic()->uisession(), SIGNAL(sigSharedFolderChange()),
    373378            this, SLOT(sltSharedFolderChange()));
     379
     380    /* CPU execution cap change updater: */
     381    connect(machineLogic()->uisession(), SIGNAL(sigCPUExecutionCapChange()),
     382            this, SLOT(sltCPUExecutionCapChange()));
     383
    374384}
    375385
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r30708 r37712  
    5252    void sltNetworkAdapterChange();
    5353    void sltSharedFolderChange();
     54    void sltCPUExecutionCapChange();
    5455
    5556    /* LED connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp

    r37592 r37712  
    595595                                             tr("<nobr>%1</nobr>", "details report"))
    596596                    .arg(cCPU);
     597
     598#ifdef VBOX_WITH_FULL_DETAILS_REPORT
     599            /* CPU Execution Cap
     600             * is NOT such important attribute to be reflected in details page... */
     601            int iCPUExecCap = m_machine.GetCPUExecutionCap();
     602            if (iCPUExecCap < 100)
     603                item += sSectionItemTpl2.arg(tr("CPU Execution Cap", "details report"),
     604                                             tr("<nobr>%1%</nobr>", "details report"))
     605                    .arg(iCPUExecCap);
     606#endif /* VBOX_WITH_FULL_DETAILS_REPORT */
    597607
    598608            /* Boot order */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r37168 r37712  
    3131    : mValidator(0)
    3232    , mMinGuestCPU(0), mMaxGuestCPU(0)
     33    , mMinGuestCPUExecCap(0), mMedGuestCPUExecCap(0), mMaxGuestCPUExecCap(0)
    3334    , m_fOHCIEnabled(false)
    3435{
     
    4142    mMinGuestCPU = properties.GetMinGuestCPUCount();
    4243    mMaxGuestCPU = RT_MIN (2 * hostCPUs, properties.GetMaxGuestCPUCount());
     44    mMinGuestCPUExecCap = 1;
     45    mMedGuestCPUExecCap = 40;
     46    mMaxGuestCPUExecCap = 100;
    4347
    4448    /* Populate possible boot items list.
     
    8488    mLeMemory->setValidator (new QIntValidator (mSlMemory->minRAM(), mSlMemory->maxRAM(), this));
    8589    mLeCPU->setValidator (new QIntValidator (mMinGuestCPU, mMaxGuestCPU, this));
     90    mLeCPUExecCap->setValidator(new QIntValidator(mMinGuestCPUExecCap, mMaxGuestCPUExecCap, this));
    8691
    8792    /* Setup connections */
     
    102107    connect (mLeCPU, SIGNAL (textChanged (const QString&)),
    103108             this, SLOT (textChangedCPU (const QString&)));
     109
     110    connect(mSlCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedCPUExecCap(int)));
     111    connect(mLeCPUExecCap, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedCPUExecCap(const QString&)));
    104112
    105113    /* Setup iconsets */
     
    130138    mSlCPU->setWarningHint (hostCPUs, mMaxGuestCPU);
    131139    /* Limit min/max. size of QLineEdit */
    132     mLeCPU->setFixedWidthByText (QString().fill ('8', 3));
     140    mLeCPU->setFixedWidthByText(QString().fill('8', 4));
    133141    /* Ensure mLeMemory value and validation is updated */
    134142    valueChangedCPU (mSlCPU->value());
     143
     144    /* Setup cpu cap slider: */
     145    mSlCPUExecCap->setPageStep(10);
     146    mSlCPUExecCap->setSingleStep(1);
     147    mSlCPUExecCap->setTickInterval(10);
     148    /* Setup the scale so that ticks are at page step boundaries: */
     149    mSlCPUExecCap->setMinimum(mMinGuestCPUExecCap);
     150    mSlCPUExecCap->setMaximum(mMaxGuestCPUExecCap);
     151    mSlCPUExecCap->setWarningHint(mMinGuestCPUExecCap, mMedGuestCPUExecCap);
     152    mSlCPUExecCap->setOptimalHint(mMedGuestCPUExecCap, mMaxGuestCPUExecCap);
     153    /* Limit min/max. size of QLineEdit: */
     154    mLeCPUExecCap->setFixedWidthByText(QString().fill('8', 4));
     155    /* Ensure mLeMemory value and validation is updated: */
     156    sltValueChangedCPUExecCap(mSlCPUExecCap->value());
     157
    135158    /* Populate chipset combo: */
    136159    mCbChipset->insertItem(0, vboxGlobal().toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));
     
    215238    systemData.m_iRAMSize = m_machine.GetMemorySize();
    216239    systemData.m_cCPUCount = systemData.m_fPFHwVirtExSupported ? m_machine.GetCPUCount() : 1;
     240    systemData.m_cCPUExecCap = m_machine.GetCPUExecutionCap();
    217241    systemData.m_chipsetType = m_machine.GetChipsetType();
    218242
     
    252276    mSlMemory->setValue(systemData.m_iRAMSize);
    253277    mSlCPU->setValue(systemData.m_cCPUCount);
     278    mSlCPUExecCap->setValue(systemData.m_cCPUExecCap);
    254279    int iChipsetPositionPos = mCbChipset->findData(systemData.m_chipsetType);
    255280    mCbChipset->setCurrentIndex(iChipsetPositionPos == -1 ? 0 : iChipsetPositionPos);
     
    290315    systemData.m_iRAMSize = mSlMemory->value();
    291316    systemData.m_cCPUCount = mSlCPU->value();
     317    systemData.m_cCPUExecCap = mSlCPUExecCap->value();
    292318    systemData.m_chipsetType = (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt();
    293319
     
    339365            m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, systemData.m_fNestedPagingEnabled);
    340366        }
     367        if (isMachineInValidMode())
     368        {
     369            /* Processor tab: */
     370            m_machine.SetCPUExecutionCap(systemData.m_cCPUExecCap);
     371        }
    341372    }
    342373
     
    419450            "This will be done automatically when you accept the VM Settings "
    420451            "by pressing the OK button.");
     452        return true;
     453    }
     454
     455    /* CPU execution cap is low: */
     456    if (mSlCPUExecCap->value() < (int)mMedGuestCPUExecCap)
     457    {
     458        aWarning = tr("you have set CPU execution cap to low value, which may "
     459                      "distort audio and have other side effects.");
    421460        return true;
    422461    }
     
    464503    setTabOrder (mCbUseAbsHID, mSlCPU);
    465504    setTabOrder (mSlCPU, mLeCPU);
    466     setTabOrder (mLeCPU, mCbPae);
     505    setTabOrder(mLeCPU, mSlCPUExecCap);
     506    setTabOrder(mSlCPUExecCap, mLeCPUExecCap);
     507    setTabOrder(mLeCPUExecCap, mCbPae);
    467508
    468509    /* Acceleration tab-order */
     
    488529    mLbCPUMin->setText (tr ("<qt>%1&nbsp;CPU</qt>", "%1 is 1 for now").arg (mMinGuestCPU));
    489530    mLbCPUMax->setText (tr ("<qt>%1&nbsp;CPUs</qt>", "%1 is host cpu count * 2 for now").arg (mMaxGuestCPU));
     531
     532    /* Retranslate the cpu cap slider legend: */
     533    mLbCPUExecCapMin->setText(tr("<qt>%1%</qt>", "Min CPU execution cap in %").arg(mMinGuestCPUExecCap));
     534    mLbCPUExecCapMax->setText(tr("<qt>%1%</qt>", "Max CPU execution cap in %").arg(mMaxGuestCPUExecCap));
    490535}
    491536
     
    531576{
    532577    mSlCPU->setValue (aText.toInt());
     578}
     579
     580void UIMachineSettingsSystem::sltValueChangedCPUExecCap(int iValue)
     581{
     582    mLeCPUExecCap->setText(QString().setNum(iValue));
     583}
     584
     585void UIMachineSettingsSystem::sltTextChangedCPUExecCap(const QString &strText)
     586{
     587    mSlCPUExecCap->setValue(strText.toInt());
    533588}
    534589
     
    602657    mSlCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
    603658    mLeCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
     659    mLbCPUExecCap->setEnabled(isMachineInValidMode());
     660    mLbCPUExecCapMin->setEnabled(isMachineInValidMode());
     661    mLbCPUExecCapMax->setEnabled(isMachineInValidMode());
     662    mSlCPUExecCap->setEnabled(isMachineInValidMode());
     663    mLeCPUExecCap->setEnabled(isMachineInValidMode());
    604664    mLbProcessorExtended->setEnabled(isMachineOffline());
    605665    mCbPae->setEnabled(isMachineOffline() && systemData.m_fPFPAESupported);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r37168 r37712  
    5757        , m_fNestedPagingEnabled(false)
    5858        , m_iRAMSize(-1)
    59         , m_cCPUCount(-1) {}
     59        , m_cCPUCount(-1)
     60        , m_cCPUExecCap(-1) {}
    6061    /* Functions: */
    6162    bool equal(const UIDataSettingsMachineSystem &other) const
     
    7374               (m_fNestedPagingEnabled == other.m_fNestedPagingEnabled) &&
    7475               (m_iRAMSize == other.m_iRAMSize) &&
    75                (m_cCPUCount == other.m_cCPUCount);
     76               (m_cCPUCount == other.m_cCPUCount) &&
     77               (m_cCPUExecCap == other.m_cCPUExecCap);
    7678    }
    7779    /* Operators: */
     
    9294    int m_iRAMSize;
    9395    int m_cCPUCount;
     96    int m_cCPUExecCap;
    9497};
    9598typedef UISettingsCache<UIDataSettingsMachineSystem> UICacheSettingsMachineSystem;
     
    149152    void valueChangedCPU (int aVal);
    150153    void textChangedCPU (const QString &aText);
     154    void sltValueChangedCPUExecCap(int iValue);
     155    void sltTextChangedCPUExecCap(const QString &strText);
    151156
    152157private:
     
    162167    uint mMinGuestCPU;
    163168    uint mMaxGuestCPU;
     169    uint mMinGuestCPUExecCap;
     170    uint mMedGuestCPUExecCap;
     171    uint mMaxGuestCPUExecCap;
    164172
    165173    QList<KDeviceType> m_possibleBootItems;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui

    r34348 r37712  
    539539       </item>
    540540       <item row="2" column="0">
    541         <widget class="QLabel" name="mLbProcessorExtended">
    542          <property name="text">
    543           <string>Extended Features:</string>
     541        <widget class="QLabel" name="mLbCPUExecCap">
     542         <property name="sizePolicy">
     543          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
     544           <horstretch>0</horstretch>
     545           <verstretch>0</verstretch>
     546          </sizepolicy>
     547         </property>
     548         <property name="text">
     549          <string>&amp;CPU Execution Cap:</string>
    544550         </property>
    545551         <property name="alignment">
    546552          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    547553         </property>
    548         </widget>
    549        </item>
    550        <item row="2" column="1" colspan="2">
     554         <property name="buddy">
     555          <cstring>mLeCPUExecCap</cstring>
     556         </property>
     557        </widget>
     558       </item>
     559       <item row="2" column="1" rowspan="2">
     560        <layout class="QVBoxLayout" name="mLtCPUExecCapSlider">
     561         <property name="spacing">
     562          <number>0</number>
     563         </property>
     564         <item>
     565          <widget class="QIAdvancedSlider" name="mSlCPUExecCap">
     566           <property name="whatsThis">
     567            <string>Controls the CPU execution cap of each virtual CPU. It defines how much cycles each virtual CPU can use as a percent of host's CPU. 100% = unlimited.</string>
     568           </property>
     569           <property name="maximum">
     570            <number>4096</number>
     571           </property>
     572           <property name="singleStep">
     573            <number>200</number>
     574           </property>
     575           <property name="value">
     576            <number>512</number>
     577           </property>
     578           <property name="orientation">
     579            <enum>Qt::Horizontal</enum>
     580           </property>
     581           <property name="tickPosition">
     582            <enum>QSlider::TicksBelow</enum>
     583           </property>
     584          </widget>
     585         </item>
     586         <item>
     587          <layout class="QHBoxLayout" name="mLtCPUExecCapLegend">
     588           <property name="spacing">
     589            <number>0</number>
     590           </property>
     591           <item>
     592            <widget class="QLabel" name="mLbCPUExecCapMin">
     593             <property name="sizePolicy">
     594              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
     595               <horstretch>0</horstretch>
     596               <verstretch>0</verstretch>
     597              </sizepolicy>
     598             </property>
     599            </widget>
     600           </item>
     601           <item>
     602            <spacer name="mSpHor5">
     603             <property name="orientation">
     604              <enum>Qt::Horizontal</enum>
     605             </property>
     606             <property name="sizeHint" stdset="0">
     607              <size>
     608               <width>0</width>
     609               <height>0</height>
     610              </size>
     611             </property>
     612            </spacer>
     613           </item>
     614           <item>
     615            <widget class="QLabel" name="mLbCPUExecCapMax">
     616             <property name="sizePolicy">
     617              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
     618               <horstretch>0</horstretch>
     619               <verstretch>0</verstretch>
     620              </sizepolicy>
     621             </property>
     622             <property name="alignment">
     623              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     624             </property>
     625            </widget>
     626           </item>
     627          </layout>
     628         </item>
     629        </layout>
     630       </item>
     631       <item row="2" column="2">
     632        <widget class="QILineEdit" name="mLeCPUExecCap">
     633         <property name="sizePolicy">
     634          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
     635           <horstretch>0</horstretch>
     636           <verstretch>0</verstretch>
     637          </sizepolicy>
     638         </property>
     639         <property name="whatsThis">
     640          <string>Controls the CPU execution cap of each virtual CPU. It defines how much cycles each virtual CPU can use as a percent of host's CPU. 100% = unlimited.</string>
     641         </property>
     642        </widget>
     643       </item>
     644       <item row="4" column="0">
     645        <widget class="QLabel" name="mLbProcessorExtended">
     646         <property name="text">
     647          <string>Extended Features:</string>
     648         </property>
     649         <property name="alignment">
     650          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     651         </property>
     652        </widget>
     653       </item>
     654       <item row="4" column="1" colspan="2">
    551655        <widget class="QCheckBox" name="mCbPae">
    552656         <property name="sizePolicy">
     
    564668        </widget>
    565669       </item>
    566        <item row="3" column="0" colspan="3">
     670       <item row="5" column="0" colspan="3">
    567671        <spacer name="mSpVer3">
    568672         <property name="orientation">
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