VirtualBox

Ignore:
Timestamp:
Oct 20, 2015 3:16:57 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: Runtime UI: Make sure dock icon state overlay is HiDPI aware.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp

    r52730 r58343  
    2020#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2121
    22 /* VBox includes */
     22/* Qt includes: */
     23#include <QStyle>
     24
     25/* GUI includes: */
    2326# include "UIAbstractDockIconPreview.h"
    2427# include "UIFrameBuffer.h"
    2528# include "UIMachineLogic.h"
    2629# include "UIMachineView.h"
     30# include "UIConverter.h"
    2731# include "UISession.h"
     32
     33/* COM includes: */
     34# include "COMEnums.h"
    2835
    2936#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    6673    Assert(m_overlayImage);
    6774
    68     m_statePaused    = ::darwinToCGImageRef("state_paused_16px.png");
     75    /* Determine desired icon size for the state-overlay: */
     76    const QStyle *pStyle = QApplication::style();
     77    const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
     78    const QSize iconSize = QSize(iIconMetric, iIconMetric);
     79
     80    /* Prepare 'Paused' state-overlay: */
     81    const QPixmap statePaused = gpConverter->toIcon(KMachineState_Paused).pixmap(iconSize);
     82    m_statePaused = ::darwinToCGImageRef(&statePaused);
    6983    Assert(m_statePaused);
    70     m_stateSaving    = ::darwinToCGImageRef("state_saving_16px.png");
     84
     85    /* Prepare 'Saving' state-overlay: */
     86    const QPixmap stateSaving = gpConverter->toIcon(KMachineState_Saving).pixmap(iconSize);
     87    m_stateSaving = ::darwinToCGImageRef(&stateSaving);
    7188    Assert(m_stateSaving);
    72     m_stateRestoring = ::darwinToCGImageRef("state_restoring_16px.png");
     89
     90    /* Prepare 'Restoring' state-overlay: */
     91    const QPixmap stateRestoring = gpConverter->toIcon(KMachineState_Restoring).pixmap(iconSize);
     92    m_stateRestoring = ::darwinToCGImageRef(&stateRestoring);
    7393    Assert(m_stateRestoring);
    7494}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette