VirtualBox

Changeset 49363 in vbox for trunk


Ignore:
Timestamp:
Nov 1, 2013 1:07:23 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: VBoxGlobal: Static stuff to determine MacOS X release name.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r48826 r49363  
    209209using namespace UIDefs /* globally */;
    210210
     211#ifdef Q_WS_MAC
     212/** Known MacOS X releases. */
     213enum MacOSXRelease
     214{
     215    MacOSXRelease_Unknown,
     216    MacOSXRelease_SnowLeopard,
     217    MacOSXRelease_Lion,
     218    MacOSXRelease_MountainLion,
     219    MacOSXRelease_Mavericks
     220};
     221#endif /* Q_WS_MAC */
     222
    211223struct StorageSlot
    212224{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r49341 r49363  
    135135#endif /* Q_WS_X11 */
    136136
     137#ifdef Q_WS_MAC
     138#include <sys/utsname.h>
     139#endif /* Q_WS_MAC */
     140
    137141/* External includes: */
    138142#include <math.h>
     
    315319    return mVBox.GetVersion().contains("BETA", Qt::CaseInsensitive);
    316320}
     321
     322#ifdef Q_WS_MAC
     323/** Returns #MacOSXRelease determined using <i>uname</i> call. */
     324MacOSXRelease VBoxGlobal::osRelease()
     325{
     326    /* Prepare 'utsname' struct: */
     327    utsname info;
     328    if (uname(&info) != -1)
     329    {
     330        /* Parse known .release types: */
     331            if (QString(info.release).startsWith("13."))
     332                return MacOSXRelease_Mavericks;
     333        else
     334            if (QString(info.release).startsWith("12."))
     335                return MacOSXRelease_MountainLion;
     336        else
     337            if (QString(info.release).startsWith("11."))
     338                return MacOSXRelease_Lion;
     339        else
     340            if (QString(info.release).startsWith("10."))
     341                return MacOSXRelease_SnowLeopard;
     342    }
     343    /* Unknown by default: */
     344    return MacOSXRelease_Unknown;
     345}
     346#endif /* Q_WS_MAC */
    317347
    318348/**
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r49333 r49363  
    8585    QString versionString() const { return mVerString; }
    8686    bool isBeta() const;
     87
     88#ifdef Q_WS_MAC
     89    static MacOSXRelease osRelease();
     90#endif /* Q_WS_MAC */
    8791
    8892    CVirtualBox virtualBox() const { return mVBox; }
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