Changeset 107335 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 16, 2024 5:38:41 PM (5 weeks ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIMachineManagerWidget.cpp
r107334 r107335 221 221 UIToolType UIMachineManagerWidget::menuToolType() const 222 222 { 223 return m_pMenuTools ? m_pMenuTools->toolsType() : UIToolType_Invalid; 223 AssertPtrReturn(m_pMenuTools, UIToolType_Invalid); 224 return m_pMenuTools->toolsType(); 224 225 } 225 226 226 227 void UIMachineManagerWidget::setMenuToolType(UIToolType enmType) 227 228 { 229 /* Sanity check: */ 230 AssertReturnVoid(enmType != UIToolType_Invalid); 231 /* Make sure new tool type is of Machine class: */ 232 AssertReturnVoid(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Machine)); 233 234 AssertPtrReturnVoid(m_pMenuTools); 228 235 m_pMenuTools->setToolsType(enmType); 229 236 } … … 231 238 UIToolType UIMachineManagerWidget::toolType() const 232 239 { 233 return m_pPaneTools ? m_pPaneTools->currentTool() : UIToolType_Invalid; 240 AssertPtrReturn(m_pPaneTools, UIToolType_Invalid); 241 return m_pPaneTools->currentTool(); 234 242 } 235 243 236 244 bool UIMachineManagerWidget::isToolOpened(UIToolType enmType) const 237 245 { 238 return m_pPaneTools ? m_pPaneTools->isToolOpened(enmType) : false; 246 /* Sanity check: */ 247 AssertReturn(enmType != UIToolType_Invalid, false); 248 /* Make sure new tool type is of Machine class: */ 249 AssertReturn(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Machine), false); 250 251 AssertPtrReturn(m_pPaneTools, false); 252 return m_pPaneTools->isToolOpened(enmType); 239 253 } 240 254 241 255 void UIMachineManagerWidget::switchToolTo(UIToolType enmType) 242 256 { 257 /* Sanity check: */ 258 AssertReturnVoid(enmType != UIToolType_Invalid); 259 /* Make sure new tool type is of Machine class: */ 260 AssertReturnVoid(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Machine)); 261 243 262 /* Open corresponding tool: */ 263 AssertPtrReturnVoid(m_pPaneTools); 244 264 m_pPaneTools->openTool(enmType); 245 265 … … 250 270 void UIMachineManagerWidget::closeTool(UIToolType enmType) 251 271 { 272 /* Sanity check: */ 273 AssertReturnVoid(enmType != UIToolType_Invalid); 274 /* Make sure new tool type is of Machine class: */ 275 AssertReturnVoid(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Machine)); 276 277 AssertPtrReturnVoid(m_pPaneTools); 252 278 m_pPaneTools->closeTool(enmType); 253 279 } … … 255 281 bool UIMachineManagerWidget::isCurrentStateItemSelected() const 256 282 { 283 AssertPtrReturn(m_pPaneTools, false); 257 284 return m_pPaneTools->isCurrentStateItemSelected(); 258 285 } … … 260 287 QUuid UIMachineManagerWidget::currentSnapshotId() 261 288 { 289 AssertPtrReturn(m_pPaneTools, QUuid()); 262 290 return m_pPaneTools->currentSnapshotId(); 263 291 } … … 265 293 QString UIMachineManagerWidget::currentHelpKeyword() const 266 294 { 267 QString strHelpKeyword; 268 if (isMachineItemSelected()) 269 strHelpKeyword = m_pPaneTools->currentHelpKeyword(); 270 return strHelpKeyword; 295 AssertPtrReturn(m_pPaneTools, QString()); 296 return m_pPaneTools->currentHelpKeyword(); 271 297 } 272 298 … … 436 462 } 437 463 464 void UIMachineManagerWidget::sltHandleToolsMenuIndexChange(UIToolType enmType) 465 { 466 switchToolTo(enmType); 467 } 468 438 469 void UIMachineManagerWidget::sltSwitchToVMActivityPane(const QUuid &uMachineId) 439 470 { … … 590 621 } 591 622 592 /* Open tool slast chosen in Tools-menu: */623 /* Open tool last chosen in Tools-menu: */ 593 624 switchToolTo(m_pMenuTools->toolsType()); 594 625 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIMachineManagerWidget.h
r107334 r107335 255 255 /** Handles signal about Tools-menu index change. 256 256 * @param enmType Brings current tool type. */ 257 void sltHandleToolsMenuIndexChange(UIToolType enmType) { switchToolTo(enmType); }257 void sltHandleToolsMenuIndexChange(UIToolType enmType); 258 258 259 259 /** Switches to VM Activity pane of machine with @a uMachineId. */
Note:
See TracChangeset
for help on using the changeset viewer.