Changeset 52014 in vbox
- Timestamp:
- Jul 14, 2014 11:16:43 AM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r51995 r52014 783 783 public: 784 784 785 /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */786 UIIndicatorMouse( CSession &session)787 : UISessionStateStatusBarIndicator( session)785 /** Constructor, using @a pSession for state-update routine. */ 786 UIIndicatorMouse(UISession *pSession) 787 : UISessionStateStatusBarIndicator(pSession->session()) 788 788 { 789 789 /* Assign state-icons: */ … … 793 793 setStateIcon(3, UIIconPool::iconSet(":/mouse_can_seamless_16px.png")); 794 794 setStateIcon(4, UIIconPool::iconSet(":/mouse_can_seamless_uncaptured_16px.png")); 795 /* Configure connection: */ 796 connect(pSession, SIGNAL(sigMouseStateChange(int)), this, SLOT(setState(int))); 797 setState(pSession->mouseState()); 795 798 /* Translate finally: */ 796 799 retranslateUi(); … … 840 843 public: 841 844 842 /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */843 UIIndicatorKeyboard( CSession &session)844 : UISessionStateStatusBarIndicator( session)845 /** Constructor, using @a pSession for state-update routine. */ 846 UIIndicatorKeyboard(UISession *pSession) 847 : UISessionStateStatusBarIndicator(pSession->session()) 845 848 { 846 849 /* Assign state-icons: */ … … 849 852 setStateIcon(2, UIIconPool::iconSet(":/hostkey_pressed_16px.png")); 850 853 setStateIcon(3, UIIconPool::iconSet(":/hostkey_captured_pressed_16px.png")); 854 /* Configure connection: */ 855 connect(pSession, SIGNAL(sigKeyboardStateChange(int)), this, SLOT(setState(int))); 856 setState(pSession->keyboardState()); 851 857 /* Translate finally: */ 852 858 retranslateUi(); … … 1065 1071 case IndicatorType_VideoCapture: m_pool[indicatorType] = new UIIndicatorVideoCapture(m_session); break; 1066 1072 case IndicatorType_Features: m_pool[indicatorType] = new UIIndicatorFeatures(m_session); break; 1067 case IndicatorType_Mouse: m_pool[indicatorType] = new UIIndicatorMouse(m_ session);break;1068 case IndicatorType_Keyboard: m_pool[indicatorType] = new UIIndicatorKeyboard(m_ session);break;1073 case IndicatorType_Mouse: m_pool[indicatorType] = new UIIndicatorMouse(m_pSession); break; 1074 case IndicatorType_Keyboard: m_pool[indicatorType] = new UIIndicatorKeyboard(m_pSession); break; 1069 1075 case IndicatorType_KeyboardExtension: m_pool[indicatorType] = new UIIndicatorKeyboardExtension; break; 1070 1076 default: break; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r51595 r52014 220 220 221 221 /* Notify all the listeners: */ 222 emit keyboardStateChanged(keyboardState());222 emit sigStateChange(state()); 223 223 } 224 224 } … … 275 275 276 276 /* Notify all the listeners: */ 277 emit keyboardStateChanged(keyboardState());277 emit sigStateChange(state()); 278 278 } 279 279 } … … 332 332 #endif 333 333 334 emit keyboardStateChanged(keyboardState()); 334 /* Notify all the listeners: */ 335 emit sigStateChange(state()); 335 336 } 336 337 337 338 /* Current keyboard state: */ 338 int UIKeyboardHandler:: keyboardState() const339 int UIKeyboardHandler::state() const 339 340 { 340 341 return (m_fIsKeyboardCaptured ? UIViewStateType_KeyboardCaptured : 0) | … … 1522 1523 } 1523 1524 1524 /* Notify all listeners: */1525 emit keyboardStateChanged(keyboardState());1525 /* Notify all the listeners: */ 1526 emit sigStateChange(state()); 1526 1527 1527 1528 /* If the VM is NOT paused: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
r51595 r52014 51 51 Q_OBJECT; 52 52 53 signals: 54 55 /** Notifies listeners about state-change. */ 56 void sigStateChange(int iState); 57 53 58 public: 54 59 … … 67 72 68 73 /* Current keyboard state: */ 69 int keyboardState() const;74 int state() const; 70 75 71 76 /* Some getters required by side-code: */ … … 88 93 bool x11EventFilter(XEvent *pEvent, ulong uScreenId); 89 94 #endif 90 91 signals:92 93 /* Notifies listeners about keyboard state-change: */94 void keyboardStateChanged(int iNewState);95 95 96 96 protected slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r51671 r52014 685 685 void UIMachineLogic::setKeyboardHandler(UIKeyboardHandler *pKeyboardHandler) 686 686 { 687 /* Set new handler: */ 687 688 m_pKeyboardHandler = pKeyboardHandler; 689 /* Connect to session: */ 690 connect(m_pKeyboardHandler, SIGNAL(sigStateChange(int)), 691 uisession(), SLOT(setKeyboardState(int))); 688 692 } 689 693 690 694 void UIMachineLogic::setMouseHandler(UIMouseHandler *pMouseHandler) 691 695 { 696 /* Set new handler: */ 692 697 m_pMouseHandler = pMouseHandler; 698 /* Connect to session: */ 699 connect(m_pMouseHandler, SIGNAL(sigStateChange(int)), 700 uisession(), SLOT(setMouseState(int))); 693 701 } 694 702 … … 955 963 void UIMachineLogic::prepareHandlers() 956 964 { 957 /* Create keyboard-handler: */965 /* Create handlers: */ 958 966 setKeyboardHandler(UIKeyboardHandler::create(this, visualStateType())); 959 960 /* Create mouse-handler: */961 967 setMouseHandler(UIMouseHandler::create(this, visualStateType())); 968 969 /* Update UI session values with current: */ 970 uisession()->setKeyboardState(keyboardHandler()->state()); 971 uisession()->setMouseState(mouseHandler()->state()); 962 972 } 963 973 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r51693 r52014 201 201 mouse.PutMouseEvent(0, 0, 0, 0, 0); 202 202 203 /* Emit signal if required: */204 emit mouseStateChanged(mouseState());203 /* Notify all the listeners: */ 204 emit sigStateChange(state()); 205 205 } 206 206 } … … 233 233 m_iMouseCaptureViewIndex = -1; 234 234 235 /* Emit signal if required: */236 emit mouseStateChanged(mouseState());235 /* Notify all the listeners: */ 236 emit sigStateChange(state()); 237 237 } 238 238 } … … 253 253 254 254 /* Current mouse state: */ 255 int UIMouseHandler:: mouseState() const255 int UIMouseHandler::state() const 256 256 { 257 257 return (uisession()->isMouseCaptured() ? UIMouseStateType_MouseCaptured : 0) | … … 294 294 { 295 295 /* Get machine state: */ 296 KMachineState state = uisession()->machineState();296 KMachineState machineState = uisession()->machineState(); 297 297 /* Handle particular machine states: */ 298 switch ( state)298 switch (machineState) 299 299 { 300 300 case KMachineState_Paused: … … 313 313 * if we are not in paused VM state already: */ 314 314 if (machineLogic()->activeMachineWindow() && 315 state != KMachineState_Paused &&316 state != KMachineState_TeleportingPausedVM)315 machineState != KMachineState_Paused && 316 machineState != KMachineState_TeleportingPausedVM) 317 317 popupCenter().forgetAboutPausedVMInput(machineLogic()->activeMachineWindow()); 318 318 319 // TODO: Is it really required? 320 /* Notify all listeners: */ 321 emit mouseStateChanged(mouseState()); 319 /* Notify all the listeners: */ 320 emit sigStateChange(state()); 322 321 } 323 322 … … 376 375 } 377 376 378 /* Notify all listeners: */379 emit mouseStateChanged(mouseState());377 /* Notify all the listeners: */ 378 emit sigStateChange(state()); 380 379 } 381 380 … … 456 455 /* Mouse pointer shape state-change updaters: */ 457 456 connect(uisession(), SIGNAL(sigMousePointerShapeChange()), this, SLOT(sltMousePointerShapeChanged())); 458 connect(this, SIGNAL( mouseStateChanged(int)), this, SLOT(sltMousePointerShapeChanged()));457 connect(this, SIGNAL(sigStateChange(int)), this, SLOT(sltMousePointerShapeChanged())); 459 458 460 459 /* Initialize: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
r51187 r52014 47 47 Q_OBJECT; 48 48 49 signals: 50 51 /** Notifies listeners about state-change. */ 52 void sigStateChange(int iState); 53 49 54 public: 50 55 … … 65 70 66 71 /* Current mouse state: */ 67 int mouseState() const;72 int state() const; 68 73 69 74 #ifdef Q_WS_X11 70 75 bool x11EventFilter(XEvent *pEvent, ulong uScreenId); 71 76 #endif /* Q_WS_X11 */ 72 73 signals:74 75 /* Notifies listeners about mouse state-change: */76 void mouseStateChanged(int iNewState);77 77 78 78 protected slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r51593 r52014 190 190 191 191 /* Keyboard getters: */ 192 /** Returns keyboard-state. */ 193 int keyboardState() const { return m_iKeyboardState; } 192 194 bool isNumLock() const { return m_fNumLock; } 193 195 bool isCapsLock() const { return m_fCapsLock; } … … 197 199 198 200 /* Mouse getters: */ 201 /** Returns mouse-state. */ 202 int mouseState() const { return m_iMouseState; } 199 203 bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; } 200 204 bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; } … … 243 247 244 248 /* Console callback signals: */ 249 /** Notifies listeners about keyboard state-change. */ 250 void sigKeyboardStateChange(int iState); 251 /** Notifies listeners about mouse state-change. */ 252 void sigMouseStateChange(int iState); 245 253 void sigMousePointerShapeChange(); 246 254 void sigMouseCapabilityChange(); … … 273 281 void sltInstallGuestAdditionsFrom(const QString &strSource); 274 282 283 /** Defines @a iKeyboardState. */ 284 void setKeyboardState(int iKeyboardState) { m_iKeyboardState = iKeyboardState; emit sigKeyboardStateChange(m_iKeyboardState); } 285 286 /** Defines @a iMouseState. */ 287 void setMouseState(int iMouseState) { m_iMouseState = iMouseState; emit sigMouseStateChange(m_iMouseState); } 288 275 289 private slots: 276 290 … … 445 459 446 460 /* Keyboard flags: */ 461 /** Holds the keyboard-state. */ 462 int m_iKeyboardState; 447 463 bool m_fNumLock : 1; 448 464 bool m_fCapsLock : 1; … … 452 468 453 469 /* Mouse flags: */ 470 /** Holds the mouse-state. */ 471 int m_iMouseState; 454 472 bool m_fIsMouseSupportsAbsolute : 1; 455 473 bool m_fIsMouseSupportsRelative : 1; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r51992 r52014 232 232 } 233 233 234 void UIMachineWindowNormal::prepareHandlers()235 {236 /* Call to base-class: */237 UIMachineWindow::prepareHandlers();238 239 /* Get keyboard/mouse indicators: */240 QIStateStatusBarIndicator *pKeyboardIndicator =241 qobject_cast<QIStateStatusBarIndicator*>(m_pIndicatorsPool->indicator(IndicatorType_Keyboard));242 QIStateStatusBarIndicator *pMouseIndicator =243 qobject_cast<QIStateStatusBarIndicator*>(m_pIndicatorsPool->indicator(IndicatorType_Mouse));244 245 /* Connect keyboard/mouse state-change handlers: */246 if (pKeyboardIndicator)247 connect(machineLogic()->keyboardHandler(), SIGNAL(keyboardStateChanged(int)),248 pKeyboardIndicator, SLOT(setState(int)));249 if (pMouseIndicator)250 connect(machineLogic()->mouseHandler(), SIGNAL(mouseStateChanged(int)),251 pMouseIndicator, SLOT(setState(int)));252 253 /* Early initialize created connections: */254 if (pKeyboardIndicator)255 pKeyboardIndicator->setState(machineLogic()->keyboardHandler()->keyboardState());256 if (pMouseIndicator)257 pMouseIndicator->setState(machineLogic()->mouseHandler()->mouseState());258 }259 260 234 void UIMachineWindowNormal::loadSettings() 261 235 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r51992 r52014 64 64 void prepareStatusBar(); 65 65 void prepareVisualState(); 66 void prepareHandlers();67 66 void loadSettings(); 68 67 69 68 /* Cleanup helpers: */ 70 69 void saveSettings(); 71 //void cleanupHandlers() {}72 70 //coid cleanupVisualState() {} 73 71 //void cleanupStatusBar() {}
Note:
See TracChangeset
for help on using the changeset viewer.