Changeset 95100 in vbox
- Timestamp:
- May 25, 2022 12:59:54 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.cpp
r93115 r95100 22 22 23 23 /* GUI include */ 24 #include "UIDesktopWidgetWatchdog.h" 24 25 #include "UIImageTools.h" 25 26 … … 201 202 } 202 203 203 static QImage betaLabelImage(const QSize &size) 204 { 204 static QImage betaLabelImage(QSize size, QWidget *pHint) 205 { 206 /* Calculate device pixel ratio: */ 207 const double dDpr = pHint ? gpDesktop->devicePixelRatio(pHint) : gpDesktop->devicePixelRatio(-1); 208 if (dDpr > 1.0) 209 size *= dDpr; 210 205 211 /* Beta label: */ 206 212 QColor bgc(246, 179, 0); … … 224 230 /* The text: */ 225 231 QFont f = p.font(); 232 if (dDpr > 1.0) 233 f.setPointSize(f.pointSize() * dDpr); 226 234 f.setBold(true); 227 235 QPainterPath tp; … … 254 262 p1.fillRect(0, 0, size.width(), size.height(), lg); 255 263 p1.end(); 264 if (dDpr > 1.0) 265 i1.setDevicePixelRatio(dDpr); 256 266 257 267 return i1; 258 268 } 259 269 260 QPixmap UIImageTools::betaLabel(const QSize &size /* = QSize(80, 16) */ )261 { 262 return QPixmap::fromImage(betaLabelImage(size ));263 } 270 QPixmap UIImageTools::betaLabel(const QSize &size /* = QSize(80, 16) */, QWidget *pHint /* = 0 */) 271 { 272 return QPixmap::fromImage(betaLabelImage(size, pHint)); 273 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.h
r93115 r95100 46 46 47 47 /** Applies BET-label of passed @a size. */ 48 SHARED_LIBRARY_STUFF QPixmap betaLabel(const QSize &size = QSize(80, 16) );48 SHARED_LIBRARY_STUFF QPixmap betaLabel(const QSize &size = QSize(80, 16), QWidget *pHint = 0); 49 49 } 50 50 using namespace UIImageTools /* if header included */; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r95078 r95100 2031 2031 if (uiCommon().isBeta()) 2032 2032 { 2033 QPixmap betaLabel = ::betaLabel(QSize(74, 26));2033 QPixmap betaLabel = ::betaLabel(QSize(74, darwinWindowTitleHeight(this) - 1)); 2034 2034 ::darwinLabelWindow(this, &betaLabel); 2035 2035 } -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
r95082 r95100 132 132 } 133 133 134 void darwinLabelWindow(NativeNSWindowRef pWindow, NativeNSImageRef pImage )134 void darwinLabelWindow(NativeNSWindowRef pWindow, NativeNSImageRef pImage, double dDpr) 135 135 { 136 136 /* Get the parent view of the close button. */ … … 142 142 NSSize s1 = [wv frame].size; 143 143 /* Correctly position the label. */ 144 NSImageView *iv = [[NSImageView alloc] initWithFrame:NSMakeRect(s1.width - s.width ,145 s1.height - s.height - 1,146 s.width , s.height)];144 NSImageView *iv = [[NSImageView alloc] initWithFrame:NSMakeRect(s1.width - s.width / dDpr, 145 s1.height - s.height / dDpr - 1, 146 s.width / dDpr, s.height / dDpr)]; 147 147 /* Configure the NSImageView for auto moving. */ 148 148 [iv setImage:pImage]; -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
r95082 r95100 75 75 void darwinLabelWindow(QWidget *pWidget, QPixmap *pPixmap) 76 76 { 77 ::darwinLabelWindow(::darwinToNativeWindow(pWidget), ::darwinToNSImageRef(pPixmap) );77 ::darwinLabelWindow(::darwinToNativeWindow(pWidget), ::darwinToNSImageRef(pPixmap), pPixmap->devicePixelRatio()); 78 78 } 79 79 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
r95082 r95100 88 88 void darwinSetShowsResizeIndicatorImpl(NativeNSWindowRef pWindow, bool fEnabled); 89 89 void darwinSetHidesAllTitleButtonsImpl(NativeNSWindowRef pWindow); 90 SHARED_LIBRARY_STUFF void darwinLabelWindow(NativeNSWindowRef pWindow, NativeNSImageRef pImage );90 SHARED_LIBRARY_STUFF void darwinLabelWindow(NativeNSWindowRef pWindow, NativeNSImageRef pImage, double dDpr); 91 91 void darwinSetShowsWindowTransparentImpl(NativeNSWindowRef pWindow, bool fEnabled); 92 92 SHARED_LIBRARY_STUFF void darwinSetWindowHasShadow(NativeNSWindowRef pWindow, bool fEnabled); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r95078 r95100 347 347 if (uiCommon().isBeta()) 348 348 { 349 QPixmap betaLabel = ::betaLabel(QSize(74, 26));349 QPixmap betaLabel = ::betaLabel(QSize(74, darwinWindowTitleHeight(this) - 1)); 350 350 ::darwinLabelWindow(this, &betaLabel); 351 351 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
r95078 r95100 74 74 if (uiCommon().isBeta()) 75 75 { 76 QPixmap betaLabel = ::betaLabel(QSize(74, 26));76 QPixmap betaLabel = ::betaLabel(QSize(74, darwinWindowTitleHeight(this) - 1)); 77 77 ::darwinLabelWindow(this, &betaLabel); 78 78 }
Note:
See TracChangeset
for help on using the changeset viewer.