Changeset 54529 in vbox
- Timestamp:
- Feb 26, 2015 1:37:25 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
r54079 r54529 27 27 # include <QMouseEvent> 28 28 # include <QStatusBar> 29 # include <QCheckBox> 29 30 # include <QPainter> 30 31 # include <QPixmap> … … 264 265 , m_pMainLayout(0), m_pButtonLayout(0) 265 266 , m_pButtonClose(0) 267 , m_pCheckBoxEnable(0) 266 268 , m_pButtonDropToken(0) 267 269 , m_fDropAfterTokenButton(true) … … 285 287 return; 286 288 289 /* Update enable-checkbox: */ 290 updateEnableCheckbox(); 291 287 292 /* Update status buttons: */ 288 293 updateStatusButtons(); 294 } 295 296 void UIStatusBarEditorWidget::sltHandleStatusBarEnableToggle(bool fEnabled) 297 { 298 /* Toggle enable-checkbox if necessary: */ 299 if (m_fStartedFromVMSettings && m_pCheckBoxEnable) 300 { 301 /* Check whether this value is really changed: */ 302 const bool fStatusBarEnabled = gEDataManager->statusBarEnabled(machineID()); 303 if (fStatusBarEnabled != fEnabled) 304 { 305 /* Set new value: */ 306 gEDataManager->setStatusBarEnabled(fEnabled, machineID()); 307 } 308 } 289 309 } 290 310 … … 339 359 { 340 360 /* Configure main-layout: */ 341 #ifdef Q_WS_MAC342 /* Standard margins on Mac OS X are too big: */343 m_pMainLayout->setContentsMargins(10, 10, 10, 5);344 #else /* !Q_WS_MAC */345 /* Standard margins on Windows/X11: */346 361 int iLeft, iTop, iRight, iBottom; 347 362 m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 363 /* Standard margins should not be too big: */ 364 iLeft = qMin(iLeft, 10); 365 iTop = qMin(iTop, 10); 366 iRight = qMin(iRight, 10); 367 iBottom = qMin(iBottom, 10); 368 /* Bottom margin should be smaller for the common case: */ 348 369 if (iBottom >= 5) 349 370 iBottom -= 5; 371 /* Left margin should be bigger for the settings case: */ 372 if (m_fStartedFromVMSettings) 373 iLeft += 5; 374 /* Apply margins/spacing finally: */ 350 375 m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom); 351 #endif /* !Q_WS_MAC */352 376 m_pMainLayout->setSpacing(0); 353 377 /* Create close-button if necessary: */ … … 366 390 } 367 391 } 392 /* Create enable-checkbox if necessary: */ 393 else 394 { 395 m_pCheckBoxEnable = new QCheckBox; 396 AssertPtrReturnVoid(m_pCheckBoxEnable); 397 { 398 /* Configure enable-checkbox: */ 399 m_pCheckBoxEnable->setFocusPolicy(Qt::StrongFocus); 400 connect(m_pCheckBoxEnable, SIGNAL(toggled(bool)), this, SLOT(sltHandleStatusBarEnableToggle(bool))); 401 /* Add enable-checkbox into main-layout: */ 402 m_pMainLayout->addWidget(m_pCheckBoxEnable); 403 /* Update enable-checkbox: */ 404 updateEnableCheckbox(); 405 } 406 } 368 407 /* Insert stretch: */ 369 408 m_pMainLayout->addStretch(); … … 427 466 } 428 467 468 void UIStatusBarEditorWidget::updateEnableCheckbox() 469 { 470 /* Update enable-checkbox if necessary: */ 471 if (m_fStartedFromVMSettings && m_pCheckBoxEnable) 472 { 473 m_pCheckBoxEnable->blockSignals(true); 474 m_pCheckBoxEnable->setChecked(gEDataManager->statusBarEnabled(machineID())); 475 m_pCheckBoxEnable->blockSignals(false); 476 } 477 } 478 429 479 void UIStatusBarEditorWidget::updateStatusButtons() 430 480 { … … 461 511 if (!m_fStartedFromVMSettings && m_pButtonClose) 462 512 m_pButtonClose->setToolTip(tr("Close")); 513 /* Translate enable-checkbox if necessary: */ 514 if (m_fStartedFromVMSettings && m_pCheckBoxEnable) 515 m_pCheckBoxEnable->setToolTip(tr("Enable Status Bar")); 463 516 } 464 517 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h
r53321 r54529 32 32 class QIToolButton; 33 33 class QHBoxLayout; 34 class QCheckBox; 34 35 35 36 /** UISlidingToolBar wrapper … … 76 77 void sltHandleConfigurationChange(const QString &strMachineID); 77 78 79 /** Handles status-bar enable toggle. */ 80 void sltHandleStatusBarEnableToggle(bool fEnabled); 78 81 /** Handles button click. */ 79 82 void sltHandleButtonClick(); … … 91 94 void prepareStatusButton(IndicatorType type); 92 95 93 /** Updates status buttons. */ 96 /** Update enable-checkbox routine. */ 97 void updateEnableCheckbox(); 98 /** Update status buttons routine. */ 94 99 void updateStatusButtons(); 95 100 … … 130 135 /** Holds the close-button instance. */ 131 136 QIToolButton *m_pButtonClose; 137 /** Holds the enable-checkbox instance. */ 138 QCheckBox *m_pCheckBoxEnable; 132 139 /** Holds status-bar buttons. */ 133 140 QMap<IndicatorType, UIStatusBarEditorButton*> m_buttons;
Note:
See TracChangeset
for help on using the changeset viewer.