Changeset 58489 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 29, 2015 2:28:05 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp
r58382 r58489 74 74 m_overlayImage = ::darwinToCGImageRef(&overlayImage); 75 75 Assert(m_overlayImage); 76 77 /* Determine desired icon size for the state-overlay: */78 const QStyle *pStyle = QApplication::style();79 const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);80 const QSize iconSize = QSize(iIconMetric, iIconMetric);81 82 /* Prepare 'Paused' state-overlay: */83 const QPixmap statePaused = gpConverter->toIcon(KMachineState_Paused).pixmap(iconSize);84 m_statePaused = ::darwinToCGImageRef(&statePaused);85 Assert(m_statePaused);86 87 /* Prepare 'Saving' state-overlay: */88 const QPixmap stateSaving = gpConverter->toIcon(KMachineState_Saving).pixmap(iconSize);89 m_stateSaving = ::darwinToCGImageRef(&stateSaving);90 Assert(m_stateSaving);91 92 /* Prepare 'Restoring' state-overlay: */93 const QPixmap stateRestoring = gpConverter->toIcon(KMachineState_Restoring).pixmap(iconSize);94 m_stateRestoring = ::darwinToCGImageRef(&stateRestoring);95 Assert(m_stateRestoring);96 76 } 97 77 … … 113 93 if (m_dockMonitorGlossy) 114 94 CGImageRelease(m_dockMonitorGlossy); 115 116 CGImageRelease(m_statePaused);117 CGImageRelease(m_stateSaving);118 CGImageRelease(m_stateRestoring);119 95 } 120 96 … … 143 119 } 144 120 145 CGImageRef UIAbstractDockIconPreviewHelper::stateImage() const146 {147 CGImageRef img;148 if ( m_pSession->machineState() == KMachineState_Paused149 || m_pSession->machineState() == KMachineState_TeleportingPausedVM)150 img = m_statePaused;151 else if ( m_pSession->machineState() == KMachineState_Restoring152 || m_pSession->machineState() == KMachineState_TeleportingIn)153 img = m_stateRestoring;154 else if ( m_pSession->machineState() == KMachineState_Saving155 || m_pSession->machineState() == KMachineState_LiveSnapshotting)156 img = m_stateSaving;157 else158 img = NULL;159 return img;160 }161 162 121 void UIAbstractDockIconPreviewHelper::drawOverlayIcons(CGContextRef context) 163 122 { … … 177 136 CGContextDrawImage(context, flipRect(overlayRect), m_overlayImage); 178 137 } 179 180 /* Determine correct state-overlay image: */181 CGImageRef sImage = stateImage();182 /* Make sure state-overlay image is valid: */183 if (sImage)184 {185 /* Draw state overlay image at top-left of guest-os overlay image: */186 CGRect stateRect = CGRectMake(overlayRect.origin.x - CGImageGetWidth(sImage) / 2.0,187 overlayRect.origin.y - CGImageGetHeight(sImage) / 2.0,188 CGImageGetWidth(sImage),189 CGImageGetHeight(sImage));190 CGContextDrawImage(context, flipRect(stateRect), sImage);191 }192 138 } 193 139 } -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.h
r52727 r58489 49 49 virtual ~UIAbstractDockIconPreviewHelper(); 50 50 void initPreviewImages(); 51 inline CGImageRef stateImage() const;52 51 void drawOverlayIcons(CGContextRef context); 53 52 … … 67 66 CGImageRef m_dockMonitorGlossy; 68 67 69 CGImageRef m_statePaused;70 CGImageRef m_stateSaving;71 CGImageRef m_stateRestoring;72 73 68 CGRect m_updateRect; 74 69 CGRect m_monitorRect;
Note:
See TracChangeset
for help on using the changeset viewer.