Changeset 52370 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 13, 2014 5:30:32 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95510
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r52327 r52370 221 221 /* Create mini-toolbar: */ 222 222 m_pMiniToolBar = new UIRuntimeMiniToolBar(this, 223 IntegrationMode_Embedded,223 GeometryType_Full, 224 224 gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), 225 225 gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r52202 r52370 112 112 /* Create mini-toolbar: */ 113 113 m_pMiniToolBar = new UIRuntimeMiniToolBar(this, 114 IntegrationMode_External,114 GeometryType_Available, 115 115 gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), 116 116 gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
r52327 r52370 42 42 43 43 UIRuntimeMiniToolBar::UIRuntimeMiniToolBar(QWidget *pParent, 44 IntegrationMode integrationMode,44 GeometryType geometryType, 45 45 Qt::Alignment alignment, 46 46 bool fAutoHide /* = true */) 47 : QWidget(pParent )47 : QWidget(pParent, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) 48 48 /* Variables: General stuff: */ 49 , m_ integrationMode(integrationMode)49 , m_geometryType(geometryType) 50 50 , m_alignment(alignment) 51 51 , m_fAutoHide(fAutoHide) … … 86 86 } 87 87 88 void UIRuntimeMiniToolBar::setIntegrationMode(IntegrationMode integrationMode) 89 { 90 /* Make sure integration-mode really changed: */ 91 if (m_integrationMode == integrationMode) 92 return; 93 94 /* Update integration-mode: */ 95 m_integrationMode = integrationMode; 96 97 /* Re-integrate: */ 98 integrate(); 99 100 /* Re-initialize: */ 101 adjustGeometry(); 102 103 /* Propagate to child to update shape: */ 104 m_pToolbar->setIntegrationMode(m_integrationMode); 105 } 106 107 void UIRuntimeMiniToolBar::setAutoHide(bool fAutoHide, bool fPropagateToChild /* = true*/) 88 void UIRuntimeMiniToolBar::setAutoHide(bool fAutoHide, bool fPropagateToChild /* = true */) 108 89 { 109 90 /* Make sure auto-hide really changed: */ … … 153 134 QRect screenRect; 154 135 int iX = 0, iY = 0; 155 switch (m_integrationMode) 156 { 157 case IntegrationMode_Embedded: 158 { 159 /* Screen geometry: */ 160 screenRect = QApplication::desktop()->screenGeometry(iHostScreen); 161 /* Local coordinates, tool-bar is a child of the parent-widget: */ 162 iX = screenRect.width() / 2 - width() / 2; 163 switch (m_alignment) 164 { 165 case Qt::AlignTop: 166 iY = 0; 167 break; 168 case Qt::AlignBottom: 169 iY = screenRect.height() - height(); 170 break; 171 } 172 break; 173 } 174 case IntegrationMode_External: 175 { 176 /* Available geometry: */ 177 screenRect = vboxGlobal().availableGeometry(iHostScreen); 178 /* Global coordinates, tool-bar is tool-window aligned according the parent-widget: */ 179 iX = screenRect.x() + screenRect.width() / 2 - width() / 2; 180 switch (m_alignment) 181 { 182 case Qt::AlignTop: 183 iY = screenRect.y(); 184 break; 185 case Qt::AlignBottom: 186 iY = screenRect.y() + screenRect.height() - height(); 187 break; 188 } 189 break; 190 } 136 switch (m_geometryType) 137 { 138 case GeometryType_Available: screenRect = vboxGlobal().availableGeometry(iHostScreen); break; 139 case GeometryType_Full: screenRect = QApplication::desktop()->screenGeometry(iHostScreen); break; 140 default: break; 141 } 142 iX = screenRect.x() + screenRect.width() / 2 - width() / 2; 143 switch (m_alignment) 144 { 145 case Qt::AlignTop: iY = screenRect.y(); break; 146 case Qt::AlignBottom: iY = screenRect.y() + screenRect.height() - height(); break; 147 default: break; 191 148 } 192 149 move(iX, iY); … … 240 197 void UIRuntimeMiniToolBar::prepare() 241 198 { 242 /* Allow any size: */ 243 setMinimumSize(1, 1); 199 #ifdef VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR 200 /* Using Qt API to enable translucent background: */ 201 setAttribute(Qt::WA_TranslucentBackground, true); 202 #endif /* VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR */ 203 244 204 /* Make sure we have no focus: */ 245 205 setFocusPolicy(Qt::NoFocus); … … 248 208 m_pMdiArea = new QMdiArea; 249 209 { 210 /* Allow any MDI area size: */ 211 m_pMdiArea->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 250 212 /* Configure own background: */ 251 213 QPalette pal = m_pMdiArea->palette(); … … 271 233 m_pToolbar->setAutoHide(m_fAutoHide); 272 234 m_pToolbar->setAlignment(m_alignment); 273 m_pToolbar->setIntegrationMode(m_integrationMode);274 235 /* Configure own background: */ 275 236 QPalette pal = m_pToolbar->palette(); … … 312 273 true); 313 274 314 /* Integrate if necessary: */315 integrate();316 317 275 /* Adjust geometry finally: */ 318 276 adjustGeometry(); 277 278 /* Show: */ 279 show(); 319 280 } 320 281 … … 421 382 AssertPtrReturn(m_pEmbeddedToolbar, QPoint()); 422 383 return m_pEmbeddedToolbar->pos(); 423 }424 425 void UIRuntimeMiniToolBar::integrate()426 {427 /* Reintegrate if necessary: */428 if (m_integrationMode == IntegrationMode_Embedded && isWindow())429 {430 setWindowFlags(Qt::Widget);431 #ifdef VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR432 setAttribute(Qt::WA_TranslucentBackground, false);433 #endif /* VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR */434 show();435 }436 else if (m_integrationMode == IntegrationMode_External && !isWindow())437 {438 setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);439 #ifdef VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR440 setAttribute(Qt::WA_TranslucentBackground, true);441 #endif /* VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR */442 show();443 }444 384 } 445 385 … … 472 412 /* Update alignment: */ 473 413 m_alignment = alignment; 474 475 /* Rebuild shape: */476 rebuildShape();477 }478 479 void UIMiniToolBar::setIntegrationMode(IntegrationMode integrationMode)480 {481 /* Make sure integration-mode really changed: */482 if (m_integrationMode == integrationMode)483 return;484 485 /* Update integration-mode: */486 m_integrationMode = integrationMode;487 414 488 415 /* Rebuild shape: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
r52327 r52370 36 36 class UIAnimation; 37 37 38 /* IntegrationMode enum:*/39 enum IntegrationMode38 /** Geometry types. */ 39 enum GeometryType 40 40 { 41 IntegrationMode_Embedded,42 IntegrationMode_External41 GeometryType_Available, 42 GeometryType_Full 43 43 }; 44 44 … … 71 71 /* Constructor/destructor: */ 72 72 UIRuntimeMiniToolBar(QWidget *pParent, 73 IntegrationMode integrationMode,73 GeometryType geometryType, 74 74 Qt::Alignment alignment, 75 75 bool fAutoHide = true); … … 78 78 /* API: Alignment stuff: */ 79 79 void setAlignment(Qt::Alignment alignment); 80 81 /* API: Integration mode stuff: */82 void setIntegrationMode(IntegrationMode integrationMode);83 80 84 81 /* API: Auto-hide stuff: */ … … 127 124 QPoint shownToolbarPosition() const { return m_shownToolbarPosition; } 128 125 129 /* Helper: Integration stuff: */130 void integrate();131 132 126 /* Variables: General stuff: */ 133 IntegrationMode m_integrationMode;127 const GeometryType m_geometryType; 134 128 Qt::Alignment m_alignment; 135 129 bool m_fAutoHide; … … 175 169 void setAlignment(Qt::Alignment alignment); 176 170 177 /* API: Integration mode stuff: */178 void setIntegrationMode(IntegrationMode integrationMode);179 180 171 /* API: Auto-hide stuff: */ 181 172 bool autoHide() const; … … 207 198 bool m_fPolished; 208 199 Qt::Alignment m_alignment; 209 IntegrationMode m_integrationMode;210 200 QPainterPath m_shape; 211 201
Note:
See TracChangeset
for help on using the changeset viewer.