VirtualBox

Changeset 58382 in vbox


Ignore:
Timestamp:
Oct 22, 2015 5:18:37 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: 7909: Mac OS X: Runtime UI: Extra-Data Manager: Adding extra-data config setting for showing/hiding guest-os overlay in application dock icon.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r57508 r58382  
    136136const char* UIExtraDataDefs::GUI_RealtimeDockIconUpdateEnabled = "GUI/RealtimeDockIconUpdateEnabled";
    137137const char* UIExtraDataDefs::GUI_RealtimeDockIconUpdateMonitor = "GUI/RealtimeDockIconUpdateMonitor";
     138const char* UIExtraDataDefs::GUI_DockIconOverlayEnabled = "GUI/DockIconOverlayEnabled";
    138139#endif /* Q_WS_MAC */
    139140const char* UIExtraDataDefs::GUI_PassCAD = "GUI/PassCAD";
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r57508 r58382  
    235235        /** Mac OS X: Holds guest-screen which Dock icon should reflect at runtime. */
    236236        extern const char* GUI_RealtimeDockIconUpdateMonitor;
     237        /** Mac OS X: Holds whether Dock icon should have guest-os overlay. */
     238        extern const char* GUI_DockIconOverlayEnabled;
    237239#endif /* Q_WS_MAC */
    238240        /** Holds whether machine should pass CAD to guest. */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r58377 r58382  
    18741874           << GUI_StatusBar_Enabled << GUI_RestrictedStatusBarIndicators << GUI_StatusBar_IndicatorOrder
    18751875#ifdef Q_WS_MAC
    1876            << GUI_RealtimeDockIconUpdateEnabled << GUI_RealtimeDockIconUpdateMonitor
     1876           << GUI_RealtimeDockIconUpdateEnabled << GUI_RealtimeDockIconUpdateMonitor << GUI_DockIconOverlayEnabled
    18771877#endif /* Q_WS_MAC */
    18781878           << GUI_PassCAD
     
    34303430    setExtraDataString(GUI_RealtimeDockIconUpdateMonitor, iIndex ? QString::number(iIndex) : QString(), strID);
    34313431}
     3432
     3433bool UIExtraDataManager::dockIconOverlayEnabled(const QString &strID)
     3434{
     3435    /* 'True' unless feature restricted: */
     3436    return !isFeatureRestricted(GUI_DockIconOverlayEnabled, strID);
     3437}
     3438
     3439void UIExtraDataManager::setdockIconOverlayEnabled(bool fEnabled, const QString &strID)
     3440{
     3441    /* 'False' if feature restricted, 'True' otherwise: */
     3442    setExtraDataString(GUI_DockIconOverlayEnabled, toFeatureRestricted(!fEnabled), strID);
     3443}
    34323444#endif /* Q_WS_MAC */
    34333445
     
    38103822#ifdef Q_WS_MAC
    38113823            /* 'Dock icon' appearance changed (allowed if not restricted)? */
    3812             else if (   strKey == GUI_RealtimeDockIconUpdateEnabled
    3813                      || strKey == GUI_RealtimeDockIconUpdateMonitor)
     3824            else if (strKey == GUI_RealtimeDockIconUpdateEnabled ||
     3825                     strKey == GUI_RealtimeDockIconUpdateMonitor)
    38143826                emit sigDockIconAppearanceChange(!isFeatureRestricted(strKey, strMachineID));
     3827            /* 'Dock icon overlay' appearance changed (allowed if not restricted)? */
     3828            else if (strKey == GUI_DockIconOverlayEnabled)
     3829                emit sigDockIconOverlayAppearanceChange(!isFeatureRestricted(strKey, strMachineID));
    38153830#endif /* Q_WS_MAC */
    38163831        }
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r57508 r58382  
    9292    /** Mac OS X: Notifies about 'dock icon' appearance change. */
    9393    void sigDockIconAppearanceChange(bool fEnabled);
     94    /** Mac OS X: Notifies about 'dock icon overlay' appearance change. */
     95    void sigDockIconOverlayAppearanceChange(bool fEnabled);
    9496#endif /* RT_OS_DARWIN */
    9597
     
    460462        /** Mac OS X: Defines guest-screen @a iIndex which Dock icon should reflect at runtime. */
    461463        void setRealtimeDockIconUpdateMonitor(int iIndex, const QString &strID);
     464
     465        /** Mac OS X: Returns whether Dock icon overlay is enabled. */
     466        bool dockIconOverlayEnabled(const QString &strID);
     467        /** Mac OS X: Defines whether Dock icon overlay @a fEnabled. */
     468        void setdockIconOverlayEnabled(bool fEnabled, const QString &strID);
    462469#endif /* Q_WS_MAC */
    463470
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp

    r58343 r58382  
    55
    66/*
    7  * Copyright (C) 2009-2010 Oracle Corporation
     7 * Copyright (C) 2009-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525/* GUI includes: */
    2626# include "UIAbstractDockIconPreview.h"
     27# include "UIConverter.h"
     28# include "UIExtraDataManager.h"
    2729# include "UIFrameBuffer.h"
    2830# include "UIMachineLogic.h"
    2931# include "UIMachineView.h"
    30 # include "UIConverter.h"
    3132# include "UISession.h"
     33# include "VBoxGlobal.h"
    3234
    3335/* COM includes: */
     
    160162void UIAbstractDockIconPreviewHelper::drawOverlayIcons(CGContextRef context)
    161163{
    162     CGRect overlayRect = CGRectMake(0, 0, 0, 0);
    163     /* The overlay image at bottom/right */
    164     if (m_overlayImage)
     164    /* Determine whether dock icon overlay enabled: */
     165    if (gEDataManager->dockIconOverlayEnabled(vboxGlobal().managedVMUuid()))
    165166    {
    166         overlayRect = CGRectMake(m_dockIconRect.size.width - CGImageGetWidth(m_overlayImage),
    167                                  m_dockIconRect.size.height - CGImageGetHeight(m_overlayImage),
    168                                  CGImageGetWidth(m_overlayImage),
    169                                  CGImageGetHeight(m_overlayImage));
    170         CGContextDrawImage(context, flipRect(overlayRect), m_overlayImage);
    171     }
    172     CGImageRef sImage = stateImage();
    173     /* The state image at bottom/right */
    174     if (sImage)
    175     {
    176         CGRect stateRect = CGRectMake(overlayRect.origin.x - CGImageGetWidth(sImage) / 2.0,
    177                                       overlayRect.origin.y - CGImageGetHeight(sImage) / 2.0,
    178                                       CGImageGetWidth(sImage),
    179                                       CGImageGetHeight(sImage));
    180         CGContextDrawImage(context, flipRect(stateRect), sImage);
     167        /* Initialize overlayrect: */
     168        CGRect overlayRect = CGRectMake(0, 0, 0, 0);
     169        /* Make sure overlay image is valid: */
     170        if (m_overlayImage)
     171        {
     172            /* Draw overlay image at bottom-right of dock icon: */
     173            overlayRect = CGRectMake(m_dockIconRect.size.width - CGImageGetWidth(m_overlayImage),
     174                                     m_dockIconRect.size.height - CGImageGetHeight(m_overlayImage),
     175                                     CGImageGetWidth(m_overlayImage),
     176                                     CGImageGetHeight(m_overlayImage));
     177            CGContextDrawImage(context, flipRect(overlayRect), m_overlayImage);
     178        }
     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        }
    181192    }
    182193}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r58346 r58382  
    11931193    connect(gEDataManager, SIGNAL(sigDockIconAppearanceChange(bool)),
    11941194            this, SLOT(sltChangeDockIconUpdate(bool)));
     1195    connect(gEDataManager, SIGNAL(sigDockIconOverlayAppearanceChange(bool)),
     1196            this, SLOT(sltChangeDockIconOverlayAppearance(bool)));
    11951197
    11961198    /* Monitor selection if there are more than one monitor */
     
    21282130    }
    21292131}
     2132
     2133void UIMachineLogic::sltChangeDockIconOverlayAppearance(bool fEnabled)
     2134{
     2135    /* Value of flag is directly referenced from extra-data manager later: */
     2136    Q_UNUSED(fEnabled);
     2137    /* Update dock icon overlay: */
     2138    if (isMachineWindowsCreated())
     2139        updateDockOverlay();
     2140}
    21302141#endif /* Q_WS_MAC */
    21312142
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r57178 r58382  
    311311    void sltDockPreviewMonitorChanged(QAction *pAction);
    312312    void sltChangeDockIconUpdate(bool fEnabled);
     313    void sltChangeDockIconOverlayAppearance(bool fEnabled);
    313314#endif /* RT_OS_DARWIN */
    314315
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