Changeset 56751 in vbox
- Timestamp:
- Jul 2, 2015 11:56:11 AM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
r56736 r56751 303 303 } 304 304 305 void UIStatusBarEditorWidget::setStatusBarConfiguration(const QList<IndicatorType> &restrictions, 306 const QList<IndicatorType> &order) 307 { 308 /* Cache passed restrictions: */ 309 m_restrictions = restrictions; 310 311 /* Cache passed order: */ 312 m_order = order; 313 /* Append order with missed indicators: */ 314 for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType) 315 if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension && 316 !m_order.contains((IndicatorType)iType)) 317 m_order << (IndicatorType)iType; 318 319 /* Update configuration for all existing buttons: */ 320 foreach (const IndicatorType &type, m_order) 321 { 322 /* Get button: */ 323 UIStatusBarEditorButton *pButton = m_buttons.value(type); 324 /* Make sure button exists: */ 325 if (!pButton) 326 continue; 327 /* Update button 'checked' state: */ 328 pButton->setChecked(!m_restrictions.contains(type)); 329 /* Make sure it have valid position: */ 330 const int iWantedIndex = position(type); 331 const int iActualIndex = m_pButtonLayout->indexOf(pButton); 332 if (iActualIndex != iWantedIndex) 333 { 334 /* Re-inject button into main-layout at proper position: */ 335 m_pButtonLayout->removeWidget(pButton); 336 m_pButtonLayout->insertWidget(iWantedIndex, pButton); 337 } 338 } 339 } 340 305 341 void UIStatusBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID) 306 342 { … … 309 345 return; 310 346 311 /* Update status buttons: */ 312 updateStatusButtons(); 347 /* Recache status-bar configuration: */ 348 setStatusBarConfiguration(gEDataManager->restrictedStatusBarIndicators(machineID()), 349 gEDataManager->statusBarIndicatorOrder(machineID())); 313 350 } 314 351 … … 322 359 const IndicatorType type = pButton->type(); 323 360 324 /* Load current status-bar indicator restrictions: */325 QList<IndicatorType> restrictions =326 gEDataManager->restrictedStatusBarIndicators(machineID());327 328 361 /* Invert restriction for sender type: */ 329 if ( restrictions.contains(type))330 restrictions.removeAll(type);362 if (m_restrictions.contains(type)) 363 m_restrictions.removeAll(type); 331 364 else 332 restrictions.append(type); 333 334 /* Save updated status-bar indicator restrictions: */ 335 gEDataManager->setRestrictedStatusBarIndicators(restrictions, machineID()); 365 m_restrictions.append(type); 366 367 if (m_fStartedFromVMSettings) 368 { 369 /* Reapply status-bar configuration from cache: */ 370 setStatusBarConfiguration(m_restrictions, m_order); 371 } 372 else 373 { 374 /* Save updated status-bar indicator restrictions: */ 375 gEDataManager->setRestrictedStatusBarIndicators(m_restrictions, machineID()); 376 } 336 377 } 337 378 … … 443 484 } 444 485 445 /* Listen for the status-bar configuration changes if necessary: */446 486 if (!m_fStartedFromVMSettings) 447 487 { 488 /* Cache status-bar configuration: */ 489 setStatusBarConfiguration(gEDataManager->restrictedStatusBarIndicators(machineID()), 490 gEDataManager->statusBarIndicatorOrder(machineID())); 491 /* And listen for the status-bar configuration changes after that: */ 448 492 connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)), 449 493 this, SLOT(sltHandleConfigurationChange(const QString&))); 450 494 } 451 452 /* Update status buttons: */453 updateStatusButtons();454 495 } 455 496 … … 467 508 /* Insert status button into map: */ 468 509 m_buttons.insert(type, pButton); 469 }470 }471 472 void UIStatusBarEditorWidget::updateStatusButtons()473 {474 /* Recache status-bar configuration: */475 m_restrictions = gEDataManager->restrictedStatusBarIndicators(machineID());476 m_order = gEDataManager->statusBarIndicatorOrder(machineID());477 for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)478 if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension &&479 !m_order.contains((IndicatorType)iType))480 m_order << (IndicatorType)iType;481 482 /* Update configuration for all the status buttons: */483 foreach (const IndicatorType &type, m_order)484 {485 /* Get button: */486 UIStatusBarEditorButton *pButton = m_buttons.value(type);487 /* Update button 'checked' state: */488 pButton->setChecked(!m_restrictions.contains(type));489 /* Make sure it have valid position: */490 const int iWantedIndex = position(type);491 const int iActualIndex = m_pButtonLayout->indexOf(pButton);492 if (iActualIndex != iWantedIndex)493 {494 /* Re-inject button into main-layout at proper position: */495 m_pButtonLayout->removeWidget(pButton);496 m_pButtonLayout->insertWidget(iWantedIndex, pButton);497 }498 510 } 499 511 } … … 673 685 return; 674 686 675 /* Load current status-bar indicator order and make sure it's complete: */676 QList<IndicatorType> order =677 gEDataManager->statusBarIndicatorOrder(machineID());678 for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)679 if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension &&680 !order.contains((IndicatorType)iType))681 order << (IndicatorType)iType;682 683 687 /* Remove type of dropped-button: */ 684 order.removeAll(droppedType);688 m_order.removeAll(droppedType); 685 689 /* Insert type of dropped-button into position of token-button: */ 686 int iPosition = order.indexOf(tokenType);690 int iPosition = m_order.indexOf(tokenType); 687 691 if (m_fDropAfterTokenButton) 688 692 ++iPosition; 689 order.insert(iPosition, droppedType); 690 691 /* Save updated status-bar indicator order: */ 692 gEDataManager->setStatusBarIndicatorOrder(order, machineID()); 693 m_order.insert(iPosition, droppedType); 694 695 if (m_fStartedFromVMSettings) 696 { 697 /* Reapply status-bar configuration from cache: */ 698 setStatusBarConfiguration(m_restrictions, m_order); 699 } 700 else 701 { 702 /* Save updated status-bar indicator order: */ 703 gEDataManager->setStatusBarIndicatorOrder(m_order, machineID()); 704 } 693 705 } 694 706 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h
r56736 r56751 78 78 void setStatusBarEnabled(bool fEnabled); 79 79 80 /** Returns status-bar indicator restrictions. */ 81 const QList<IndicatorType>& statusBarIndicatorRestrictions() const { return m_restrictions; } 82 /** Returns status-bar indicator order. */ 83 const QList<IndicatorType>& statusBarIndicatorOrder() const { return m_order; } 84 /** Defines status-bar indicator @a restrictions and @a order. */ 85 void setStatusBarConfiguration(const QList<IndicatorType> &restrictions, const QList<IndicatorType> &order); 86 80 87 private slots: 81 88 … … 97 104 /** Prepare status button routine. */ 98 105 void prepareStatusButton(IndicatorType type); 99 100 /** Update status buttons routine. */101 void updateStatusButtons();102 106 103 107 /** Retranslation routine. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r56736 r56751 56 56 /* Cache interface data: */ 57 57 interfaceData.m_fStatusBarEnabled = gEDataManager->statusBarEnabled(m_machine.GetId()); 58 interfaceData.m_statusBarRestrictions = gEDataManager->restrictedStatusBarIndicators(m_machine.GetId()); 59 interfaceData.m_statusBarOrder = gEDataManager->statusBarIndicatorOrder(m_machine.GetId()); 58 60 #ifndef Q_WS_MAC 59 61 interfaceData.m_fMenuBarEnabled = gEDataManager->menuBarEnabled(m_machine.GetId()); … … 78 80 /* Prepare interface data: */ 79 81 m_pStatusBarEditor->setStatusBarEnabled(interfaceData.m_fStatusBarEnabled); 82 m_pStatusBarEditor->setStatusBarConfiguration(interfaceData.m_statusBarRestrictions, 83 interfaceData.m_statusBarOrder); 80 84 #ifndef Q_WS_MAC 81 85 m_pMenuBarEditor->setMenuBarEnabled(interfaceData.m_fMenuBarEnabled); … … 100 104 /* Gather interface data from page: */ 101 105 interfaceData.m_fStatusBarEnabled = m_pStatusBarEditor->isStatusBarEnabled(); 106 interfaceData.m_statusBarRestrictions = m_pStatusBarEditor->statusBarIndicatorRestrictions(); 107 interfaceData.m_statusBarOrder = m_pStatusBarEditor->statusBarIndicatorOrder(); 102 108 #ifndef Q_WS_MAC 103 109 interfaceData.m_fMenuBarEnabled = m_pMenuBarEditor->isMenuBarEnabled(); … … 127 133 { 128 134 gEDataManager->setStatusBarEnabled(interfaceData.m_fStatusBarEnabled, m_machine.GetId()); 135 gEDataManager->setRestrictedStatusBarIndicators(interfaceData.m_statusBarRestrictions, m_machine.GetId()); 136 gEDataManager->setStatusBarIndicatorOrder(interfaceData.m_statusBarOrder, m_machine.GetId()); 129 137 #ifndef Q_WS_MAC 130 138 gEDataManager->setMenuBarEnabled(interfaceData.m_fMenuBarEnabled, m_machine.GetId()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r56736 r56751 43 43 { 44 44 return (m_fStatusBarEnabled == other.m_fStatusBarEnabled) 45 && (m_statusBarRestrictions == other.m_statusBarRestrictions) 46 && (m_statusBarOrder == other.m_statusBarOrder) 45 47 #ifndef Q_WS_MAC 46 48 && (m_fMenuBarEnabled == other.m_fMenuBarEnabled) … … 57 59 /* Variables: */ 58 60 bool m_fStatusBarEnabled; 61 QList<IndicatorType> m_statusBarRestrictions; 62 QList<IndicatorType> m_statusBarOrder; 59 63 #ifndef Q_WS_MAC 60 64 bool m_fMenuBarEnabled;
Note:
See TracChangeset
for help on using the changeset viewer.