Changeset 66243 in vbox
- Timestamp:
- Mar 24, 2017 12:08:14 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114164
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r66183 r66243 165 165 } 166 166 167 void UIMachineSettingsAudio::setOrderAfter(QWidget *pWidget)168 {169 /* Audio-page order: */170 setTabOrder(pWidget, m_pCheckBoxAudio);171 setTabOrder(m_pCheckBoxAudio, m_pComboAudioDriver);172 setTabOrder(m_pComboAudioDriver, m_pComboAudioController);173 }174 175 167 void UIMachineSettingsAudio::retranslateUi() 176 168 { 177 169 /* Translate generated strings: */ 178 170 Ui::UIMachineSettingsAudio::retranslateUi(this); 179 180 171 181 172 /* Translate audio-driver combo. 182 173 * Make sure this order corresponds the same in prepareComboboxes(): */ 183 174 int iIndex = -1; 184 185 175 m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_Null)); 186 187 176 #ifdef Q_OS_WIN 188 177 m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_DirectSound)); … … 191 180 # endif /* VBOX_WITH_WINMM */ 192 181 #endif /* Q_OS_WIN */ 193 194 182 #ifdef VBOX_WITH_AUDIO_OSS 195 183 m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_OSS)); 196 184 #endif 197 198 185 #ifdef VBOX_WITH_AUDIO_ALSA 199 186 m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_ALSA)); 200 187 #endif 201 202 188 #ifdef VBOX_WITH_AUDIO_PULSE 203 189 m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_Pulse)); 204 190 #endif 205 206 191 #ifdef Q_OS_MACX 207 192 m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_CoreAudio)); 208 193 #endif /* Q_OS_MACX */ 209 194 210 211 195 /* Translate audio-controller combo. 212 196 * Make sure this order corresponds the same in prepareComboboxes(): */ 213 197 iIndex = -1; 214 215 198 m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_HDA)); 216 199 m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_AC97)); … … 242 225 * Make sure this order corresponds the same in retranslateUi(): */ 243 226 int iIndex = -1; 244 245 227 m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Null); 246 247 228 #ifdef Q_OS_WIN 248 229 m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_DirectSound); … … 267 248 * Make sure this order corresponds the same in retranslateUi(): */ 268 249 iIndex = -1; 269 270 250 m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_HDA); 271 251 m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_AC97); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
r66190 r66243 60 60 virtual void saveFromCacheTo(QVariant &data) /* overrride */; 61 61 62 /** Defines TAB order. */63 virtual void setOrderAfter(QWidget *pWidget) /* override */;64 65 62 /** Handles translation event. */ 66 63 virtual void retranslateUi() /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r66183 r66243 870 870 prepareVideoCaptureTab(); 871 871 872 /* Prepare validation: */873 prepareValidation();874 875 872 /* Translate finally: */ 876 873 retranslateUi(); … … 933 930 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorGuestScreenScale, 5); 934 931 connect(m_pEditorGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleEditorChange())); 932 933 /* Prepare advanced options: */ 934 connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), this, SLOT(revalidate())); 935 #ifdef VBOX_WITH_VIDEOHWACCEL 936 connect(m_pCheckbox2DVideo, SIGNAL(stateChanged(int)), this, SLOT(revalidate())); 937 #endif 935 938 } 936 939 937 940 void UIMachineSettingsDisplay::prepareRemoteDisplayTab() 938 941 { 939 /* Setup validators: */ 942 /* Prepare check-box: */ 943 connect(m_pCheckboxRemoteDisplay, SIGNAL(toggled(bool)), this, SLOT(revalidate())); 944 945 /* Prepare port/timeout editors: */ 940 946 m_pEditorRemoteDisplayPort->setValidator(new QRegExpValidator(QRegExp("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this)); 941 947 m_pEditorRemoteDisplayTimeout->setValidator(new QIntValidator(this)); 948 connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString &)), this, SLOT(revalidate())); 949 connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString &)), this, SLOT(revalidate())); 942 950 943 951 /* Prepare auth-method combo: */ … … 1029 1037 } 1030 1038 1031 void UIMachineSettingsDisplay::prepareValidation()1032 {1033 /* Configure validation: */1034 connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));1035 #ifdef VBOX_WITH_VIDEOHWACCEL1036 connect(m_pCheckbox2DVideo, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));1037 #endif /* VBOX_WITH_VIDEOHWACCEL */1038 connect(m_pCheckboxRemoteDisplay, SIGNAL(toggled(bool)), this, SLOT(revalidate()));1039 connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate()));1040 connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate()));1041 }1042 1043 1039 void UIMachineSettingsDisplay::checkVRAMRequirements() 1044 1040 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r66190 r66243 47 47 /* API: Correlation stuff: */ 48 48 void setGuestOSType(CGuestOSType guestOSType); 49 49 50 #ifdef VBOX_WITH_VIDEOHWACCEL 50 51 bool isAcceleration2DVideoSelected() const; … … 112 113 /** Prepare routine: Video Capture tab. */ 113 114 void prepareVideoCaptureTab(); 114 /** Prepare routine: Validation. */115 void prepareValidation();116 115 117 116 /* Helpers: Video stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r66183 r66243 312 312 } 313 313 314 void UIMachineSettingsInterface::setOrderAfter(QWidget *pWidget)315 {316 /* Tab-order: */317 setTabOrder(pWidget, m_pCheckBoxShowMiniToolBar);318 setTabOrder(m_pCheckBoxShowMiniToolBar, m_pComboToolBarAlignment);319 }320 321 314 void UIMachineSettingsInterface::retranslateUi() 322 315 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r66190 r66243 61 61 virtual void saveFromCacheTo(QVariant &data) /* overrride */; 62 62 63 /** Defines TAB order. */64 virtual void setOrderAfter(QWidget *pWidget) /* override */;65 66 63 /** Handles translation event. */ 67 64 virtual void retranslateUi() /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r66183 r66243 24 24 25 25 /* GUI includes: */ 26 # include "QITabWidget.h" 26 27 # include "QIWidgetValidator.h" 27 # include "QITabWidget.h"28 28 # include "UIMachineSettingsParallel.h" 29 29 # include "VBoxGlobal.h" -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r66190 r66243 236 236 }; 237 237 238 238 239 UIMachineSettingsSF::UIMachineSettingsSF() 239 240 : mNewAction(0), mEdtAction(0), mDelAction(0) … … 296 297 } 297 298 298 void UIMachineSettingsSF::resizeEvent (QResizeEvent *aEvent)299 {300 NOREF(aEvent);301 adjustList();302 }303 304 299 bool UIMachineSettingsSF::changed() const 305 300 { … … 476 471 } 477 472 478 void UIMachineSettingsSF::setOrderAfter (QWidget *aWidget)479 {480 setTabOrder (aWidget, mTwFolders);481 }482 483 473 void UIMachineSettingsSF::retranslateUi() 484 474 { … … 512 502 /* Update root items visibility: */ 513 503 updateRootItemsVisibility(); 504 } 505 506 void UIMachineSettingsSF::showEvent (QShowEvent *aEvent) 507 { 508 UISettingsPageMachine::showEvent (aEvent); 509 510 /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized. */ 511 connect (mTwFolders->header(), SIGNAL (sectionResized (int, int, int)), this, SLOT (adjustFields())); 512 513 /* Adjusting size after all pending show events are processed. */ 514 QTimer::singleShot (0, this, SLOT (adjustList())); 515 } 516 517 void UIMachineSettingsSF::resizeEvent (QResizeEvent *aEvent) 518 { 519 NOREF(aEvent); 520 adjustList(); 514 521 } 515 522 … … 598 605 if (aCurrentItem && aCurrentItem->parent() && !aCurrentItem->isSelected()) 599 606 aCurrentItem->setSelected (true); 600 QString key = !aCurrentItem ? QString::null : aCurrentItem->parent() ?601 aCurrentItem->parent()->text (1) : aCurrentItem->text (1);602 607 bool addEnabled = aCurrentItem; 603 608 bool removeEnabled = addEnabled && aCurrentItem->parent(); … … 677 682 } 678 683 679 void UIMachineSettingsSF::showEvent (QShowEvent *aEvent)680 {681 UISettingsPageMachine::showEvent (aEvent);682 683 /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized. */684 connect (mTwFolders->header(), SIGNAL (sectionResized (int, int, int)), this, SLOT (adjustFields()));685 686 /* Adjusting size after all pending show events are processed. */687 QTimer::singleShot (0, this, SLOT (adjustList()));688 }689 690 684 SFTreeViewItem* UIMachineSettingsSF::root(UISharedFolderType sharedFolderType) 691 685 { … … 807 801 } 808 802 return sharedFolders; 809 }810 811 bool UIMachineSettingsSF::removeSharedFolder(const UISettingsCacheSharedFolder &folderCache)812 {813 /* Get shared folder data: */814 const UIDataSettingsSharedFolder &folderData = folderCache.base();815 QString strName = folderData.m_strName;816 QString strPath = folderData.m_strHostPath;817 UISharedFolderType sharedFoldersType = folderData.m_type;818 819 /* Get current shared folders: */820 CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType);821 /* Check that such shared folder really exists: */822 CSharedFolder sharedFolder;823 for (int iSharedFolderIndex = 0; iSharedFolderIndex < sharedFolders.size(); ++iSharedFolderIndex)824 if (sharedFolders[iSharedFolderIndex].GetName() == strName)825 sharedFolder = sharedFolders[iSharedFolderIndex];826 if (!sharedFolder.isNull())827 {828 /* Remove existing shared folder: */829 switch(sharedFoldersType)830 {831 case MachineType:832 {833 m_machine.RemoveSharedFolder(strName);834 if (!m_machine.isOk())835 {836 /* Mark the page as failed: */837 setFailed(true);838 /* Show error message: */839 msgCenter().cannotRemoveSharedFolder(m_machine, strName, strPath, this);840 /* Finish early: */841 return false;842 }843 break;844 }845 case ConsoleType:846 {847 m_console.RemoveSharedFolder(strName);848 if (!m_console.isOk())849 {850 /* Mark the page as failed: */851 setFailed(true);852 /* Show error message: */853 msgCenter().cannotRemoveSharedFolder(m_console, strName, strPath, this);854 /* Finish early: */855 return false;856 }857 break;858 }859 default:860 break;861 }862 }863 return true;864 803 } 865 804 … … 922 861 } 923 862 863 bool UIMachineSettingsSF::removeSharedFolder(const UISettingsCacheSharedFolder &folderCache) 864 { 865 /* Get shared folder data: */ 866 const UIDataSettingsSharedFolder &folderData = folderCache.base(); 867 QString strName = folderData.m_strName; 868 QString strPath = folderData.m_strHostPath; 869 UISharedFolderType sharedFoldersType = folderData.m_type; 870 871 /* Get current shared folders: */ 872 CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType); 873 /* Check that such shared folder really exists: */ 874 CSharedFolder sharedFolder; 875 for (int iSharedFolderIndex = 0; iSharedFolderIndex < sharedFolders.size(); ++iSharedFolderIndex) 876 if (sharedFolders[iSharedFolderIndex].GetName() == strName) 877 sharedFolder = sharedFolders[iSharedFolderIndex]; 878 if (!sharedFolder.isNull()) 879 { 880 /* Remove existing shared folder: */ 881 switch(sharedFoldersType) 882 { 883 case MachineType: 884 { 885 m_machine.RemoveSharedFolder(strName); 886 if (!m_machine.isOk()) 887 { 888 /* Mark the page as failed: */ 889 setFailed(true); 890 /* Show error message: */ 891 msgCenter().cannotRemoveSharedFolder(m_machine, strName, strPath, this); 892 /* Finish early: */ 893 return false; 894 } 895 break; 896 } 897 case ConsoleType: 898 { 899 m_console.RemoveSharedFolder(strName); 900 if (!m_console.isOk()) 901 { 902 /* Mark the page as failed: */ 903 setFailed(true); 904 /* Show error message: */ 905 msgCenter().cannotRemoveSharedFolder(m_console, strName, strPath, this); 906 /* Finish early: */ 907 return false; 908 } 909 break; 910 } 911 default: 912 break; 913 } 914 } 915 return true; 916 } 917 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
r66190 r66243 73 73 void saveFromCacheTo(UISharedFolderType sharedFoldersType); 74 74 75 /** Defines TAB order. */76 virtual void setOrderAfter(QWidget *pWidget) /* override */;77 78 75 /** Handles translation event. */ 79 76 virtual void retranslateUi() /* override */; … … 81 78 /** Performs final page polishing. */ 82 79 virtual void polishPage() /* override */; 80 81 /** Handles show @a pEvent. */ 82 virtual void showEvent(QShowEvent *aEvent) /* override */; 83 84 /** Handles resize @a pEvent. */ 85 virtual void resizeEvent(QResizeEvent *pEvent) /* override */; 83 86 84 87 private slots: … … 97 100 private: 98 101 99 void resizeEvent (QResizeEvent *aEvent);100 101 void showEvent (QShowEvent *aEvent);102 103 102 SFTreeViewItem* root(UISharedFolderType type); 104 103 SFoldersNameList usedList (bool aIncludeSelected); … … 110 109 CSharedFolderVector getSharedFolders(UISharedFolderType sharedFoldersType); 111 110 111 bool createSharedFolder(const UISettingsCacheSharedFolder &folderCache); 112 112 bool removeSharedFolder(const UISettingsCacheSharedFolder &folderCache); 113 bool createSharedFolder(const UISettingsCacheSharedFolder &folderCache);114 113 115 114 QAction *mNewAction; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r66190 r66243 197 197 }; 198 198 UIIconPoolStorageSettings* iconPool() { return UIIconPoolStorageSettings::instance(); } 199 199 200 200 201 /* static */ … … 443 444 } 444 445 446 445 447 /* IDE Controller Type */ 446 448 IDEControllerType::IDEControllerType (KStorageControllerType aSubType) … … 459 461 } 460 462 463 461 464 /* SATA Controller Type */ 462 465 SATAControllerType::SATAControllerType (KStorageControllerType aSubType) … … 475 478 } 476 479 480 477 481 /* SCSI Controller Type */ 478 482 SCSIControllerType::SCSIControllerType (KStorageControllerType aSubType) … … 491 495 } 492 496 497 493 498 /* Floppy Controller Type */ 494 499 FloppyControllerType::FloppyControllerType (KStorageControllerType aSubType) … … 507 512 } 508 513 514 509 515 /* SAS Controller Type */ 510 516 SASControllerType::SASControllerType (KStorageControllerType aSubType) … … 523 529 } 524 530 531 525 532 /* USB Controller Type */ 526 533 USBStorageControllerType::USBStorageControllerType (KStorageControllerType aSubType) … … 539 546 } 540 547 548 541 549 /* NVMe Controller Type */ 542 550 NVMeStorageControllerType::NVMeStorageControllerType (KStorageControllerType aSubType) … … 554 562 return 1; 555 563 } 564 556 565 557 566 /* Abstract Item */ … … 600 609 } 601 610 611 602 612 /* Root Item */ 603 613 RootItem::RootItem(QITreeView *pParent) … … 676 686 mControllers.removeAll (aItem); 677 687 } 688 678 689 679 690 /* Controller Item */ … … 873 884 } 874 885 886 875 887 /* Attachment Item */ 876 888 AttachmentItem::AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType) … … 1135 1147 { 1136 1148 } 1149 1137 1150 1138 1151 /* Storage model */ … … 1967 1980 } 1968 1981 1982 1969 1983 /* Storage Delegate */ 1970 1984 StorageDelegate::StorageDelegate (QObject *aParent) … … 2074 2088 } 2075 2089 2090 2076 2091 /** 2077 2092 * UI Medium ID Holder. … … 2116 2131 , mAddHDAttAction(0), mAddCDAttAction(0), mAddFDAttAction(0) 2117 2132 , m_pMediumIdHolder(new UIMediumIDHolder(this)) 2133 , mIsPolished(false) 2118 2134 , mIsLoadingInProgress(0) 2119 , mIsPolished(false)2120 , mDisableStaticControls(0)2121 2135 , m_pCache(new UISettingsCacheMachineStorage) 2122 2136 { … … 2608 2622 } 2609 2623 2624 void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel) 2625 { 2626 /* Update model 'configuration access level': */ 2627 mStorageModel->setConfigurationAccessLevel(newConfigurationAccessLevel); 2628 /* Update 'configuration access level' of base class: */ 2629 UISettingsPageMachine::setConfigurationAccessLevel(newConfigurationAccessLevel); 2630 } 2631 2610 2632 void UIMachineSettingsStorage::retranslateUi() 2611 2633 { … … 2828 2850 { 2829 2851 QModelIndex index = mTwStorageTree->currentIndex(); 2830 if (!mStorageModel->data (index, StorageModel::R_IsController).toBool()) return; 2852 if (!mStorageModel->data (index, StorageModel::R_IsController).toBool()) 2853 return; 2831 2854 2832 2855 mStorageModel->delController (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString())); … … 3064 3087 { 3065 3088 QModelIndex index = mTwStorageTree->currentIndex(); 3066 if (mIsLoadingInProgress || !index.isValid() || index == mStorageModel->root()) return; 3089 if (mIsLoadingInProgress || !index.isValid() || index == mStorageModel->root()) 3090 return; 3067 3091 3068 3092 QObject *sdr = sender(); … … 3365 3389 void UIMachineSettingsStorage::onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) 3366 3390 { 3367 if (!aIndex.parent().isValid() || !aIndex.parent().parent().isValid()) return; 3391 if (!aIndex.parent().isValid() || !aIndex.parent().parent().isValid()) 3392 return; 3368 3393 3369 3394 aPainter->save(); … … 3843 3868 KStorageBus controllerBus = controllerData.m_controllerBus; 3844 3869 KStorageControllerType controllerType = controllerData.m_controllerType; 3870 bool fUseHostIOCache = controllerData.m_fUseHostIOCache; 3845 3871 ULONG uPortCount = controllerData.m_uPortCount; 3846 bool fUseHostIOCache = controllerData.m_fUseHostIOCache;3847 3872 3848 3873 /* Check that storage controller doesn't exists: */ … … 3899 3924 KStorageBus controllerBus = controllerData.m_controllerBus; 3900 3925 KStorageControllerType controllerType = controllerData.m_controllerType; 3926 bool fUseHostIOCache = controllerData.m_fUseHostIOCache; 3901 3927 ULONG uPortCount = controllerData.m_uPortCount; 3902 bool fUseHostIOCache = controllerData.m_fUseHostIOCache;3903 3928 3904 3929 /* Check that controller exists: */ … … 4185 4210 } 4186 4211 4187 void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)4188 {4189 /* Update model 'configuration access level': */4190 mStorageModel->setConfigurationAccessLevel(newConfigurationAccessLevel);4191 /* Update 'configuration access level' of base class: */4192 UISettingsPageMachine::setConfigurationAccessLevel(newConfigurationAccessLevel);4193 }4194 4195 4212 # include "UIMachineSettingsStorage.moc" 4196 4213 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r66190 r66243 591 591 592 592 void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const; 593 594 bool mDisableStaticControls;595 593 }; 596 594 … … 601 599 { 602 600 Q_OBJECT; 601 602 signals: 603 604 void storageChanged(); 603 605 604 606 public: … … 610 612 611 613 void setChipsetType(KChipsetType type); 612 613 signals:614 615 void storageChanged();616 614 617 615 protected: … … 636 634 /** Performs validation, updates @a messages list if something is wrong. */ 637 635 virtual bool validate(QList<UIValidationMessage> &messages) /* override */; 636 637 /** Defines the configuration access @a enmLevel. */ 638 virtual void setConfigurationAccessLevel(ConfigurationAccessLevel enmLevel) /* override */; 638 639 639 640 /** Handles translation event. */ … … 721 722 bool isControllerCouldBeUpdated(const UISettingsCacheMachineStorageController &controllerCache) const; 722 723 bool isAttachmentCouldBeUpdated(const UISettingsCacheMachineStorageAttachment &attachmentCache) const; 723 724 /** Defines configuration access level. */725 void setConfigurationAccessLevel(ConfigurationAccessLevel configurationAccessLevel);726 724 727 725 QString m_strMachineId; … … 751 749 UIMediumIDHolder *m_pMediumIdHolder; 752 750 753 bool mIsLoadingInProgress; 754 bool mIsPolished; 755 bool mDisableStaticControls; 751 bool mIsPolished; 752 bool mIsLoadingInProgress; 756 753 757 754 /** Holds the page data cache instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r66183 r66243 632 632 } 633 633 634 void UIMachineSettingsSystem::sltHandleMemorySizeSliderChange()635 {636 /* Apply new memory-size value: */637 m_pEditorMemorySize->blockSignals(true);638 m_pEditorMemorySize->setValue(m_pSliderMemorySize->value());639 m_pEditorMemorySize->blockSignals(false);640 641 /* Revalidate: */642 revalidate();643 }644 645 void UIMachineSettingsSystem::sltHandleMemorySizeEditorChange()646 {647 /* Apply new memory-size value: */648 m_pSliderMemorySize->blockSignals(true);649 m_pSliderMemorySize->setValue(m_pEditorMemorySize->value());650 m_pSliderMemorySize->blockSignals(false);651 652 /* Revalidate: */653 revalidate();654 }655 656 void UIMachineSettingsSystem::sltCurrentBootItemChanged(int iCurrentItem)657 {658 /* Update boot-order tool-buttons: */659 bool fEnabledUP = iCurrentItem > 0;660 bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1;661 if ((mTbBootItemUp->hasFocus() && !fEnabledUP) ||662 (mTbBootItemDown->hasFocus() && !fEnabledDOWN))663 mTwBootOrder->setFocus();664 mTbBootItemUp->setEnabled(fEnabledUP);665 mTbBootItemDown->setEnabled(fEnabledDOWN);666 }667 668 void UIMachineSettingsSystem::sltHandleCPUCountSliderChange()669 {670 /* Apply new memory-size value: */671 m_pEditorCPUCount->blockSignals(true);672 m_pEditorCPUCount->setValue(m_pSliderCPUCount->value());673 m_pEditorCPUCount->blockSignals(false);674 675 /* Revalidate: */676 revalidate();677 }678 679 void UIMachineSettingsSystem::sltHandleCPUCountEditorChange()680 {681 /* Apply new memory-size value: */682 m_pSliderCPUCount->blockSignals(true);683 m_pSliderCPUCount->setValue(m_pEditorCPUCount->value());684 m_pSliderCPUCount->blockSignals(false);685 686 /* Revalidate: */687 revalidate();688 }689 690 void UIMachineSettingsSystem::sltHandleCPUExecCapSliderChange()691 {692 /* Apply new memory-size value: */693 m_pEditorCPUExecCap->blockSignals(true);694 m_pEditorCPUExecCap->setValue(m_pSliderCPUExecCap->value());695 m_pEditorCPUExecCap->blockSignals(false);696 697 /* Revalidate: */698 revalidate();699 }700 701 void UIMachineSettingsSystem::sltHandleCPUExecCapEditorChange()702 {703 /* Apply new memory-size value: */704 m_pSliderCPUExecCap->blockSignals(true);705 m_pSliderCPUExecCap->setValue(m_pEditorCPUExecCap->value());706 m_pSliderCPUExecCap->blockSignals(false);707 708 /* Revalidate: */709 revalidate();710 }711 712 void UIMachineSettingsSystem::prepare()713 {714 /* Apply UI decorations: */715 Ui::UIMachineSettingsSystem::setupUi(this);716 717 /* Prepare tabs: */718 prepareTabMotherboard();719 prepareTabProcessor();720 prepareTabAcceleration();721 722 /* Prepare validation: */723 prepareValidation();724 725 /* Retranslate finally: */726 retranslateUi();727 }728 729 void UIMachineSettingsSystem::prepareTabMotherboard()730 {731 /* Load configuration: */732 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();733 734 /* Preconfigure memory-size editor: */735 m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM());736 m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM());737 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5);738 739 /* Preconfigure boot-table widgets: */740 mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png"));741 mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png"));742 #ifdef VBOX_WS_MAC743 /* We need a little space for the focus rect: */744 m_pLayoutBootOrder->setContentsMargins(3, 3, 3, 3);745 m_pLayoutBootOrder->setSpacing(3);746 #endif /* VBOX_WS_MAC */747 /* Install global event filter748 * to handle boot-table focus in/out events: */749 /// @todo Get rid of that *crap*!750 qApp->installEventFilter(this);751 752 /* Populate possible boot items list.753 * Currently, it seems, we are supporting only 4 possible boot device types:754 * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network.755 * But maximum boot devices count supported by machine756 * should be retrieved through the ISystemProperties getter.757 * Moreover, possible boot device types are not listed in some separate Main vector,758 * so we should get them (randomely?) from the list of all device types.759 * Until there will be separate Main getter for list of supported boot device types,760 * this list will be hard-coded here... */761 int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());762 for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition)763 {764 switch (iBootPosition)765 {766 case 1: m_possibleBootItems << KDeviceType_Floppy; break;767 case 2: m_possibleBootItems << KDeviceType_DVD; break;768 case 3: m_possibleBootItems << KDeviceType_HardDisk; break;769 case 4: m_possibleBootItems << KDeviceType_Network; break;770 default: break;771 }772 }773 /* Add all available devices types, so we could initially calculate the right size: */774 for (int i = 0; i < m_possibleBootItems.size(); ++i)775 {776 QListWidgetItem *pItem = new UIBootTableItem(m_possibleBootItems[i]);777 mTwBootOrder->addItem(pItem);778 }779 780 /* Populate 'chipset type' combo: */781 m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));782 m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9));783 784 /* Preconfigure 'pointing HID type' combo: */785 m_pComboPointingHIDType->setSizeAdjustPolicy(QComboBox::AdjustToContents);786 787 /* Install memory-size widget connections: */788 connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeSliderChange()));789 connect(m_pEditorMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeEditorChange()));790 791 /* Install boot-table connections: */792 connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp()));793 connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown()));794 connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltCurrentBootItemChanged(int)));795 }796 797 void UIMachineSettingsSystem::prepareTabProcessor()798 {799 /* Load configuration: */800 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();801 uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();802 m_uMinGuestCPU = properties.GetMinGuestCPUCount();803 m_uMaxGuestCPU = qMin(2 * hostCPUs, (uint)properties.GetMaxGuestCPUCount());804 m_uMinGuestCPUExecCap = 1;805 m_uMedGuestCPUExecCap = 40;806 m_uMaxGuestCPUExecCap = 100;807 808 /* Preconfigure CPU-count slider: */809 m_pSliderCPUCount->setPageStep(1);810 m_pSliderCPUCount->setSingleStep(1);811 m_pSliderCPUCount->setTickInterval(1);812 m_pSliderCPUCount->setMinimum(m_uMinGuestCPU);813 m_pSliderCPUCount->setMaximum(m_uMaxGuestCPU);814 m_pSliderCPUCount->setOptimalHint(1, hostCPUs);815 m_pSliderCPUCount->setWarningHint(hostCPUs, m_uMaxGuestCPU);816 817 /* Preconfigure CPU-count editor: */818 m_pEditorCPUCount->setMinimum(m_uMinGuestCPU);819 m_pEditorCPUCount->setMaximum(m_uMaxGuestCPU);820 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUCount, 4);821 822 /* Preconfigure CPU-execution-cap slider: */823 m_pSliderCPUExecCap->setPageStep(10);824 m_pSliderCPUExecCap->setSingleStep(1);825 m_pSliderCPUExecCap->setTickInterval(10);826 /* Setup the scale so that ticks are at page step boundaries: */827 m_pSliderCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);828 m_pSliderCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);829 m_pSliderCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap);830 m_pSliderCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap);831 832 /* Preconfigure CPU-execution-cap editor: */833 m_pEditorCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);834 m_pEditorCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);835 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUExecCap, 4);836 837 /* Install CPU widget connections: */838 connect(m_pSliderCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountSliderChange()));839 connect(m_pEditorCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountEditorChange()));840 connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange()));841 connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange()));842 }843 844 void UIMachineSettingsSystem::prepareTabAcceleration()845 {846 /* Populate 'paravirt provider' combo: */847 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_None), QVariant(KParavirtProvider_None));848 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Default), QVariant(KParavirtProvider_Default));849 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Legacy), QVariant(KParavirtProvider_Legacy));850 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Minimal), QVariant(KParavirtProvider_Minimal));851 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_HyperV), QVariant(KParavirtProvider_HyperV));852 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_KVM), QVariant(KParavirtProvider_KVM));853 854 /* Hide VT-x/AMD-V checkbox when raw-mode is not supported: */855 #ifndef VBOX_WITH_RAW_MODE856 m_pWidgetPlaceholder->setVisible(false);857 m_pCheckBoxVirtualization->setVisible(false);858 #endif /* !VBOX_WITH_RAW_MODE */859 }860 861 void UIMachineSettingsSystem::prepareValidation()862 {863 /* Prepare validation: */864 connect(m_pComboChipsetType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));865 connect(m_pComboPointingHIDType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));866 connect(m_pCheckBoxApic, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));867 connect(m_pCheckBoxVirtualization, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));868 }869 870 void UIMachineSettingsSystem::repopulateComboPointingHIDType()871 {872 /* Is there any value currently present/selected? */873 KPointingHIDType currentValue = KPointingHIDType_None;874 {875 int iCurrentIndex = m_pComboPointingHIDType->currentIndex();876 if (iCurrentIndex != -1)877 currentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt();878 }879 880 /* Clear combo: */881 m_pComboPointingHIDType->clear();882 883 /* Repopulate combo taking into account currently cached value: */884 KPointingHIDType cachedValue = m_pCache->base().m_pointingHIDType;885 {886 /* "PS/2 Mouse" value is always here: */887 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_PS2Mouse), (int)KPointingHIDType_PS2Mouse);888 889 /* "USB Mouse" value is here only if it is currently selected: */890 if (cachedValue == KPointingHIDType_USBMouse)891 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMouse), (int)KPointingHIDType_USBMouse);892 893 /* "USB Mouse/Tablet" value is always here: */894 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBTablet), (int)KPointingHIDType_USBTablet);895 896 /* "PS/2 and USB Mouse" value is here only if it is currently selected: */897 if (cachedValue == KPointingHIDType_ComboMouse)898 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_ComboMouse), (int)KPointingHIDType_ComboMouse);899 900 /* "USB Multi-Touch Mouse/Tablet" value is always here: */901 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMultiTouch), (int)KPointingHIDType_USBMultiTouch);902 }903 904 /* Was there any value previously present/selected? */905 if (currentValue != KPointingHIDType_None)906 {907 int iPreviousIndex = m_pComboPointingHIDType->findData((int)currentValue);908 if (iPreviousIndex != -1)909 m_pComboPointingHIDType->setCurrentIndex(iPreviousIndex);910 }911 }912 913 void UIMachineSettingsSystem::retranslateComboChipsetType()914 {915 /* For each the element in KChipsetType enum: */916 for (int iIndex = (int)KChipsetType_Null; iIndex < (int)KChipsetType_Max; ++iIndex)917 {918 /* Cast to the corresponding type: */919 KChipsetType type = (KChipsetType)iIndex;920 /* Look for the corresponding item: */921 int iCorrespondingIndex = m_pComboChipsetType->findData((int)type);922 /* Re-translate if corresponding item was found: */923 if (iCorrespondingIndex != -1)924 m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(type));925 }926 }927 928 void UIMachineSettingsSystem::retranslateComboPointingHIDType()929 {930 /* For each the element in KPointingHIDType enum: */931 for (int iIndex = (int)KPointingHIDType_None; iIndex < (int)KPointingHIDType_Max; ++iIndex)932 {933 /* Cast to the corresponding type: */934 KPointingHIDType type = (KPointingHIDType)iIndex;935 /* Look for the corresponding item: */936 int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)type);937 /* Re-translate if corresponding item was found: */938 if (iCorrespondingIndex != -1)939 m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(type));940 }941 }942 943 void UIMachineSettingsSystem::retranslateComboParavirtProvider()944 {945 /* For each the element in KParavirtProvider enum: */946 for (int iIndex = (int)KParavirtProvider_None; iIndex < (int)KParavirtProvider_Max; ++iIndex)947 {948 /* Cast to the corresponding type: */949 KParavirtProvider type = (KParavirtProvider)iIndex;950 /* Look for the corresponding item: */951 int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)type);952 /* Re-translate if corresponding item was found: */953 if (iCorrespondingIndex != -1)954 m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString(type));955 }956 }957 958 void UIMachineSettingsSystem::adjustBootOrderTWSize()959 {960 /* Adjust boot-table size: */961 mTwBootOrder->adjustSizeToFitContent();962 /* Update the layout system */963 if (m_pTabMotherboard->layout())964 {965 m_pTabMotherboard->layout()->activate();966 m_pTabMotherboard->layout()->update();967 }968 }969 970 634 bool UIMachineSettingsSystem::eventFilter(QObject *pObject, QEvent *pEvent) 971 635 { … … 1008 672 } 1009 673 674 void UIMachineSettingsSystem::sltHandleMemorySizeSliderChange() 675 { 676 /* Apply new memory-size value: */ 677 m_pEditorMemorySize->blockSignals(true); 678 m_pEditorMemorySize->setValue(m_pSliderMemorySize->value()); 679 m_pEditorMemorySize->blockSignals(false); 680 681 /* Revalidate: */ 682 revalidate(); 683 } 684 685 void UIMachineSettingsSystem::sltHandleMemorySizeEditorChange() 686 { 687 /* Apply new memory-size value: */ 688 m_pSliderMemorySize->blockSignals(true); 689 m_pSliderMemorySize->setValue(m_pEditorMemorySize->value()); 690 m_pSliderMemorySize->blockSignals(false); 691 692 /* Revalidate: */ 693 revalidate(); 694 } 695 696 void UIMachineSettingsSystem::sltCurrentBootItemChanged(int iCurrentItem) 697 { 698 /* Update boot-order tool-buttons: */ 699 bool fEnabledUP = iCurrentItem > 0; 700 bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1; 701 if ((mTbBootItemUp->hasFocus() && !fEnabledUP) || 702 (mTbBootItemDown->hasFocus() && !fEnabledDOWN)) 703 mTwBootOrder->setFocus(); 704 mTbBootItemUp->setEnabled(fEnabledUP); 705 mTbBootItemDown->setEnabled(fEnabledDOWN); 706 } 707 708 void UIMachineSettingsSystem::sltHandleCPUCountSliderChange() 709 { 710 /* Apply new memory-size value: */ 711 m_pEditorCPUCount->blockSignals(true); 712 m_pEditorCPUCount->setValue(m_pSliderCPUCount->value()); 713 m_pEditorCPUCount->blockSignals(false); 714 715 /* Revalidate: */ 716 revalidate(); 717 } 718 719 void UIMachineSettingsSystem::sltHandleCPUCountEditorChange() 720 { 721 /* Apply new memory-size value: */ 722 m_pSliderCPUCount->blockSignals(true); 723 m_pSliderCPUCount->setValue(m_pEditorCPUCount->value()); 724 m_pSliderCPUCount->blockSignals(false); 725 726 /* Revalidate: */ 727 revalidate(); 728 } 729 730 void UIMachineSettingsSystem::sltHandleCPUExecCapSliderChange() 731 { 732 /* Apply new memory-size value: */ 733 m_pEditorCPUExecCap->blockSignals(true); 734 m_pEditorCPUExecCap->setValue(m_pSliderCPUExecCap->value()); 735 m_pEditorCPUExecCap->blockSignals(false); 736 737 /* Revalidate: */ 738 revalidate(); 739 } 740 741 void UIMachineSettingsSystem::sltHandleCPUExecCapEditorChange() 742 { 743 /* Apply new memory-size value: */ 744 m_pSliderCPUExecCap->blockSignals(true); 745 m_pSliderCPUExecCap->setValue(m_pEditorCPUExecCap->value()); 746 m_pSliderCPUExecCap->blockSignals(false); 747 748 /* Revalidate: */ 749 revalidate(); 750 } 751 752 void UIMachineSettingsSystem::prepare() 753 { 754 /* Apply UI decorations: */ 755 Ui::UIMachineSettingsSystem::setupUi(this); 756 757 /* Prepare tabs: */ 758 prepareTabMotherboard(); 759 prepareTabProcessor(); 760 prepareTabAcceleration(); 761 762 /* Retranslate finally: */ 763 retranslateUi(); 764 } 765 766 void UIMachineSettingsSystem::prepareTabMotherboard() 767 { 768 /* Load configuration: */ 769 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 770 771 /* Preconfigure memory-size editor: */ 772 m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM()); 773 m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM()); 774 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5); 775 776 /* Preconfigure boot-table widgets: */ 777 mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png")); 778 mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png")); 779 #ifdef VBOX_WS_MAC 780 /* We need a little space for the focus rect: */ 781 m_pLayoutBootOrder->setContentsMargins(3, 3, 3, 3); 782 m_pLayoutBootOrder->setSpacing(3); 783 #endif /* VBOX_WS_MAC */ 784 /* Install global event filter 785 * to handle boot-table focus in/out events: */ 786 /// @todo Get rid of that *crap*! 787 qApp->installEventFilter(this); 788 789 /* Populate possible boot items list. 790 * Currently, it seems, we are supporting only 4 possible boot device types: 791 * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network. 792 * But maximum boot devices count supported by machine 793 * should be retrieved through the ISystemProperties getter. 794 * Moreover, possible boot device types are not listed in some separate Main vector, 795 * so we should get them (randomely?) from the list of all device types. 796 * Until there will be separate Main getter for list of supported boot device types, 797 * this list will be hard-coded here... */ 798 int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition()); 799 for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition) 800 { 801 switch (iBootPosition) 802 { 803 case 1: m_possibleBootItems << KDeviceType_Floppy; break; 804 case 2: m_possibleBootItems << KDeviceType_DVD; break; 805 case 3: m_possibleBootItems << KDeviceType_HardDisk; break; 806 case 4: m_possibleBootItems << KDeviceType_Network; break; 807 default: break; 808 } 809 } 810 /* Add all available devices types, so we could initially calculate the right size: */ 811 for (int i = 0; i < m_possibleBootItems.size(); ++i) 812 { 813 QListWidgetItem *pItem = new UIBootTableItem(m_possibleBootItems[i]); 814 mTwBootOrder->addItem(pItem); 815 } 816 817 /* Populate 'chipset type' combo: */ 818 m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3)); 819 m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9)); 820 connect(m_pComboChipsetType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate())); 821 822 /* Preconfigure 'pointing HID type' combo: */ 823 m_pComboPointingHIDType->setSizeAdjustPolicy(QComboBox::AdjustToContents); 824 connect(m_pComboPointingHIDType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate())); 825 826 /* Install memory-size widget connections: */ 827 connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeSliderChange())); 828 connect(m_pEditorMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeEditorChange())); 829 830 /* Install boot-table connections: */ 831 connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp())); 832 connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown())); 833 connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltCurrentBootItemChanged(int))); 834 835 /* Advanced options: */ 836 connect(m_pCheckBoxApic, SIGNAL(stateChanged(int)), this, SLOT(revalidate())); 837 } 838 839 void UIMachineSettingsSystem::prepareTabProcessor() 840 { 841 /* Load configuration: */ 842 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 843 uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount(); 844 m_uMinGuestCPU = properties.GetMinGuestCPUCount(); 845 m_uMaxGuestCPU = qMin(2 * hostCPUs, (uint)properties.GetMaxGuestCPUCount()); 846 m_uMinGuestCPUExecCap = 1; 847 m_uMedGuestCPUExecCap = 40; 848 m_uMaxGuestCPUExecCap = 100; 849 850 /* Preconfigure CPU-count slider: */ 851 m_pSliderCPUCount->setPageStep(1); 852 m_pSliderCPUCount->setSingleStep(1); 853 m_pSliderCPUCount->setTickInterval(1); 854 m_pSliderCPUCount->setMinimum(m_uMinGuestCPU); 855 m_pSliderCPUCount->setMaximum(m_uMaxGuestCPU); 856 m_pSliderCPUCount->setOptimalHint(1, hostCPUs); 857 m_pSliderCPUCount->setWarningHint(hostCPUs, m_uMaxGuestCPU); 858 859 /* Preconfigure CPU-count editor: */ 860 m_pEditorCPUCount->setMinimum(m_uMinGuestCPU); 861 m_pEditorCPUCount->setMaximum(m_uMaxGuestCPU); 862 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUCount, 4); 863 864 /* Preconfigure CPU-execution-cap slider: */ 865 m_pSliderCPUExecCap->setPageStep(10); 866 m_pSliderCPUExecCap->setSingleStep(1); 867 m_pSliderCPUExecCap->setTickInterval(10); 868 /* Setup the scale so that ticks are at page step boundaries: */ 869 m_pSliderCPUExecCap->setMinimum(m_uMinGuestCPUExecCap); 870 m_pSliderCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap); 871 m_pSliderCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap); 872 m_pSliderCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap); 873 874 /* Preconfigure CPU-execution-cap editor: */ 875 m_pEditorCPUExecCap->setMinimum(m_uMinGuestCPUExecCap); 876 m_pEditorCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap); 877 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUExecCap, 4); 878 879 /* Install CPU widget connections: */ 880 connect(m_pSliderCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountSliderChange())); 881 connect(m_pEditorCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountEditorChange())); 882 connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange())); 883 connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange())); 884 } 885 886 void UIMachineSettingsSystem::prepareTabAcceleration() 887 { 888 /* Populate 'paravirt provider' combo: */ 889 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_None), QVariant(KParavirtProvider_None)); 890 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Default), QVariant(KParavirtProvider_Default)); 891 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Legacy), QVariant(KParavirtProvider_Legacy)); 892 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Minimal), QVariant(KParavirtProvider_Minimal)); 893 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_HyperV), QVariant(KParavirtProvider_HyperV)); 894 m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_KVM), QVariant(KParavirtProvider_KVM)); 895 896 /* Hide VT-x/AMD-V checkbox when raw-mode is not supported: */ 897 #ifndef VBOX_WITH_RAW_MODE 898 m_pWidgetPlaceholder->setVisible(false); 899 m_pCheckBoxVirtualization->setVisible(false); 900 #endif /* !VBOX_WITH_RAW_MODE */ 901 902 /* Advanced options: */ 903 connect(m_pCheckBoxVirtualization, SIGNAL(stateChanged(int)), this, SLOT(revalidate())); 904 } 905 906 void UIMachineSettingsSystem::repopulateComboPointingHIDType() 907 { 908 /* Is there any value currently present/selected? */ 909 KPointingHIDType currentValue = KPointingHIDType_None; 910 { 911 int iCurrentIndex = m_pComboPointingHIDType->currentIndex(); 912 if (iCurrentIndex != -1) 913 currentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt(); 914 } 915 916 /* Clear combo: */ 917 m_pComboPointingHIDType->clear(); 918 919 /* Repopulate combo taking into account currently cached value: */ 920 KPointingHIDType cachedValue = m_pCache->base().m_pointingHIDType; 921 { 922 /* "PS/2 Mouse" value is always here: */ 923 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_PS2Mouse), (int)KPointingHIDType_PS2Mouse); 924 925 /* "USB Mouse" value is here only if it is currently selected: */ 926 if (cachedValue == KPointingHIDType_USBMouse) 927 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMouse), (int)KPointingHIDType_USBMouse); 928 929 /* "USB Mouse/Tablet" value is always here: */ 930 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBTablet), (int)KPointingHIDType_USBTablet); 931 932 /* "PS/2 and USB Mouse" value is here only if it is currently selected: */ 933 if (cachedValue == KPointingHIDType_ComboMouse) 934 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_ComboMouse), (int)KPointingHIDType_ComboMouse); 935 936 /* "USB Multi-Touch Mouse/Tablet" value is always here: */ 937 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMultiTouch), (int)KPointingHIDType_USBMultiTouch); 938 } 939 940 /* Was there any value previously present/selected? */ 941 if (currentValue != KPointingHIDType_None) 942 { 943 int iPreviousIndex = m_pComboPointingHIDType->findData((int)currentValue); 944 if (iPreviousIndex != -1) 945 m_pComboPointingHIDType->setCurrentIndex(iPreviousIndex); 946 } 947 } 948 949 void UIMachineSettingsSystem::retranslateComboChipsetType() 950 { 951 /* For each the element in KChipsetType enum: */ 952 for (int iIndex = (int)KChipsetType_Null; iIndex < (int)KChipsetType_Max; ++iIndex) 953 { 954 /* Cast to the corresponding type: */ 955 KChipsetType type = (KChipsetType)iIndex; 956 /* Look for the corresponding item: */ 957 int iCorrespondingIndex = m_pComboChipsetType->findData((int)type); 958 /* Re-translate if corresponding item was found: */ 959 if (iCorrespondingIndex != -1) 960 m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(type)); 961 } 962 } 963 964 void UIMachineSettingsSystem::retranslateComboPointingHIDType() 965 { 966 /* For each the element in KPointingHIDType enum: */ 967 for (int iIndex = (int)KPointingHIDType_None; iIndex < (int)KPointingHIDType_Max; ++iIndex) 968 { 969 /* Cast to the corresponding type: */ 970 KPointingHIDType type = (KPointingHIDType)iIndex; 971 /* Look for the corresponding item: */ 972 int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)type); 973 /* Re-translate if corresponding item was found: */ 974 if (iCorrespondingIndex != -1) 975 m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(type)); 976 } 977 } 978 979 void UIMachineSettingsSystem::retranslateComboParavirtProvider() 980 { 981 /* For each the element in KParavirtProvider enum: */ 982 for (int iIndex = (int)KParavirtProvider_None; iIndex < (int)KParavirtProvider_Max; ++iIndex) 983 { 984 /* Cast to the corresponding type: */ 985 KParavirtProvider type = (KParavirtProvider)iIndex; 986 /* Look for the corresponding item: */ 987 int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)type); 988 /* Re-translate if corresponding item was found: */ 989 if (iCorrespondingIndex != -1) 990 m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString(type)); 991 } 992 } 993 994 void UIMachineSettingsSystem::adjustBootOrderTWSize() 995 { 996 /* Adjust boot-table size: */ 997 mTwBootOrder->adjustSizeToFitContent(); 998 /* Update the layout system */ 999 if (m_pTabMotherboard->layout()) 1000 { 1001 m_pTabMotherboard->layout()->activate(); 1002 m_pTabMotherboard->layout()->update(); 1003 } 1004 } 1005 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r66190 r66243 78 78 virtual void polishPage() /* override */; 79 79 80 /** Preprocesses any Qt @a pEvent for passed @a pObject. */ 81 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */; 82 80 83 private slots: 81 84 … … 100 103 void prepareTabProcessor(); 101 104 void prepareTabAcceleration(); 102 void prepareValidation();103 105 104 106 /* Helper: Pointing HID type combo stuff: */ … … 112 114 /* Helper: Boot-table stuff: */ 113 115 void adjustBootOrderTWSize(); 114 115 /* Handler: Event-filtration stuff: */116 bool eventFilter(QObject *aObject, QEvent *aEvent);117 116 118 117 /* Variable: Boot-table stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r66190 r66243 37 37 /* COM includes: */ 38 38 # include "CConsole.h" 39 # include "CExtPack.h" 40 # include "CExtPackManager.h" 41 # include "CHostUSBDevice.h" 42 # include "CHostUSBDeviceFilter.h" 39 43 # include "CUSBController.h" 40 # include "CUSBDeviceFilters.h"41 44 # include "CUSBDevice.h" 42 45 # include "CUSBDeviceFilter.h" 43 # include "CHostUSBDevice.h" 44 # include "CHostUSBDeviceFilter.h" 45 # include "CExtPackManager.h" 46 # include "CExtPack.h" 46 # include "CUSBDeviceFilters.h" 47 47 48 48 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 328 328 329 329 /* Setup connections */ 330 connect(mGbUSB, SIGNAL(stateChanged(int)), this, SLOT(revalidate())); 331 connect(mRbUSB1, SIGNAL(toggled(bool)), this, SLOT(revalidate())); 332 connect(mRbUSB2, SIGNAL(toggled(bool)), this, SLOT(revalidate())); 333 connect(mRbUSB3, SIGNAL(toggled(bool)), this, SLOT(revalidate())); 334 330 335 connect (mGbUSB, SIGNAL (toggled (bool)), 331 336 this, SLOT (usbAdapterToggled (bool))); … … 357 362 /* Setup dialog */ 358 363 mTwFilters->header()->hide(); 359 360 /* Prepare validation: */361 prepareValidation();362 364 363 365 /* Applying language settings */ … … 785 787 } 786 788 789 void UIMachineSettingsUSB::showContextMenu(const QPoint &pos) 790 { 791 QMenu menu; 792 if (mTwFilters->isEnabled()) 793 { 794 menu.addAction(mNewAction); 795 menu.addAction(mAddAction); 796 menu.addSeparator(); 797 menu.addAction(mEdtAction); 798 menu.addSeparator(); 799 menu.addAction(mDelAction); 800 menu.addSeparator(); 801 menu.addAction(mMupAction); 802 menu.addAction(mMdnAction); 803 } 804 if (!menu.isEmpty()) 805 menu.exec(mTwFilters->mapToGlobal(pos)); 806 } 807 808 void UIMachineSettingsUSB::sltUpdateActivityState(QTreeWidgetItem *pChangedItem) 809 { 810 /* Check changed USB filter item: */ 811 Assert(pChangedItem); 812 813 /* Delete corresponding items: */ 814 UIDataSettingsMachineUSBFilter &data = m_filters[mTwFilters->indexOfTopLevelItem(pChangedItem)]; 815 data.m_fActive = pChangedItem->checkState(0) == Qt::Checked; 816 } 817 787 818 void UIMachineSettingsUSB::newClicked() 788 819 { … … 946 977 } 947 978 948 void UIMachineSettingsUSB::showContextMenu(const QPoint &pos)949 {950 QMenu menu;951 if (mTwFilters->isEnabled())952 {953 menu.addAction(mNewAction);954 menu.addAction(mAddAction);955 menu.addSeparator();956 menu.addAction(mEdtAction);957 menu.addSeparator();958 menu.addAction(mDelAction);959 menu.addSeparator();960 menu.addAction(mMupAction);961 menu.addAction(mMdnAction);962 }963 if (!menu.isEmpty())964 menu.exec(mTwFilters->mapToGlobal(pos));965 }966 967 void UIMachineSettingsUSB::sltUpdateActivityState(QTreeWidgetItem *pChangedItem)968 {969 /* Check changed USB filter item: */970 Assert(pChangedItem);971 972 /* Delete corresponding items: */973 UIDataSettingsMachineUSBFilter &data = m_filters[mTwFilters->indexOfTopLevelItem(pChangedItem)];974 data.m_fActive = pChangedItem->checkState(0) == Qt::Checked;975 }976 977 void UIMachineSettingsUSB::prepareValidation()978 {979 /* Prepare validation: */980 connect(mGbUSB, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));981 connect(mRbUSB1, SIGNAL(toggled(bool)), this, SLOT(revalidate()));982 connect(mRbUSB2, SIGNAL(toggled(bool)), this, SLOT(revalidate()));983 connect(mRbUSB3, SIGNAL(toggled(bool)), this, SLOT(revalidate()));984 }985 986 979 void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew) 987 980 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r66190 r66243 40 40 public: 41 41 42 enum RemoteMode 43 { 44 ModeAny = 0, 45 ModeOn, 46 ModeOff 47 }; 42 enum { ModeAny, ModeOn, ModeOff }; 48 43 49 44 /** Constructs USB settings page. */ … … 88 83 89 84 void usbAdapterToggled(bool fEnabled); 85 90 86 void currentChanged (QTreeWidgetItem *aItem = 0); 87 void showContextMenu(const QPoint &pos); 88 void sltUpdateActivityState(QTreeWidgetItem *pChangedItem); 91 89 92 90 void newClicked(); … … 97 95 void mupClicked(); 98 96 void mdnClicked(); 99 void showContextMenu(const QPoint &pos);100 void sltUpdateActivityState(QTreeWidgetItem *pChangedItem);101 97 102 98 private: 103 104 /* Helper: Prepare stuff: */105 void prepareValidation();106 99 107 100 void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew); … … 119 112 QAction *mMdnAction; 120 113 VBoxUSBMenu *mUSBDevicesMenu; 114 121 115 QString mUSBFilterName; 116 122 117 QList<UIDataSettingsMachineUSBFilter> m_filters; 123 118
Note:
See TracChangeset
for help on using the changeset viewer.