Changeset 41063 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 26, 2012 4:52:55 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r41062 r41063 7 7 8 8 /* 9 * Copyright (C) 2010 Oracle Corporation9 * Copyright (C) 2010-2012 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 */ 19 19 20 /* Global includes */20 /* Global includes: */ 21 21 #include <QTimer> 22 22 23 /* Local includes */23 /* Local includes: */ 24 24 #include "VBoxGlobal.h" 25 25 #include "UIMachine.h" … … 28 28 #include "UIMachineLogic.h" 29 29 #include "UIMachineWindow.h" 30 31 30 #ifdef Q_WS_MAC 32 31 # include <ApplicationServices/ApplicationServices.h> 33 32 #endif /* Q_WS_MAC */ 34 33 34 /* Visual state interface: */ 35 35 class UIVisualState : public QObject 36 36 { 37 37 Q_OBJECT; 38 38 39 signals: 40 41 /* Signal to change-state: */ 42 void sigChangeVisualState(UIVisualStateType newVisualStateType); 43 39 44 public: 40 45 41 /* Visual state holder constructor: */46 /* Constructor: */ 42 47 UIVisualState(QObject *pParent, UISession *pSession) 43 48 : QObject(pParent) … … 52 57 } 53 58 54 /* Public getters: */ 55 UIMachineLogic* machineLogic() const { return m_pMachineLogic; } 59 /* Destructor: */ 60 ~UIVisualState() 61 { 62 /* Delete machine logic if exists: */ 63 if (m_pMachineLogic) 64 UIMachineLogic::destroy(m_pMachineLogic); 65 } 66 67 /* Visual state type getter: */ 56 68 virtual UIVisualStateType visualStateType() const = 0; 57 69 70 /* Machine logic getter: */ 71 UIMachineLogic* machineLogic() const { return m_pMachineLogic; } 72 73 /* Method to prepare change one visual state to another: */ 58 74 virtual bool prepareChange(UIVisualStateType previousVisualStateType) 59 75 { … … 78 94 } 79 95 96 /* Method to change one visual state to another: */ 80 97 virtual void change() = 0; 81 98 99 /* Method to finish change one visual state to another: */ 82 100 virtual void finishChange() 83 101 { … … 95 113 } 96 114 97 98 signals:99 100 /* Signal to change-state: */101 void sigChangeVisualState(UIVisualStateType visualStateType);102 103 115 protected: 104 116 105 /* Protected members: */117 /* Variables: */ 106 118 UISession *m_pSession; 107 119 UIMachineLogic *m_pMachineLogic; … … 111 123 }; 112 124 125 /* Normal visual state implementation: */ 113 126 class UIVisualStateNormal : public UIVisualState 114 127 { … … 117 130 public: 118 131 119 /* Normal visual state holder constructor: */132 /* Constructor: */ 120 133 UIVisualStateNormal(QObject *pParent, UISession *pSession) 121 134 : UIVisualState(pParent, pSession) {} 122 135 136 private slots: 137 138 /* State-change handlers: */ 139 void sltGoToFullscreenMode() { emit sigChangeVisualState(UIVisualStateType_Fullscreen); } 140 void sltGoToSeamlessMode() { emit sigChangeVisualState(UIVisualStateType_Seamless); } 141 void sltGoToScaleMode() { emit sigChangeVisualState(UIVisualStateType_Scale); } 142 143 private: 144 145 /* Visual state type getter: */ 123 146 UIVisualStateType visualStateType() const { return UIVisualStateType_Normal; } 124 147 148 /* Method to change previous visual state to this one: */ 125 149 void change() 126 150 { … … 136 160 m_pMachineLogic->initialize(); 137 161 } 138 139 private slots:140 141 void sltGoToFullscreenMode()142 {143 /* Change visual state to fullscreen: */144 emit sigChangeVisualState(UIVisualStateType_Fullscreen);145 }146 147 void sltGoToSeamlessMode()148 {149 /* Change visual state to seamless: */150 emit sigChangeVisualState(UIVisualStateType_Seamless);151 }152 153 void sltGoToScaleMode()154 {155 /* Change visual state to scale: */156 emit sigChangeVisualState(UIVisualStateType_Scale);157 }158 162 }; 159 163 164 /* Fullscreen visual state implementation: */ 160 165 class UIVisualStateFullscreen : public UIVisualState 161 166 { … … 164 169 public: 165 170 166 /* Fullscreen visual state holder constructor: */171 /* Constructor: */ 167 172 UIVisualStateFullscreen(QObject *pParent, UISession *pSession) 168 173 : UIVisualState(pParent, pSession) … … 179 184 } 180 185 181 /* Fullscreen visual state holder destructor: */186 /* Destructor: */ 182 187 virtual ~UIVisualStateFullscreen() 183 188 { … … 193 198 } 194 199 200 private slots: 201 202 /* State-change handlers: */ 203 void sltGoToNormalMode() { emit sigChangeVisualState(UIVisualStateType_Normal); } 204 void sltGoToSeamlessMode() { emit sigChangeVisualState(UIVisualStateType_Seamless); } 205 void sltGoToScaleMode() { emit sigChangeVisualState(UIVisualStateType_Scale); } 206 207 private: 208 209 /* Visual state type getter: */ 195 210 UIVisualStateType visualStateType() const { return UIVisualStateType_Fullscreen; } 196 211 212 /* Method to change previous visual state to this one: */ 197 213 void change() 198 214 { … … 208 224 m_pMachineLogic->initialize(); 209 225 } 210 211 private slots:212 213 void sltGoToNormalMode()214 {215 /* Change visual state to normal: */216 emit sigChangeVisualState(UIVisualStateType_Normal);217 }218 219 void sltGoToSeamlessMode()220 {221 /* Change visual state to seamless: */222 emit sigChangeVisualState(UIVisualStateType_Seamless);223 }224 225 void sltGoToScaleMode()226 {227 /* Change visual state to scale: */228 emit sigChangeVisualState(UIVisualStateType_Scale);229 }230 226 }; 231 227 228 /* Seamless visual state implementation: */ 232 229 class UIVisualStateSeamless : public UIVisualState 233 230 { … … 236 233 public: 237 234 238 /* Seamless visual state holder constructor: */235 /* Constructor: */ 239 236 UIVisualStateSeamless(QObject *pParent, UISession *pSession) 240 237 : UIVisualState(pParent, pSession) … … 251 248 } 252 249 253 /* Seamless visual state holder destructor: */250 /* Destructor: */ 254 251 virtual ~UIVisualStateSeamless() 255 252 { … … 265 262 } 266 263 264 private slots: 265 266 /* State-change handlers: */ 267 void sltGoToNormalMode() { emit sigChangeVisualState(UIVisualStateType_Normal); } 268 void sltGoToFullscreenMode() { emit sigChangeVisualState(UIVisualStateType_Fullscreen); } 269 void sltGoToScaleMode() { emit sigChangeVisualState(UIVisualStateType_Scale); } 270 271 private: 272 273 /* Visual state type getter: */ 267 274 UIVisualStateType visualStateType() const { return UIVisualStateType_Seamless; } 268 275 276 /* Method to change previous visual state to this one: */ 269 277 void change() 270 278 { … … 280 288 m_pMachineLogic->initialize(); 281 289 } 282 283 private slots:284 285 void sltGoToNormalMode()286 {287 /* Change visual state to normal: */288 emit sigChangeVisualState(UIVisualStateType_Normal);289 }290 291 void sltGoToFullscreenMode()292 {293 /* Change visual state to fullscreen: */294 emit sigChangeVisualState(UIVisualStateType_Fullscreen);295 }296 297 void sltGoToScaleMode()298 {299 /* Change visual state to scale: */300 emit sigChangeVisualState(UIVisualStateType_Scale);301 }302 290 }; 303 291 292 /* Scale visual state implementation: */ 304 293 class UIVisualStateScale : public UIVisualState 305 294 { … … 308 297 public: 309 298 310 /* Scale visual state holder constructor: */299 /* Constructor: */ 311 300 UIVisualStateScale(QObject *pParent, UISession *pSession) 312 301 : UIVisualState(pParent, pSession) … … 323 312 } 324 313 325 /* Seamless visual state holder destructor: */314 /* Destructor: */ 326 315 virtual ~UIVisualStateScale() 327 316 { … … 337 326 } 338 327 328 private slots: 329 330 /* State-change handlers: */ 331 void sltGoToNormalMode() { emit sigChangeVisualState(UIVisualStateType_Normal); } 332 void sltGoToFullscreenMode() { emit sigChangeVisualState(UIVisualStateType_Fullscreen); } 333 void sltGoToSeamlessMode() { emit sigChangeVisualState(UIVisualStateType_Seamless); } 334 335 private: 336 337 /* Visual state type getter: */ 339 338 UIVisualStateType visualStateType() const { return UIVisualStateType_Scale; } 340 339 340 /* Method to change previous visual state to this one: */ 341 341 void change() 342 342 { … … 352 352 m_pMachineLogic->initialize(); 353 353 } 354 355 private slots:356 357 void sltGoToNormalMode()358 {359 /* Change visual state to normal: */360 emit sigChangeVisualState(UIVisualStateType_Normal);361 }362 363 void sltGoToFullscreenMode()364 {365 /* Change visual state to fullscreen: */366 emit sigChangeVisualState(UIVisualStateType_Fullscreen);367 }368 369 void sltGoToSeamlessMode()370 {371 /* Change visual state to seamless: */372 emit sigChangeVisualState(UIVisualStateType_Seamless);373 }374 354 }; 375 355 … … 436 416 } 437 417 438 void UIMachine::sltChangeVisualState(UIVisualStateType visualStateType)418 void UIMachine::sltChangeVisualState(UIVisualStateType newVisualStateType) 439 419 { 440 420 /* Create new state: */ 441 421 UIVisualState *pNewVisualState = 0; 442 switch ( visualStateType)422 switch (newVisualStateType) 443 423 { 444 424 case UIVisualStateType_Normal: … … 470 450 } 471 451 452 /* Get previous visual state type: */ 472 453 UIVisualStateType previousVisualStateType = UIVisualStateType_Normal; 473 454 if (m_pVisualState) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r41047 r41063 7 7 8 8 /* 9 * Copyright (C) 2010-201 1Oracle Corporation9 * Copyright (C) 2010-2012 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 105 105 Q_DECLARE_METATYPE(USBTarget); 106 106 107 /* static */ 107 108 UIMachineLogic* UIMachineLogic::create(QObject *pParent, 108 109 UISession *pSession, … … 126 127 } 127 128 return logic; 129 } 130 131 /* static */ 132 void UIMachineLogic::destroy(UIMachineLogic *pWhichLogic) 133 { 134 delete pWhichLogic; 128 135 } 129 136 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r41047 r41063 6 6 7 7 /* 8 * Copyright (C) 2010-201 1Oracle Corporation8 * Copyright (C) 2010-2012 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 50 50 public: 51 51 52 /* Factory function to createrequired logic sub-child: */52 /* Factory functions to create/destroy required logic sub-child: */ 53 53 static UIMachineLogic* create(QObject *pParent, 54 54 UISession *pSession, 55 55 UIVisualStateType visualStateType); 56 static void destroy(UIMachineLogic *pWhichLogic); 56 57 57 58 /* Check if this mode is available: */
Note:
See TracChangeset
for help on using the changeset viewer.