- Timestamp:
- Jun 6, 2013 1:57:01 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r46411 r46413 64 64 #endif /* VBOX_WITH_CRHGSMI */ 65 65 { 66 /* Apply UI decorations */67 Ui::UIMachineSettingsDisplay::setupUi 68 69 /* Setup constants*/66 /* Apply UI decorations: */ 67 Ui::UIMachineSettingsDisplay::setupUi(this); 68 69 /* Prepare variables: */ 70 70 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 71 71 m_iMinVRAM = sys.GetMinGuestVRAM(); 72 72 m_iMaxVRAM = sys.GetMaxGuestVRAM(); 73 73 m_iMaxVRAMVisible = m_iMaxVRAM; 74 const uint cMinGuestScreens = 1;75 74 #if (QT_VERSION >= 0x040600) 76 75 const uint cHostScreens = QApplication::desktop()->screenCount(); … … 78 77 const uint cHostScreens = QApplication::desktop()->numScreens(); 79 78 #endif /* !(QT_VERSION >= 0x040600) */ 79 const uint cMinGuestScreens = 1; 80 80 const uint cMaxGuestScreens = sys.GetMaxGuestMonitors(); 81 81 82 /* Setup validators */ 83 m_pEditorMemory->setValidator (new QIntValidator (m_iMinVRAM, m_iMaxVRAMVisible, this)); 84 m_pEditorScreens->setValidator (new QIntValidator (cMinGuestScreens, cMaxGuestScreens, this)); 85 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)); 86 m_pEditorRemoteDisplayTimeout->setValidator (new QIntValidator (this)); 87 88 /* Setup connections */ 89 connect (m_pSliderMemory, SIGNAL (valueChanged (int)), this, SLOT (sltValueChangedVRAM (int))); 90 connect (m_pEditorMemory, SIGNAL (textChanged (const QString&)), this, SLOT (sltTextChangedVRAM (const QString&))); 91 connect (m_pSliderScreeens, SIGNAL (valueChanged (int)), this, SLOT (sltValueChangedScreens (int))); 92 connect (m_pEditorScreens, SIGNAL (textChanged (const QString&)), this, SLOT (sltTextChangedScreens (const QString&))); 93 94 /* Setup initial values */ 95 m_pSliderMemory->setPageStep (calcPageStep (m_iMaxVRAMVisible)); 96 m_pSliderMemory->setSingleStep (m_pSliderMemory->pageStep() / 4); 97 m_pSliderMemory->setTickInterval (m_pSliderMemory->pageStep()); 98 m_pSliderScreeens->setPageStep (1); 99 m_pSliderScreeens->setSingleStep (1); 100 m_pSliderScreeens->setTickInterval (1); 101 /* Setup the scale so that ticks are at page step boundaries */ 102 m_pSliderMemory->setMinimum ((m_iMinVRAM / m_pSliderMemory->pageStep()) * m_pSliderMemory->pageStep()); 103 m_pSliderMemory->setMaximum (m_iMaxVRAMVisible); 104 m_pSliderMemory->setSnappingEnabled (true); 105 m_pSliderMemory->setErrorHint (0, 1); 106 m_pSliderScreeens->setMinimum (cMinGuestScreens); 107 m_pSliderScreeens->setMaximum (cMaxGuestScreens); 108 m_pSliderScreeens->setErrorHint (0, cMinGuestScreens); 109 m_pSliderScreeens->setOptimalHint (cMinGuestScreens, cHostScreens); 110 m_pSliderScreeens->setWarningHint (cHostScreens, cMaxGuestScreens); 111 /* Limit min/max. size of QLineEdit */ 112 m_pEditorMemory->setFixedWidthByText (QString().fill ('8', 4)); 113 m_pEditorScreens->setFixedWidthByText (QString().fill ('8', 4)); 114 /* Ensure value and validation is updated */ 115 sltValueChangedVRAM (m_pSliderMemory->value()); 116 sltValueChangedScreens (m_pSliderScreeens->value()); 117 /* Setup VRDE widget */ 118 m_pComboRemoteDisplayAuthMethod->insertItem (0, ""); /* KAuthType_Null */ 119 m_pComboRemoteDisplayAuthMethod->insertItem (1, ""); /* KAuthType_External */ 120 m_pComboRemoteDisplayAuthMethod->insertItem (2, ""); /* KAuthType_Guest */ 121 82 /* Setup validators: */ 83 m_pEditorMemory->setValidator(new QIntValidator(m_iMinVRAM, m_iMaxVRAMVisible, this)); 84 m_pEditorScreens->setValidator(new QIntValidator(cMinGuestScreens, cMaxGuestScreens, this)); 85 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)); 86 m_pEditorRemoteDisplayTimeout->setValidator(new QIntValidator(this)); 87 88 /* Setup connections: */ 89 connect(m_pSliderMemory, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedVRAM(int))); 90 connect(m_pEditorMemory, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedVRAM(const QString&))); 91 connect(m_pSliderScreeens, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedScreens(int))); 92 connect(m_pEditorScreens, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedScreens(const QString&))); 93 94 /* Setup widgets: */ 95 m_pSliderMemory->setPageStep(calcPageStep(m_iMaxVRAMVisible)); 96 m_pSliderMemory->setSingleStep(m_pSliderMemory->pageStep() / 4); 97 m_pSliderMemory->setTickInterval(m_pSliderMemory->pageStep()); 98 m_pSliderScreeens->setPageStep(1); 99 m_pSliderScreeens->setSingleStep(1); 100 m_pSliderScreeens->setTickInterval(1); 101 /* Setup the scale so that ticks are at page step boundaries: */ 102 m_pSliderMemory->setMinimum((m_iMinVRAM / m_pSliderMemory->pageStep()) * m_pSliderMemory->pageStep()); 103 m_pSliderMemory->setMaximum(m_iMaxVRAMVisible); 104 m_pSliderMemory->setSnappingEnabled(true); 105 m_pSliderMemory->setErrorHint(0, 1); 106 m_pSliderScreeens->setMinimum(cMinGuestScreens); 107 m_pSliderScreeens->setMaximum(cMaxGuestScreens); 108 m_pSliderScreeens->setErrorHint(0, cMinGuestScreens); 109 m_pSliderScreeens->setOptimalHint(cMinGuestScreens, cHostScreens); 110 m_pSliderScreeens->setWarningHint(cHostScreens, cMaxGuestScreens); 111 /* Limit min/max. size of QLineEdit: */ 112 m_pEditorMemory->setFixedWidthByText(QString().fill('8', 4)); 113 m_pEditorScreens->setFixedWidthByText(QString().fill('8', 4)); 114 /* Ensure value and validation is updated: */ 115 sltValueChangedVRAM(m_pSliderMemory->value()); 116 sltValueChangedScreens(m_pSliderScreeens->value()); 122 117 #ifndef VBOX_WITH_VIDEOHWACCEL 123 mCb2DVideo->setVisible (false); 124 #endif /* VBOX_WITH_VIDEOHWACCEL */ 125 126 /* Applying language settings */ 118 /* Hide check-box if not supported: */ 119 mCb2DVideo->setVisible(false); 120 #endif /* VBOX_WITH_VIDEOHWACCEL */ 121 122 /* Prepare auth-method combo: */ 123 m_pComboRemoteDisplayAuthMethod->insertItem(0, ""); /* KAuthType_Null */ 124 m_pComboRemoteDisplayAuthMethod->insertItem(1, ""); /* KAuthType_External */ 125 m_pComboRemoteDisplayAuthMethod->insertItem(2, ""); /* KAuthType_Guest */ 126 127 /* Translate finally: */ 127 128 retranslateUi(); 128 129 } … … 172 173 UIDataSettingsMachineDisplay displayData; 173 174 174 /* Gather displaydata: */175 /* Cache Video data: */ 175 176 displayData.m_iCurrentVRAM = m_machine.GetVRAMSize(); 176 177 displayData.m_cGuestScreenCount = m_machine.GetMonitorCount(); … … 179 180 displayData.m_f2dAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled(); 180 181 #endif /* VBOX_WITH_VIDEOHWACCEL */ 181 /* Check if VRDE server is valid: */ 182 183 /* Check if Remote Display server is valid: */ 182 184 CVRDEServer remoteDisplayServer = m_machine.GetVRDEServer(); 183 185 displayData.m_fRemoteDisplayServerSupported = !remoteDisplayServer.isNull(); 184 186 if (!remoteDisplayServer.isNull()) 185 187 { 188 /* Cache Remote Display data: */ 186 189 displayData.m_fRemoteDisplayServerEnabled = remoteDisplayServer.GetEnabled(); 187 190 displayData.m_strRemoteDisplayPort = remoteDisplayServer.GetVRDEProperty("TCP/Ports"); … … 208 211 const UIDataSettingsMachineDisplay &displayData = m_cache.base(); 209 212 210 /* Load displaydata to page: */213 /* Load Video data to page: */ 211 214 m_pSliderScreeens->setValue(displayData.m_cGuestScreenCount); 212 215 mCb3D->setChecked(displayData.m_f3dAccelerationEnabled); … … 216 219 checkVRAMRequirements(); 217 220 m_pSliderMemory->setValue(displayData.m_iCurrentVRAM); 221 222 /* If Remote Display server is supported: */ 218 223 if (displayData.m_fRemoteDisplayServerSupported) 219 224 { 225 /* Load Remote Display data to page: */ 220 226 m_pCheckboxRemoteDisplay->setChecked(displayData.m_fRemoteDisplayServerEnabled); 221 227 m_pEditorRemoteDisplayPort->setText(displayData.m_strRemoteDisplayPort); … … 240 246 UIDataSettingsMachineDisplay displayData = m_cache.base(); 241 247 242 /* Gather display data: */248 /* Gather Video data from page: */ 243 249 displayData.m_iCurrentVRAM = m_pSliderMemory->value(); 244 250 displayData.m_cGuestScreenCount = m_pSliderScreeens->value(); … … 247 253 displayData.m_f2dAccelerationEnabled = mCb2DVideo->isChecked(); 248 254 #endif /* VBOX_WITH_VIDEOHWACCEL */ 255 256 /* If Remote Display server is supported: */ 249 257 if (displayData.m_fRemoteDisplayServerSupported) 250 258 { 259 /* Gather Remote Display data from page: */ 251 260 displayData.m_fRemoteDisplayServerEnabled = m_pCheckboxRemoteDisplay->isChecked(); 252 261 displayData.m_strRemoteDisplayPort = m_pEditorRemoteDisplayPort->text(); … … 273 282 const UIDataSettingsMachineDisplay &displayData = m_cache.data(); 274 283 275 /* Store displaydata: */284 /* Store Video data: */ 276 285 if (isMachineOffline()) 277 286 { … … 284 293 #endif /* VBOX_WITH_VIDEOHWACCEL */ 285 294 } 286 /* Check if VRDE server still valid: */ 295 296 /* Check if Remote Display server still valid: */ 287 297 CVRDEServer remoteDisplayServer = m_machine.GetVRDEServer(); 288 298 if (!remoteDisplayServer.isNull()) 289 299 { 290 /* Store VRDEdata: */300 /* Store Remote Display data: */ 291 301 if (isMachineInValidMode()) 292 302 { … … 310 320 { 311 321 m_pValidator = pValidator; 312 connect (mCb3D, SIGNAL (stateChanged (int)), 313 m_pValidator, SLOT (revalidate())); 314 #ifdef VBOX_WITH_VIDEOHWACCEL 315 connect (mCb2DVideo, SIGNAL (stateChanged (int)), 316 m_pValidator, SLOT (revalidate())); 317 #endif /* VBOX_WITH_VIDEOHWACCEL */ 318 connect (m_pCheckboxRemoteDisplay, SIGNAL (toggled (bool)), 319 m_pValidator, SLOT (revalidate())); 320 connect (m_pEditorRemoteDisplayPort, SIGNAL (textChanged (const QString&)), 321 m_pValidator, SLOT (revalidate())); 322 connect (m_pEditorRemoteDisplayTimeout, SIGNAL (textChanged (const QString&)), 323 m_pValidator, SLOT (revalidate())); 322 connect(mCb3D, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 323 #ifdef VBOX_WITH_VIDEOHWACCEL 324 connect(mCb2DVideo, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 325 #endif /* VBOX_WITH_VIDEOHWACCEL */ 326 connect(m_pCheckboxRemoteDisplay, SIGNAL(toggled(bool)), m_pValidator, SLOT(revalidate())); 327 connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 328 connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 324 329 } 325 330 … … 399 404 } 400 405 401 void UIMachineSettingsDisplay::setOrderAfter 406 void UIMachineSettingsDisplay::setOrderAfter(QWidget *pWidget) 402 407 { 403 408 /* Video tab-order */ 404 setTabOrder 405 setTabOrder 406 setTabOrder 407 setTabOrder 408 setTabOrder 409 setTabOrder 410 #ifdef VBOX_WITH_VIDEOHWACCEL 411 setTabOrder 412 setTabOrder 409 setTabOrder(pWidget, m_pTabWidget->focusProxy()); 410 setTabOrder(m_pTabWidget->focusProxy(), m_pSliderMemory); 411 setTabOrder(m_pSliderMemory, m_pEditorMemory); 412 setTabOrder(m_pEditorMemory, m_pSliderScreeens); 413 setTabOrder(m_pSliderScreeens, m_pEditorScreens); 414 setTabOrder(m_pEditorScreens, mCb3D); 415 #ifdef VBOX_WITH_VIDEOHWACCEL 416 setTabOrder(mCb3D, mCb2DVideo); 417 setTabOrder(mCb2DVideo, m_pCheckboxRemoteDisplay); 413 418 #else /* VBOX_WITH_VIDEOHWACCEL */ 414 setTabOrder 419 setTabOrder(mCb3D, m_pCheckboxRemoteDisplay); 415 420 #endif /* !VBOX_WITH_VIDEOHWACCEL */ 416 421 417 /* Remote display tab-order*/418 setTabOrder 419 setTabOrder 420 setTabOrder 421 setTabOrder 422 /* Remote Display tab-order: */ 423 setTabOrder(m_pCheckboxRemoteDisplay, m_pEditorRemoteDisplayPort); 424 setTabOrder(m_pEditorRemoteDisplayPort, m_pComboRemoteDisplayAuthMethod); 425 setTabOrder(m_pComboRemoteDisplayAuthMethod, m_pEditorRemoteDisplayTimeout); 426 setTabOrder(m_pEditorRemoteDisplayTimeout, m_pCheckboxMultipleConn); 422 427 } 423 428 … … 425 430 { 426 431 /* Translate uic generated strings */ 427 Ui::UIMachineSettingsDisplay::retranslateUi (this); 428 432 Ui::UIMachineSettingsDisplay::retranslateUi(this); 433 434 /* Video stuff: */ 429 435 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 430 m_pLabelMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (m_iMinVRAM)); 431 m_pLabelMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (m_iMaxVRAMVisible)); 432 m_pLabelScreensMin->setText (tr ("<qt>%1</qt>").arg (1)); 433 m_pLabelScreensMax->setText (tr ("<qt>%1</qt>").arg (sys.GetMaxGuestMonitors())); 434 435 m_pComboRemoteDisplayAuthMethod->setItemText (0, 436 gpConverter->toString (KAuthType_Null)); 437 m_pComboRemoteDisplayAuthMethod->setItemText (1, 438 gpConverter->toString (KAuthType_External)); 439 m_pComboRemoteDisplayAuthMethod->setItemText (2, 440 gpConverter->toString (KAuthType_Guest)); 441 } 442 443 void UIMachineSettingsDisplay::sltValueChangedVRAM (int iValue) 444 { 445 m_pEditorMemory->setText (QString::number (iValue)); 446 } 447 448 void UIMachineSettingsDisplay::sltTextChangedVRAM (const QString &strText) 449 { 450 m_pSliderMemory->setValue (strText.toInt()); 451 } 452 453 void UIMachineSettingsDisplay::sltValueChangedScreens (int iValue) 454 { 455 m_pEditorScreens->setText (QString::number (iValue)); 436 m_pLabelMemoryMin->setText(tr("<qt>%1 MB</qt>").arg(m_iMinVRAM)); 437 m_pLabelMemoryMin->setText(tr("<qt>%1 MB</qt>").arg(m_iMaxVRAMVisible)); 438 m_pLabelScreensMin->setText(tr("<qt>%1</qt>").arg(1)); 439 m_pLabelScreensMax->setText(tr("<qt>%1</qt>").arg(sys.GetMaxGuestMonitors())); 440 441 /* Remote Display stuff: */ 442 m_pComboRemoteDisplayAuthMethod->setItemText(0, gpConverter->toString(KAuthType_Null)); 443 m_pComboRemoteDisplayAuthMethod->setItemText(1, gpConverter->toString(KAuthType_External)); 444 m_pComboRemoteDisplayAuthMethod->setItemText(2, gpConverter->toString(KAuthType_Guest)); 445 } 446 447 void UIMachineSettingsDisplay::sltValueChangedVRAM(int iValue) 448 { 449 m_pEditorMemory->setText(QString::number(iValue)); 450 } 451 452 void UIMachineSettingsDisplay::sltTextChangedVRAM(const QString &strText) 453 { 454 m_pSliderMemory->setValue(strText.toInt()); 455 } 456 457 void UIMachineSettingsDisplay::sltValueChangedScreens(int iValue) 458 { 459 m_pEditorScreens->setText(QString::number(iValue)); 456 460 checkVRAMRequirements(); 457 461 } 458 462 459 void UIMachineSettingsDisplay::sltTextChangedScreens 460 { 461 m_pSliderScreeens->setValue 463 void UIMachineSettingsDisplay::sltTextChangedScreens(const QString &strText) 464 { 465 m_pSliderScreeens->setValue(strText.toInt()); 462 466 } 463 467 464 468 void UIMachineSettingsDisplay::checkVRAMRequirements() 465 469 { 470 /* Make sure guest OS type is set: */ 466 471 if (m_guestOSType.isNull()) 467 472 return; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r46411 r46413 30 30 struct UIDataSettingsMachineDisplay 31 31 { 32 /* Default constructor: */32 /* Constructor: */ 33 33 UIDataSettingsMachineDisplay() 34 34 : m_iCurrentVRAM(0) … … 43 43 , m_remoteDisplayAuthType(KAuthType_Null) 44 44 , m_uRemoteDisplayTimeout(0) 45 , m_fRemoteDisplayMultiConnAllowed(false) {} 45 , m_fRemoteDisplayMultiConnAllowed(false) 46 {} 47 46 48 /* Functions: */ 47 49 bool equal(const UIDataSettingsMachineDisplay &other) const … … 60 62 (m_fRemoteDisplayMultiConnAllowed == other.m_fRemoteDisplayMultiConnAllowed); 61 63 } 64 62 65 /* Operators: */ 63 66 bool operator==(const UIDataSettingsMachineDisplay &other) const { return equal(other); } 64 67 bool operator!=(const UIDataSettingsMachineDisplay &other) const { return !equal(other); } 65 /* Variables: */ 68 69 /* Variables: Video stuff: */ 66 70 int m_iCurrentVRAM; 67 71 int m_cGuestScreenCount; … … 70 74 bool m_f2dAccelerationEnabled; 71 75 #endif /* VBOX_WITH_VIDEOHWACCEL */ 76 77 /* Variables: Remote Display stuff: */ 72 78 bool m_fRemoteDisplayServerSupported; 73 79 bool m_fRemoteDisplayServerEnabled; … … 81 87 /* Machine settings / Display page: */ 82 88 class UIMachineSettingsDisplay : public UISettingsPageMachine, 83 public Ui::UIMachineSettingsDisplay89 public Ui::UIMachineSettingsDisplay 84 90 { 85 91 Q_OBJECT; … … 87 93 public: 88 94 95 /* Constructor: */ 89 96 UIMachineSettingsDisplay(); 90 97 98 /* API: Guest OS type stuff: */ 91 99 void setGuestOSType(CGuestOSType guestOSType); 92 100 101 /* API: 2D video acceleration stuff: */ 93 102 #ifdef VBOX_WITH_VIDEOHWACCEL 94 103 bool isAcceleration2DVideoSelected() const; … … 111 120 void saveFromCacheTo(QVariant &data); 112 121 113 /* Page changed: */122 /* API: Cache stuff: */ 114 123 bool changed() const { return m_cache.wasChanged(); } 115 124 125 /* API: Validation stuff: */ 116 126 void setValidator(QIWidgetValidator *pValidator); 117 127 bool revalidate(QString &strWarning, QString &strTitle); 118 128 129 /* API: Focus-order stuff: */ 119 130 void setOrderAfter(QWidget *pWidget); 120 131 132 /* Helper: Translate stuff: */ 121 133 void retranslateUi(); 122 134 123 135 private slots: 124 136 137 /* Handlers: Video stuff: */ 125 138 void sltValueChangedVRAM(int iValue); 126 139 void sltTextChangedVRAM(const QString &strText); … … 130 143 private: 131 144 145 /* Helpers: Video stuff: */ 132 146 void checkVRAMRequirements(); 133 147 bool shouldWeWarnAboutLowVideoMemory(); 134 148 149 /* Helper: Polish stuff: */ 135 150 void polishPage(); 136 151 152 /* Validation stuff: */ 137 153 QIWidgetValidator *m_pValidator; 138 139 154 /* Guest OS type id: */ 140 155 CGuestOSType m_guestOSType;
Note:
See TracChangeset
for help on using the changeset viewer.