VirtualBox

Changeset 6715 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 1, 2008 11:36:46 AM (17 years ago)
Author:
vboxsync
Message:

Mac OS X: Changed overlay icon in the bottom right of the dock icon from
the state icons to the 3D VirtualBox logo. If the vm is in pause state the
current pause image is displayed in the screen. Pause/Restore/Save states
are now indicated by an overlay image in the center of the dock icon.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r6603 r6715  
    267267        images/dock_0.png \
    268268        images/dock_1.png \
    269         images/dock_128x128_transparent.png
     269        images/dock_128x128_transparent.png \
     270        images/VirtualBox_48px.png
    270271
    271272TRANSLATIONS = \
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h

    r6674 r6715  
    283283
    284284    QPixmap mPausedShot;
     285#if defined(Q_WS_MAC)
     286    CGImageRef mVirtualBoxLogo;
     287#endif
    285288};
    286289
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r6659 r6715  
    336336#ifdef Q_WS_MAC
    337337    // Dock images.
    338     CGImageRef dockImgStateRunning;
    339338    CGImageRef dockImgStatePaused;
    340339    CGImageRef dockImgStateSaving;
    341340    CGImageRef dockImgStateRestoring;
    342     CGImageRef dockImgBack75x75;
    343341    CGImageRef dockImgBack100x75;
    344342    CGImageRef dockImgOS;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h

    r6645 r6715  
    255255CGImageRef DarwinQPixmapFromMimeSourceToCGImage (const char *aSource);
    256256CGImageRef DarwinCreateDockBadge (const char *aSource);
    257 CGImageRef DarwinCreateDockPreview (CGImageRef aVMImage, CGImageRef aOverlayImage);
     257CGImageRef DarwinCreateDockPreview (CGImageRef aVMImage, CGImageRef aOverlayImage, CGImageRef aStateImage = NULL);
    258258CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage);
    259259OSStatus DarwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r6681 r6715  
    625625# endif
    626626    , mDarwinKeyModifiers (0)
     627    , mVirtualBoxLogo (NULL)
    627628#endif
    628629{
     
    631632            !mConsole.GetKeyboard().isNull() &&
    632633            !mConsole.GetMouse().isNull());
     634
     635#ifdef Q_WS_MAC
     636    /* Overlay logo for the dock icon */
     637    mVirtualBoxLogo = ::DarwinQPixmapFromMimeSourceToCGImage ("VirtualBox_48px.png");
     638#endif
    633639
    634640    /* enable MouseMove events */
     
    798804
    799805    mConsole.UnregisterCallback (mCallback);
     806
     807#ifdef Q_WS_MAC
     808    CGImageRelease (mVirtualBoxLogo);
     809#endif
    800810}
    801811
     
    29302940                        static_cast <VBoxQuartz2DFrameBuffer *> (mFrameBuf)->imageRef();
    29312941                    SetApplicationDockTileImage (
    2932                         ::DarwinCreateDockPreview (ir, mMainWnd->dockImageState()));
     2942                        ::DarwinCreateDockPreview (ir, mVirtualBoxLogo));
    29332943                }
    29342944                else
    29352945# endif
    29362946                    SetApplicationDockTileImage (
    2937                         ::DarwinCreateDockPreview (mFrameBuf, mMainWnd->dockImageState()));
     2947                        ::DarwinCreateDockPreview (mFrameBuf, mVirtualBoxLogo));
    29382948            }
    29392949#endif
     
    29472957                        r.x() + contentsX(), r.y() + contentsY(),
    29482958                        r.width(), r.height());
     2959
     2960#ifdef Q_WS_MAC
     2961        SetApplicationDockTileImage (
     2962            ::DarwinCreateDockPreview (DarwinQPixmapToCGImage (&mPausedShot),
     2963                                       mVirtualBoxLogo,
     2964                                       mMainWnd->dockImageState()));
     2965#endif
    29492966    }
    29502967}
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r6682 r6715  
    122122#endif
    123123#ifdef Q_WS_MAC
    124     , dockImgStateRunning (NULL)
    125124    , dockImgStatePaused (NULL)
    126125    , dockImgStateSaving (NULL)
    127126    , dockImgStateRestoring (NULL)
    128     , dockImgBack75x75 (NULL)
    129127    , dockImgBack100x75 (NULL)
    130128    , dockImgOS (NULL)
     
    582580#ifdef Q_WS_MAC
    583581    /* prepare the dock images */
    584     dockImgStateRunning   = ::DarwinCreateDockBadge ("state_running_16px.png");
    585582    dockImgStatePaused    = ::DarwinCreateDockBadge ("state_paused_16px.png");
    586583    dockImgStateSaving    = ::DarwinCreateDockBadge ("state_saving_16px.png");
    587584    dockImgStateRestoring = ::DarwinCreateDockBadge ("state_restoring_16px.png");
    588     dockImgBack75x75      = ::DarwinCreateDockBadge ("dock_0.png");
    589585    dockImgBack100x75     = ::DarwinCreateDockBadge ("dock_1.png");
    590586    SetApplicationDockTileImage (dockImgOS);
    591     OverlayApplicationDockTileImage (dockImgStateRunning);
    592587#endif
    593588    mMaskShift.scale (0, 0, QSize::ScaleFree);
     
    598593#ifdef Q_WS_MAC
    599594    /* release the dock images */
    600     if (dockImgStateRunning)
    601         CGImageRelease (dockImgStateRunning);
    602595    if (dockImgStatePaused)
    603596        CGImageRelease (dockImgStatePaused);
     
    606599    if (dockImgStateRestoring)
    607600        CGImageRelease (dockImgStateRestoring);
    608     if (dockImgBack75x75)
    609         CGImageRelease (dockImgBack75x75);
    610601    if (dockImgBack100x75)
    611602        CGImageRelease (dockImgBack100x75);
     
    800791#ifdef Q_WS_MAC
    801792    QString osTypeId = cmachine.GetOSTypeId();
    802 # if 0
    803     QImage osImg75x75 = vboxGlobal().vmGuestOSTypeIcon (osTypeId).convertToImage().smoothScale (75, 75);
    804     QImage osImg = QImage::fromMimeSource ("dock_0.png");
    805     bitBlt (&osImg, 25, 22,
    806             &osImg75x75, 0, 0,
    807             75, 75, /* conversion_flags */ 0);
    808 # else
    809793    QImage osImg100x75 = vboxGlobal().vmGuestOSTypeIcon (osTypeId).convertToImage().smoothScale (100, 75);
    810794    QImage osImg = QImage::fromMimeSource ("dock_1.png");
     
    812796            &osImg100x75, 0, 0,
    813797            100, 75, /* conversion_flags */ 0);
    814 # endif
     798    QImage VBoxOverlay = QImage::fromMimeSource ("VirtualBox_48px.png");
     799    bitBlt (&osImg, osImg.width() - VBoxOverlay.width(), osImg.height() - VBoxOverlay.height(),
     800            &VBoxOverlay, 0, 0,
     801            VBoxOverlay.width(), VBoxOverlay.height(), /* conversion_flags */ 0);
    815802    if (dockImgOS)
    816803        CGImageRelease (dockImgOS);
    817804    dockImgOS = ::DarwinQImageToCGImage (&osImg);
     805    SetApplicationDockTileImage (dockImgOS);
    818806#endif
    819807
     
    19091897            vmDisableMouseIntegrAction->setEnabled (false);
    19101898    }
    1911 
    1912 #ifdef Q_WS_MAC
    1913     SetApplicationDockTileImage (dockImgOS);
    1914     CGImageRef img = dockImageState();
    1915     if (img)
    1916         OverlayApplicationDockTileImage (img);
    1917 #endif
    19181899}
    19191900
     
    21912172{
    21922173    CGImageRef img;
    2193     if (machine_state == CEnums::Running)
    2194         img = dockImgStateRunning;
    2195     else if (machine_state == CEnums::Paused)
     2174    if (machine_state == CEnums::Paused)
    21962175        img = dockImgStatePaused;
    21972176    else if (machine_state == CEnums::Restoring)
     
    31703149        }
    31713150    }
     3151
     3152#ifdef Q_WS_MAC
     3153    CGImageRef img = dockImageState();
     3154    if (img)
     3155        OverlayApplicationDockTileImage (img);
     3156#endif
    31723157}
    31733158
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r6680 r6715  
    118118    if (badge.width() < 32)
    119119        badge = badge.convertToImage().smoothScale (32, 32);
    120     copyBlt (&back, back.width() - badge.width(), back.height() - badge.height(),
     120    copyBlt (&back, (back.width() - badge.width()) / 2.0, (back.height() - badge.height()) / 2.0,
    121121             &badge, 0, 0,
    122122             badge.width(), badge.height());
     123//    copyBlt (&back, back.width() - badge.width(), back.height() - badge.height(),
     124//             &badge, 0, 0,
     125//             badge.width(), badge.height());
    123126    Assert (!back.isNull());
    124127    Assert (back.width() == 128 && back.height() == 128);
     
    128131}
    129132
    130 
    131133/**
    132134 * Creates a dock preview image.
     
    136138 * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    137139 * @param   aVMImage   the vm screen as a CGImageRef
    138  * @param   aOverlayImage   an optional overlay image to add at the bottom right of the icon
    139  */
    140 CGImageRef DarwinCreateDockPreview (CGImageRef aVMImage, CGImageRef aOverlayImage)
     140 * @param   aOverlayImage   an optional icon overlay image to add at the bottom right of the icon
     141 * @param   aStateImage   an optional state overlay image to add at the center of the icon
     142 */
     143CGImageRef DarwinCreateDockPreview (CGImageRef aVMImage, CGImageRef aOverlayImage, CGImageRef aStateImage)
    141144{
    142145    Assert (aVMImage);
     
    189192        iconRect = CGRectInset (iconRect, 1, 1);
    190193        CGContextDrawImage (context, iconRect, aVMImage);
    191         /* the overlay image */
     194        /* the state image at center */
     195        if (aStateImage)
     196        {
     197            CGRect stateRect = CGRectMake ((targetWidth - CGImageGetWidth (aStateImage)) / 2.0, (targetHeight - CGImageGetHeight (aStateImage)) / 2.0, CGImageGetWidth (aStateImage), CGImageGetHeight (aStateImage));
     198            CGContextDrawImage (context, stateRect, aStateImage);
     199        }
     200        /* the overlay image at bottom/right */
    192201        if (aOverlayImage)
    193202        {
     
    214223 * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    215224 * @param   aFrameBuffer    The guest frame buffer.
    216  * @param   aOverlayImage   an optional overlay image to add at the bottom right of the icon
     225 * @param   aOverlayImage   an optional icon overlay image to add at the bottom right of the icon
    217226 */
    218227CGImageRef DarwinCreateDockPreview (VBoxFrameBuffer *aFrameBuffer, CGImageRef aOverlayImage)
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