VirtualBox

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


Ignore:
Timestamp:
Dec 11, 2008 3:15:25 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt: Don't generate KEnum_COUNT values for COM enums as they might easy get wrong values (next integer after the last enum member which is not necessarily the largest) and screw the GUI.

Location:
trunk/src/VBox/Frontends
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl

    r14187 r15304  
    134134      <xsl:text>,&#x0A;</xsl:text>
    135135    </xsl:for-each>
    136     <xsl:text>    </xsl:text>
    137     <xsl:value-of select="concat('K',@name,'_COUNT')"/>
    138136    <xsl:text>&#x0A;};&#x0A;&#x0A;</xsl:text>
    139137  </xsl:for-each>
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r13601 r15304  
    386386public:
    387387
     388    typedef QMap <ulong, QString> QULongStringMap;
     389    typedef QMap <long, QString> QLongStringMap;
     390
    388391    static VBoxGlobal &instance();
    389392
     
    429432    {
    430433        static const QColor none;
    431         AssertMsg (vm_state_color [s], ("No color for %d", s));
    432         return vm_state_color [s] ? *vm_state_color [s] : none;
     434        AssertMsg (vm_state_color.find (s), ("No color for %d", s));
     435        return vm_state_color.find (s) ? *vm_state_color [s] : none;
    433436    }
    434437
     
    461464    KStorageBus toStorageBusType (const QString &aBus) const
    462465    {
    463         QStringVector::const_iterator it =
     466        QULongStringMap::const_iterator it =
    464467            qFind (storageBuses.begin(), storageBuses.end(), aBus);
    465468        AssertMsg (it != storageBuses.end(), ("No value for {%s}", aBus.latin1()));
    466         return KStorageBus (it - storageBuses.begin());
     469        return KStorageBus (it.key());
    467470    }
    468471
     
    521524    KClipboardMode toClipboardModeType (const QString &s) const
    522525    {
    523         QStringVector::const_iterator it =
     526        QULongStringMap::const_iterator it =
    524527            qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
    525528        AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.latin1()));
    526         return KClipboardMode (it - clipboardTypes.begin());
     529        return KClipboardMode (it.key());
    527530    }
    528531
     
    535538    KIDEControllerType toIDEControllerType (const QString &s) const
    536539    {
    537         QStringVector::const_iterator it =
     540        QULongStringMap::const_iterator it =
    538541            qFind (ideControllerTypes.begin(), ideControllerTypes.end(), s);
    539542        AssertMsg (it != ideControllerTypes.end(), ("No value for {%s}", s.latin1()));
    540         return KIDEControllerType (it - ideControllerTypes.begin());
     543        return KIDEControllerType (it.key());
    541544    }
    542545
    543546    KVRDPAuthType toVRDPAuthType (const QString &s) const
    544547    {
    545         QStringVector::const_iterator it =
     548        QULongStringMap::const_iterator it =
    546549            qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
    547550        AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.latin1()));
    548         return KVRDPAuthType (it - vrdpAuthTypes.begin());
     551        return KVRDPAuthType (it.key());
    549552    }
    550553
    551554    KPortMode toPortMode (const QString &s) const
    552555    {
    553         QStringVector::const_iterator it =
     556        QULongStringMap::const_iterator it =
    554557            qFind (portModeTypes.begin(), portModeTypes.end(), s);
    555558        AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.latin1()));
    556         return KPortMode (it - portModeTypes.begin());
     559        return KPortMode (it.key());
    557560    }
    558561
    559562    KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
    560563    {
    561         QStringVector::const_iterator it =
     564        QULongStringMap::const_iterator it =
    562565            qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
    563566        AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.latin1()));
    564         return KUSBDeviceFilterAction (it - usbFilterActionTypes.begin());
     567        return KUSBDeviceFilterAction (it.key());
    565568    }
    566569
     
    573576    KDeviceType toDeviceType (const QString &s) const
    574577    {
    575         QStringVector::const_iterator it =
     578        QULongStringMap::const_iterator it =
    576579            qFind (deviceTypes.begin(), deviceTypes.end(), s);
    577580        AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.latin1()));
    578         return KDeviceType (it - deviceTypes.begin());
     581        return KDeviceType (it.key());
    579582    }
    580583
     
    589592    KAudioDriverType toAudioDriverType (const QString &s) const
    590593    {
    591         QStringVector::const_iterator it =
     594        QULongStringMap::const_iterator it =
    592595            qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
    593596        AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.latin1()));
    594         return KAudioDriverType (it - audioDriverTypes.begin());
     597        return KAudioDriverType (it.key());
    595598    }
    596599
     
    603606    KAudioControllerType toAudioControllerType (const QString &s) const
    604607    {
    605         QStringVector::const_iterator it =
     608        QULongStringMap::const_iterator it =
    606609            qFind (audioControllerTypes.begin(), audioControllerTypes.end(), s);
    607610        AssertMsg (it != audioControllerTypes.end(), ("No value for {%s}", s.latin1()));
    608         return KAudioControllerType (it - audioControllerTypes.begin());
     611        return KAudioControllerType (it.key());
    609612    }
    610613
     
    617620    KNetworkAdapterType toNetworkAdapterType (const QString &s) const
    618621    {
    619         QStringVector::const_iterator it =
     622        QULongStringMap::const_iterator it =
    620623            qFind (networkAdapterTypes.begin(), networkAdapterTypes.end(), s);
    621624        AssertMsg (it != networkAdapterTypes.end(), ("No value for {%s}", s.latin1()));
    622         return KNetworkAdapterType (it - networkAdapterTypes.begin());
     625        return KNetworkAdapterType (it.key());
    623626    }
    624627
     
    631634    KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
    632635    {
    633         QStringVector::const_iterator it =
     636        QULongStringMap::const_iterator it =
    634637            qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
    635638        AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.latin1()));
    636         return KNetworkAttachmentType (it - networkAttachmentTypes.begin());
     639        return KNetworkAttachmentType (it.key());
    637640    }
    638641
     
    879882    CVirtualBoxCallback callback;
    880883
    881     typedef QValueVector <QString> QStringVector;
    882 
    883884    QString verString;
    884885
    885886    QValueVector <CGuestOSType> vm_os_types;
    886887    QDict <QPixmap> vm_os_type_icons;
    887     QPtrVector <QColor> vm_state_color;
     888    QIntDict <QColor> vm_state_color;
    888889
    889890    QIntDict <QPixmap> mStateIcons;
    890891    QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
    891892
    892     QStringVector machineStates;
    893     QStringVector sessionStates;
    894     QStringVector deviceTypes;
    895 
    896     QStringVector storageBuses;
    897     QStringVector storageBusDevices;
    898     QStringVector storageBusChannels;
    899 
    900     QStringVector diskTypes;
     893    QULongStringMap machineStates;
     894    QULongStringMap sessionStates;
     895    QULongStringMap deviceTypes;
     896
     897    QULongStringMap storageBuses;
     898    QLongStringMap storageBusDevices;
     899    QLongStringMap storageBusChannels;
     900
     901    QULongStringMap diskTypes;
    901902    QString diskTypes_Differencing;
    902903
    903     QStringVector vrdpAuthTypes;
    904     QStringVector portModeTypes;
    905     QStringVector usbFilterActionTypes;
    906     QStringVector audioDriverTypes;
    907     QStringVector audioControllerTypes;
    908     QStringVector networkAdapterTypes;
    909     QStringVector networkAttachmentTypes;
    910     QStringVector clipboardTypes;
    911     QStringVector ideControllerTypes;
    912     QStringVector USBDeviceStates;
     904    QULongStringMap vrdpAuthTypes;
     905    QULongStringMap portModeTypes;
     906    QULongStringMap usbFilterActionTypes;
     907    QULongStringMap audioDriverTypes;
     908    QULongStringMap audioControllerTypes;
     909    QULongStringMap networkAdapterTypes;
     910    QULongStringMap networkAttachmentTypes;
     911    QULongStringMap clipboardTypes;
     912    QULongStringMap ideControllerTypes;
     913    QULongStringMap USBDeviceStates;
    913914
    914915    QString mUserDefinedPortName;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r15132 r15304  
    12511251    , mMediaEnumThread (NULL)
    12521252    , verString ("1.0")
    1253     , vm_state_color (KMachineState_COUNT)
    1254     , machineStates (KMachineState_COUNT)
    1255     , sessionStates (KSessionState_COUNT)
    1256     , deviceTypes (KDeviceType_COUNT)
    1257     , storageBuses (KStorageBus_COUNT)
    1258     , storageBusDevices (2)
    1259     , storageBusChannels (3)
    1260     , diskTypes (KHardDiskType_COUNT)
    1261     , vrdpAuthTypes (KVRDPAuthType_COUNT)
    1262     , portModeTypes (KPortMode_COUNT)
    1263     , usbFilterActionTypes (KUSBDeviceFilterAction_COUNT)
    1264     , audioDriverTypes (KAudioDriverType_COUNT)
    1265     , audioControllerTypes (KAudioControllerType_COUNT)
    1266     , networkAdapterTypes (KNetworkAdapterType_COUNT)
    1267     , networkAttachmentTypes (KNetworkAttachmentType_COUNT)
    1268     , clipboardTypes (KClipboardMode_COUNT)
    1269     , ideControllerTypes (KIDEControllerType_COUNT)
    1270     , USBDeviceStates (KUSBDeviceState_COUNT)
    12711253    , detailReportTemplatesReady (false)
    12721254{
     
    14841466QString VBoxGlobal::toString (KStorageBus aBus, LONG aChannel) const
    14851467{
    1486     Assert (storageBusChannels.count() == 3);
    14871468    QString channel;
    14881469
     
    15081489    }
    15091490
     1491    Assert (!channel.isNull());
    15101492    return channel;
    15111493}
     
    15231505        case KStorageBus_IDE:
    15241506        {
    1525             QStringVector::const_iterator it =
     1507            QLongStringMap::const_iterator it =
    15261508                qFind (storageBusChannels.begin(), storageBusChannels.end(),
    15271509                       aChannel);
    15281510            AssertMsgBreak (it != storageBusChannels.end(),
    15291511                            ("No value for {%s}\n", aChannel.latin1()));
    1530             channel = (LONG) (it - storageBusChannels.begin());
     1512            channel = it.key();
    15311513            break;
    15321514        }
     
    15601542    NOREF (aChannel);
    15611543
    1562     Assert (storageBusDevices.count() == 2);
    15631544    QString device;
    15641545
     
    15851566    }
    15861567
     1568    Assert (!device.isNull());
    15871569    return device;
    15881570}
     
    16041586        case KStorageBus_IDE:
    16051587        {
    1606             QStringVector::const_iterator it =
     1588            QLongStringMap::const_iterator it =
    16071589                qFind (storageBusDevices.begin(), storageBusDevices.end(),
    16081590                       aDevice);
    16091591            AssertMsg (it != storageBusDevices.end(),
    16101592                       ("No value for {%s}", aDevice.latin1()));
    1611             device = (LONG) (it - storageBusDevices.begin());
     1593            device = it.key();
    16121594            break;
    16131595        }
     
    16671649    static QStringList list;
    16681650    if (list.empty())
    1669         for (uint i = 0; i < deviceTypes.count() - 1 /* usb=n/a */; i++)
    1670             list += deviceTypes [i];
     1651        for (QULongStringMap::const_iterator it = deviceTypes.begin();
     1652             it != deviceTypes.end(); ++ it)
     1653            list += it.data();
    16711654    return list;
    16721655}
     
    30112994        tr ("SATA", "StorageBus");
    30122995
    3013     Assert (storageBusChannels.count() == 3);
    30142996    storageBusChannels [0] =
    30152997        tr ("Primary", "StorageBusChannel");
     
    30193001        tr ("Port %1", "StorageBusChannel");
    30203002
    3021     Assert (storageBusDevices.count() == 2);
    30223003    storageBusDevices [0] = tr ("Master", "StorageBusDevice");
    30233004    storageBusDevices [1] = tr ("Slave", "StorageBusDevice");
     
    47064687    static const char *kOSTypeIcons [][2] =
    47074688    {
    4708         {"unknown",     "os_unknown.png"},
    4709         {"dos",         "os_dos.png"},
    4710         {"win31",       "os_win31.png"},
    4711         {"win95",       "os_win95.png"},
    4712         {"win98",       "os_win98.png"},
    4713         {"winme",       "os_winme.png"},
    4714         {"winnt4",      "os_winnt4.png"},
    4715         {"win2k",       "os_win2k.png"},
    4716         {"winxp",       "os_winxp.png"},
    4717         {"win2k3",      "os_win2k3.png"},
    4718         {"winvista",    "os_winvista.png"},
    4719         {"win2k8",      "os_win2k8.png"},
    4720         {"os2warp3",    "os_os2warp3.png"},
    4721         {"os2warp4",    "os_os2warp4.png"},
    4722         {"os2warp45",   "os_os2warp45.png"},
    4723         {"ecs",         "os_ecs.png"},
    4724         {"linux22",     "os_linux22.png"},
    4725         {"linux24",     "os_linux24.png"},
    4726         {"linux26",     "os_linux26.png"},
    4727         {"archlinux",   "os_archlinux.png"},
    4728         {"debian",      "os_debian.png"},
    4729         {"opensolaris", "os_opensolaris.png"},
    4730         {"opensuse",    "os_opensuse.png"},
    4731         {"fedoracore"  ,"os_fedoracore.png"},
    4732         {"gentoo",      "os_gentoo.png"},
    4733         {"mandriva",    "os_mandriva.png"},
    4734         {"redhat",      "os_redhat.png"},
    4735         {"ubuntu",      "os_ubuntu.png"},
    4736         {"xandros",     "os_xandros.png"},
    4737         {"freebsd",     "os_freebsd.png"},
    4738         {"openbsd",     "os_openbsd.png"},
    4739         {"netbsd",      "os_netbsd.png"},
    4740         {"netware",     "os_netware.png"},
    4741         {"solaris",     "os_solaris.png"},
    4742         {"l4",          "os_l4.png"},
     4689        {"Other",           "os_other.png"},
     4690        {"DOS",             "os_dos.png"},
     4691        {"Netware",         "os_netware.png"},
     4692        {"L4",              "os_l4.png"},
     4693        {"Windows31",       "os_win31.png"},
     4694        {"Windows95",       "os_win95.png"},
     4695        {"Windows98",       "os_win98.png"},
     4696        {"WindowsMe",       "os_winme.png"},
     4697        {"WindowsNT4",      "os_winnt4.png"},
     4698        {"Windows2000",     "os_win2k.png"},
     4699        {"WindowsXP",       "os_winxp.png"},
     4700        {"WindowsXP_64",    "os_winxp_64.png"},
     4701        {"Windows2003",     "os_win2k3.png"},
     4702        {"Windows2003_64",  "os_win2k3_64.png"},
     4703        {"WindowsVista",    "os_winvista.png"},
     4704        {"WindowsVista_64", "os_winvista_64.png"},
     4705        {"Windows2008",     "os_win2k8.png"},
     4706        {"Windows2008_64",  "os_win2k8_64.png"},
     4707        {"WindowsNT",       "os_win_other.png"},
     4708        {"OS2Warp3",        "os_os2warp3.png"},
     4709        {"OS2Warp4",        "os_os2warp4.png"},
     4710        {"OS2Warp45",       "os_os2warp45.png"},
     4711        {"OS2eCS",          "os_os2ecs.png"},
     4712        {"OS2",             "os_os2_other.png"},
     4713        {"Linux22",         "os_linux22.png"},
     4714        {"Linux24",         "os_linux24.png"},
     4715        {"Linux24_64",      "os_linux24_64.png"},
     4716        {"Linux26",         "os_linux26.png"},
     4717        {"Linux26_64",      "os_linux26_64.png"},
     4718        {"ArchLinux",       "os_archlinux.png"},
     4719        {"ArchLinux_64",    "os_archlinux_64.png"},
     4720        {"Debian",          "os_debian.png"},
     4721        {"Debian_64",       "os_debian_64.png"},
     4722        {"OpenSUSE",        "os_opensuse.png"},
     4723        {"OpenSUSE_64",     "os_opensuse_64.png"},
     4724        {"Fedora",          "os_fedora.png"},
     4725        {"Fedora_64",       "os_fedora_64.png"},
     4726        {"Gentoo",          "os_gentoo.png"},
     4727        {"Gentoo_64",       "os_gentoo_64.png"},
     4728        {"Mandriva",        "os_mandriva.png"},
     4729        {"Mandriva_64",     "os_mandriva_64.png"},
     4730        {"RedHat",          "os_redhat.png"},
     4731        {"RedHat_64",       "os_redhat_64.png"},
     4732        {"Ubuntu",          "os_ubuntu.png"},
     4733        {"Ubuntu_64",       "os_ubuntu_64.png"},
     4734        {"Xandros",         "os_xandros.png"},
     4735        {"Xandros_64",      "os_xandros_64.png"},
     4736        {"Linux",           "os_linux_other.png"},
     4737        {"FreeBSD",         "os_freebsd.png"},
     4738        {"FreeBSD_64",      "os_freebsd_64.png"},
     4739        {"OpenBSD",         "os_openbsd.png"},
     4740        {"OpenBSD_64",      "os_openbsd_64.png"},
     4741        {"NetBSD",          "os_netbsd.png"},
     4742        {"NetBSD_64",       "os_netbsd_64.png"},
     4743        {"Solaris",         "os_solaris.png"},
     4744        {"Solaris_64",      "os_solaris_64.png"},
     4745        {"OpenSolaris",     "os_opensolaris.png"},
     4746        {"OpenSolaris_64",  "os_opensolaris_64.png"},
     4747        {"QNX",             "os_other.png"},
    47434748    };
    47444749    vm_os_type_icons.setAutoDelete (true); /* takes ownership of elements */
  • trunk/src/VBox/Frontends/VirtualBox4/include/COMWrappers.xsl

    r14514 r15304  
    134134      <xsl:text>,&#x0A;</xsl:text>
    135135    </xsl:for-each>
    136     <xsl:text>    </xsl:text>
    137     <xsl:value-of select="concat('K',@name,'_COUNT')"/>
    138136    <xsl:text>&#x0A;};&#x0A;&#x0A;</xsl:text>
    139137  </xsl:for-each>
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r14977 r15304  
    496496public:
    497497
     498    typedef QHash <ulong, QString> QULongStringHash;
     499    typedef QHash <long, QString> QLongStringHash;
     500
    498501    static VBoxGlobal &instance();
    499502
    500503    bool isValid() { return mValid; }
    501504
    502     QString versionString() { return verString; }
     505    QString versionString() { return mVerString; }
    503506
    504507    CVirtualBox virtualBox() const { return mVBox; }
     
    545548    QPixmap toIcon (KMachineState s) const
    546549    {
    547         QPixmap *pm = mStateIcons.value (s);
     550        QPixmap *pm = mVMStateIcons.value (s);
    548551        AssertMsg (pm, ("Icon for VM state %d must be defined", s));
    549552        return pm ? *pm : QPixmap();
     
    553556    {
    554557        static const QColor none;
    555         AssertMsg (vm_state_color.value (s), ("No color for %d", s));
    556         return vm_state_color.value (s) ? *vm_state_color.value(s) : none;
     558        AssertMsg (mVMStateColors.value (s), ("No color for %d", s));
     559        return mVMStateColors.value (s) ? *mVMStateColors.value (s) : none;
    557560    }
    558561
    559562    QString toString (KMachineState s) const
    560563    {
    561         AssertMsg (!machineStates.value (s).isNull(), ("No text for %d", s));
    562         return machineStates.value (s);
     564        AssertMsg (!mMachineStates.value (s).isNull(), ("No text for %d", s));
     565        return mMachineStates.value (s);
    563566    }
    564567
    565568    QString toString (KSessionState s) const
    566569    {
    567         AssertMsg (!sessionStates.value (s).isNull(), ("No text for %d", s));
    568         return sessionStates.value (s);
     570        AssertMsg (!mSessionStates.value (s).isNull(), ("No text for %d", s));
     571        return mSessionStates.value (s);
    569572    }
    570573
     
    575578    QString toString (KStorageBus aBus) const
    576579    {
    577         AssertMsg (!storageBuses.value (aBus).isNull(), ("No text for %d", aBus));
    578         return storageBuses [aBus];
     580        AssertMsg (!mStorageBuses.value (aBus).isNull(), ("No text for %d", aBus));
     581        return mStorageBuses [aBus];
    579582    }
    580583
     
    585588    KStorageBus toStorageBusType (const QString &aBus) const
    586589    {
    587         QStringVector::const_iterator it =
    588             qFind (storageBuses.begin(), storageBuses.end(), aBus);
    589         AssertMsg (it != storageBuses.end(), ("No value for {%s}", aBus.toLatin1().constData()));
    590         return KStorageBus (it - storageBuses.begin());
     590        QULongStringHash::const_iterator it =
     591            qFind (mStorageBuses.begin(), mStorageBuses.end(), aBus);
     592        AssertMsg (it != mStorageBuses.end(), ("No value for {%s}",
     593                                               aBus.toLatin1().constData()));
     594        return KStorageBus (it.key());
    591595    }
    592596
     
    601605    QString toString (KHardDiskType t) const
    602606    {
    603         AssertMsg (!diskTypes.value (t).isNull(), ("No text for %d", t));
    604         return diskTypes.value (t);
     607        AssertMsg (!mDiskTypes.value (t).isNull(), ("No text for %d", t));
     608        return mDiskTypes.value (t);
    605609    }
    606610
     
    614618        {
    615619            Assert (aHD.GetType() == KHardDiskType_Normal);
    616             return diskTypes_Differencing;
     620            return mDiskTypes_Differencing;
    617621        }
    618622        return toString (aHD.GetType());
     
    621625    QString toString (KVRDPAuthType t) const
    622626    {
    623         AssertMsg (!vrdpAuthTypes.value (t).isNull(), ("No text for %d", t));
    624         return vrdpAuthTypes.value (t);
     627        AssertMsg (!mVRDPAuthTypes.value (t).isNull(), ("No text for %d", t));
     628        return mVRDPAuthTypes.value (t);
    625629    }
    626630
    627631    QString toString (KPortMode t) const
    628632    {
    629         AssertMsg (!portModeTypes.value (t).isNull(), ("No text for %d", t));
    630         return portModeTypes.value (t);
     633        AssertMsg (!mPortModeTypes.value (t).isNull(), ("No text for %d", t));
     634        return mPortModeTypes.value (t);
    631635    }
    632636
    633637    QString toString (KUSBDeviceFilterAction t) const
    634638    {
    635         AssertMsg (!usbFilterActionTypes.value (t).isNull(), ("No text for %d", t));
    636         return usbFilterActionTypes.value (t);
     639        AssertMsg (!mUSBFilterActionTypes.value (t).isNull(), ("No text for %d", t));
     640        return mUSBFilterActionTypes.value (t);
    637641    }
    638642
    639643    QString toString (KClipboardMode t) const
    640644    {
    641         AssertMsg (!clipboardTypes.value (t).isNull(), ("No text for %d", t));
    642         return clipboardTypes.value (t);
     645        AssertMsg (!mClipboardTypes.value (t).isNull(), ("No text for %d", t));
     646        return mClipboardTypes.value (t);
    643647    }
    644648
    645649    KClipboardMode toClipboardModeType (const QString &s) const
    646650    {
    647         QStringVector::const_iterator it =
    648             qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
    649         AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    650         return KClipboardMode (it - clipboardTypes.begin());
     651        QULongStringHash::const_iterator it =
     652            qFind (mClipboardTypes.begin(), mClipboardTypes.end(), s);
     653        AssertMsg (it != mClipboardTypes.end(), ("No value for {%s}",
     654                                                 s.toLatin1().constData()));
     655        return KClipboardMode (it.key());
    651656    }
    652657
    653658    QString toString (KIDEControllerType t) const
    654659    {
    655         AssertMsg (!ideControllerTypes.value (t).isNull(), ("No text for %d", t));
    656         return ideControllerTypes.value (t);
     660        AssertMsg (!mIDEControllerTypes.value (t).isNull(), ("No text for %d", t));
     661        return mIDEControllerTypes.value (t);
    657662    }
    658663
    659664    KIDEControllerType toIDEControllerType (const QString &s) const
    660665    {
    661         QStringVector::const_iterator it =
    662             qFind (ideControllerTypes.begin(), ideControllerTypes.end(), s);
    663         AssertMsg (it != ideControllerTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    664         return KIDEControllerType (it - ideControllerTypes.begin());
     666        QULongStringHash::const_iterator it =
     667            qFind (mIDEControllerTypes.begin(), mIDEControllerTypes.end(), s);
     668        AssertMsg (it != mIDEControllerTypes.end(), ("No value for {%s}",
     669                                                     s.toLatin1().constData()));
     670        return KIDEControllerType (it.key());
    665671    }
    666672
    667673    KVRDPAuthType toVRDPAuthType (const QString &s) const
    668674    {
    669         QStringVector::const_iterator it =
    670             qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
    671         AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    672         return KVRDPAuthType (it - vrdpAuthTypes.begin());
     675        QULongStringHash::const_iterator it =
     676            qFind (mVRDPAuthTypes.begin(), mVRDPAuthTypes.end(), s);
     677        AssertMsg (it != mVRDPAuthTypes.end(), ("No value for {%s}",
     678                                                s.toLatin1().constData()));
     679        return KVRDPAuthType (it.key());
    673680    }
    674681
    675682    KPortMode toPortMode (const QString &s) const
    676683    {
    677         QStringVector::const_iterator it =
    678             qFind (portModeTypes.begin(), portModeTypes.end(), s);
    679         AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    680         return KPortMode (it - portModeTypes.begin());
     684        QULongStringHash::const_iterator it =
     685            qFind (mPortModeTypes.begin(), mPortModeTypes.end(), s);
     686        AssertMsg (it != mPortModeTypes.end(), ("No value for {%s}",
     687                                                s.toLatin1().constData()));
     688        return KPortMode (it.key());
    681689    }
    682690
    683691    KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
    684692    {
    685         QStringVector::const_iterator it =
    686             qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
    687         AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    688         return KUSBDeviceFilterAction (it - usbFilterActionTypes.begin());
     693        QULongStringHash::const_iterator it =
     694            qFind (mUSBFilterActionTypes.begin(), mUSBFilterActionTypes.end(), s);
     695        AssertMsg (it != mUSBFilterActionTypes.end(), ("No value for {%s}",
     696                                                       s.toLatin1().constData()));
     697        return KUSBDeviceFilterAction (it.key());
    689698    }
    690699
    691700    QString toString (KDeviceType t) const
    692701    {
    693         AssertMsg (!deviceTypes.value (t).isNull(), ("No text for %d", t));
    694         return deviceTypes.value (t);
     702        AssertMsg (!mDeviceTypes.value (t).isNull(), ("No text for %d", t));
     703        return mDeviceTypes.value (t);
    695704    }
    696705
    697706    KDeviceType toDeviceType (const QString &s) const
    698707    {
    699         QStringVector::const_iterator it =
    700             qFind (deviceTypes.begin(), deviceTypes.end(), s);
    701         AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    702         return KDeviceType (it - deviceTypes.begin());
     708        QULongStringHash::const_iterator it =
     709            qFind (mDeviceTypes.begin(), mDeviceTypes.end(), s);
     710        AssertMsg (it != mDeviceTypes.end(), ("No value for {%s}",
     711                                              s.toLatin1().constData()));
     712        return KDeviceType (it.key());
    703713    }
    704714
     
    707717    QString toString (KAudioDriverType t) const
    708718    {
    709         AssertMsg (!audioDriverTypes.value (t).isNull(), ("No text for %d", t));
    710         return audioDriverTypes.value (t);
     719        AssertMsg (!mAudioDriverTypes.value (t).isNull(), ("No text for %d", t));
     720        return mAudioDriverTypes.value (t);
    711721    }
    712722
    713723    KAudioDriverType toAudioDriverType (const QString &s) const
    714724    {
    715         QStringVector::const_iterator it =
    716             qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
    717         AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    718         return KAudioDriverType (it - audioDriverTypes.begin());
     725        QULongStringHash::const_iterator it =
     726            qFind (mAudioDriverTypes.begin(), mAudioDriverTypes.end(), s);
     727        AssertMsg (it != mAudioDriverTypes.end(), ("No value for {%s}",
     728                                                   s.toLatin1().constData()));
     729        return KAudioDriverType (it.key());
    719730    }
    720731
    721732    QString toString (KAudioControllerType t) const
    722733    {
    723         AssertMsg (!audioControllerTypes.value (t).isNull(), ("No text for %d", t));
    724         return audioControllerTypes.value (t);
     734        AssertMsg (!mAudioControllerTypes.value (t).isNull(), ("No text for %d", t));
     735        return mAudioControllerTypes.value (t);
    725736    }
    726737
    727738    KAudioControllerType toAudioControllerType (const QString &s) const
    728739    {
    729         QStringVector::const_iterator it =
    730             qFind (audioControllerTypes.begin(), audioControllerTypes.end(), s);
    731         AssertMsg (it != audioControllerTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    732         return KAudioControllerType (it - audioControllerTypes.begin());
     740        QULongStringHash::const_iterator it =
     741            qFind (mAudioControllerTypes.begin(), mAudioControllerTypes.end(), s);
     742        AssertMsg (it != mAudioControllerTypes.end(), ("No value for {%s}",
     743                                                       s.toLatin1().constData()));
     744        return KAudioControllerType (it.key());
    733745    }
    734746
    735747    QString toString (KNetworkAdapterType t) const
    736748    {
    737         AssertMsg (!networkAdapterTypes.value (t).isNull(), ("No text for %d", t));
    738         return networkAdapterTypes.value (t);
     749        AssertMsg (!mNetworkAdapterTypes.value (t).isNull(), ("No text for %d", t));
     750        return mNetworkAdapterTypes.value (t);
    739751    }
    740752
    741753    KNetworkAdapterType toNetworkAdapterType (const QString &s) const
    742754    {
    743         QStringVector::const_iterator it =
    744             qFind (networkAdapterTypes.begin(), networkAdapterTypes.end(), s);
    745         AssertMsg (it != networkAdapterTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    746         return KNetworkAdapterType (it - networkAdapterTypes.begin());
     755        QULongStringHash::const_iterator it =
     756            qFind (mNetworkAdapterTypes.begin(), mNetworkAdapterTypes.end(), s);
     757        AssertMsg (it != mNetworkAdapterTypes.end(), ("No value for {%s}",
     758                                                      s.toLatin1().constData()));
     759        return KNetworkAdapterType (it.key());
    747760    }
    748761
    749762    QString toString (KNetworkAttachmentType t) const
    750763    {
    751         AssertMsg (!networkAttachmentTypes.value (t).isNull(), ("No text for %d", t));
    752         return networkAttachmentTypes.value (t);
     764        AssertMsg (!mNetworkAttachmentTypes.value (t).isNull(), ("No text for %d", t));
     765        return mNetworkAttachmentTypes.value (t);
    753766    }
    754767
    755768    KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
    756769    {
    757         QStringVector::const_iterator it =
    758             qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
    759         AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
    760         return KNetworkAttachmentType (it - networkAttachmentTypes.begin());
     770        QULongStringHash::const_iterator it =
     771            qFind (mNetworkAttachmentTypes.begin(), mNetworkAttachmentTypes.end(), s);
     772        AssertMsg (it != mNetworkAttachmentTypes.end(), ("No value for {%s}",
     773                                                         s.toLatin1().constData()));
     774        return KNetworkAttachmentType (it.key());
    761775    }
    762776
    763777    QString toString (KUSBDeviceState aState) const
    764778    {
    765         AssertMsg (!USBDeviceStates.value (aState).isNull(), ("No text for %d", aState));
    766         return USBDeviceStates.value (aState);
     779        AssertMsg (!mUSBDeviceStates.value (aState).isNull(), ("No text for %d", aState));
     780        return mUSBDeviceStates.value (aState);
    767781    }
    768782
     
    10631077    CVirtualBoxCallback callback;
    10641078
    1065     typedef QVector <QString> QStringVector;
    1066 
    1067     QString verString;
     1079    QString mVerString;
    10681080
    10691081    QList <QString> mFamilyIDs;
    10701082    QList <QList <CGuestOSType> > mTypes;
    10711083    QHash <QString, QPixmap *> mOsTypeIcons;
    1072     QVector <QColor *> vm_state_color;
    1073 
    1074     QHash <long int, QPixmap *> mStateIcons;
     1084
     1085    QHash <ulong, QPixmap *> mVMStateIcons;
     1086    QHash <ulong, QColor *> mVMStateColors;
     1087
    10751088    QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
    10761089
    1077     QStringVector machineStates;
    1078     QStringVector sessionStates;
    1079     QStringVector deviceTypes;
    1080 
    1081     QStringVector storageBuses;
    1082     QStringVector storageBusDevices;
    1083     QStringVector storageBusChannels;
    1084 
    1085     QStringVector diskTypes;
    1086     QString diskTypes_Differencing;
    1087 
    1088     QStringVector vrdpAuthTypes;
    1089     QStringVector portModeTypes;
    1090     QStringVector usbFilterActionTypes;
    1091     QStringVector audioDriverTypes;
    1092     QStringVector audioControllerTypes;
    1093     QStringVector networkAdapterTypes;
    1094     QStringVector networkAttachmentTypes;
    1095     QStringVector clipboardTypes;
    1096     QStringVector ideControllerTypes;
    1097     QStringVector USBDeviceStates;
     1090    QULongStringHash mMachineStates;
     1091    QULongStringHash mSessionStates;
     1092    QULongStringHash mDeviceTypes;
     1093
     1094    QULongStringHash mStorageBuses;
     1095    QLongStringHash mStorageBusChannels;
     1096    QLongStringHash mStorageBusDevices;
     1097
     1098    QULongStringHash mDiskTypes;
     1099    QString mDiskTypes_Differencing;
     1100
     1101    QULongStringHash mVRDPAuthTypes;
     1102    QULongStringHash mPortModeTypes;
     1103    QULongStringHash mUSBFilterActionTypes;
     1104    QULongStringHash mAudioDriverTypes;
     1105    QULongStringHash mAudioControllerTypes;
     1106    QULongStringHash mNetworkAdapterTypes;
     1107    QULongStringHash mNetworkAttachmentTypes;
     1108    QULongStringHash mClipboardTypes;
     1109    QULongStringHash mIDEControllerTypes;
     1110    QULongStringHash mUSBDeviceStates;
    10981111
    10991112    QString mUserDefinedPortName;
     
    11011114    QPixmap mWarningIcon, mErrorIcon;
    11021115
    1103     mutable bool detailReportTemplatesReady;
     1116    mutable bool mDetailReportTemplatesReady;
    11041117
    11051118    friend VBoxGlobal &vboxGlobal();
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r15185 r15304  
    12531253#endif
    12541254    , mMediaEnumThread (NULL)
    1255     , verString ("1.0")
    1256     , vm_state_color (KMachineState_COUNT)
    1257     , machineStates (KMachineState_COUNT)
    1258     , sessionStates (KSessionState_COUNT)
    1259     , deviceTypes (KDeviceType_COUNT)
    1260     , storageBuses (KStorageBus_COUNT)
    1261     , storageBusDevices (2)
    1262     , storageBusChannels (3)
    1263     , diskTypes (KHardDiskType_COUNT)
    1264     , vrdpAuthTypes (KVRDPAuthType_COUNT)
    1265     , portModeTypes (KPortMode_COUNT)
    1266     , usbFilterActionTypes (KUSBDeviceFilterAction_COUNT)
    1267     , audioDriverTypes (KAudioDriverType_COUNT)
    1268     , audioControllerTypes (KAudioControllerType_COUNT)
    1269     , networkAdapterTypes (KNetworkAdapterType_COUNT)
    1270     , networkAttachmentTypes (KNetworkAttachmentType_COUNT)
    1271     , clipboardTypes (KClipboardMode_COUNT)
    1272     , ideControllerTypes (KIDEControllerType_COUNT)
    1273     , USBDeviceStates (KUSBDeviceState_COUNT)
    1274     , detailReportTemplatesReady (false)
     1255    , mVerString ("1.0")
     1256    , mDetailReportTemplatesReady (false)
    12751257{
    12761258}
     
    13311313{
    13321314    qDeleteAll (mOsTypeIcons);
    1333     qDeleteAll (mStateIcons);
    1334     qDeleteAll (vm_state_color);
     1315    qDeleteAll (mVMStateIcons);
     1316    qDeleteAll (mVMStateColors);
    13351317}
    13361318
     
    16201602QString VBoxGlobal::toString (KStorageBus aBus, LONG aChannel) const
    16211603{
    1622     Assert (storageBusChannels.count() == 3);
    16231604    QString channel;
    16241605
     
    16291610            if (aChannel == 0 || aChannel == 1)
    16301611            {
    1631                 channel = storageBusChannels [aChannel];
     1612                channel = mStorageBusChannels [aChannel];
    16321613                break;
    16331614            }
     
    16371618        case KStorageBus_SATA:
    16381619        {
    1639             channel = storageBusChannels [2].arg (aChannel);
     1620            channel = mStorageBusChannels [2].arg (aChannel);
    16401621            break;
    16411622        }
     
    16441625    }
    16451626
     1627    Assert (!channel.isNull());
    16461628    return channel;
    16471629}
     
    16591641        case KStorageBus_IDE:
    16601642        {
    1661             QStringVector::const_iterator it =
    1662                 qFind (storageBusChannels.begin(), storageBusChannels.end(),
     1643            QLongStringHash::const_iterator it =
     1644                qFind (mStorageBusChannels.begin(), mStorageBusChannels.end(),
    16631645                       aChannel);
    1664             AssertMsgBreak (it != storageBusChannels.end(),
     1646            AssertMsgBreak (it != mStorageBusChannels.end(),
    16651647                            ("No value for {%s}\n", aChannel.toLatin1().constData()));
    1666             channel = (LONG) (it - storageBusChannels.begin());
     1648            channel = it.key();
    16671649            break;
    16681650        }
     
    16701652        {
    16711653            /// @todo use regexp to properly extract the %1 text
    1672             QString tpl = storageBusChannels [2].arg ("");
     1654            QString tpl = mStorageBusChannels [2].arg ("");
    16731655            if (aChannel.startsWith (tpl))
    16741656            {
     
    16961678    NOREF (aChannel);
    16971679
    1698     Assert (storageBusDevices.count() == 2);
    16991680    QString device;
    17001681
     
    17051686            if (aDevice == 0 || aDevice == 1)
    17061687            {
    1707                 device = storageBusDevices [aDevice];
     1688                device = mStorageBusDevices [aDevice];
    17081689                break;
    17091690            }
     
    17211702    }
    17221703
     1704    Assert (!device.isNull());
    17231705    return device;
    17241706}
     
    17401722        case KStorageBus_IDE:
    17411723        {
    1742             QStringVector::const_iterator it =
    1743                 qFind (storageBusDevices.begin(), storageBusDevices.end(),
     1724            QLongStringHash::const_iterator it =
     1725                qFind (mStorageBusDevices.begin(), mStorageBusDevices.end(),
    17441726                       aDevice);
    1745             AssertMsg (it != storageBusDevices.end(),
     1727            AssertMsg (it != mStorageBusDevices.end(),
    17461728                       ("No value for {%s}", aDevice.toLatin1().constData()));
    1747             device = (LONG) (it - storageBusDevices.begin());
     1729            device = it.key();
    17481730            break;
    17491731        }
     
    17971779
    17981780/**
    1799  *  Returns the list of all device types (VirtualBox::DeviceType COM enum).
     1781 * Returns the list of all device types (VirtualBox::DeviceType COM enum).
    18001782 */
    18011783QStringList VBoxGlobal::deviceTypeStrings() const
     
    18031785    static QStringList list;
    18041786    if (list.empty())
    1805         for (int i = 0; i < deviceTypes.count() - 1 /* usb=n/a */; i++)
    1806             list += deviceTypes [i];
     1787        for (QULongStringHash::const_iterator it = mDeviceTypes.begin();
     1788             it != mDeviceTypes.end(); ++ it)
     1789            list += it.value();
    18071790    return list;
    18081791}
     
    18151798};
    18161799
    1817 static const PortConfig comKnownPorts[] =
     1800static const PortConfig kComKnownPorts[] =
    18181801{
    18191802    { "COM1", 4, 0x3F8 },
     
    18251808};
    18261809
    1827 static const PortConfig lptKnownPorts[] =
     1810static const PortConfig kLptKnownPorts[] =
    18281811{
    18291812    { "LPT1", 7, 0x3BC },
     
    18401823{
    18411824    QStringList list;
    1842     for (size_t i = 0; i < RT_ELEMENTS (comKnownPorts); ++ i)
    1843         list << comKnownPorts [i].name;
     1825    for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i)
     1826        list << kComKnownPorts [i].name;
    18441827
    18451828    return list;
     
    18521835{
    18531836    QStringList list;
    1854     for (size_t i = 0; i < RT_ELEMENTS (lptKnownPorts); ++ i)
    1855         list << lptKnownPorts [i].name;
     1837    for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i)
     1838        list << kLptKnownPorts [i].name;
    18561839
    18571840    return list;
     
    18651848QString VBoxGlobal::toCOMPortName (ulong aIRQ, ulong aIOBase) const
    18661849{
    1867     for (size_t i = 0; i < RT_ELEMENTS (comKnownPorts); ++ i)
    1868         if (comKnownPorts [i].IRQ == aIRQ &&
    1869             comKnownPorts [i].IOBase == aIOBase)
    1870             return comKnownPorts [i].name;
     1850    for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i)
     1851        if (kComKnownPorts [i].IRQ == aIRQ &&
     1852            kComKnownPorts [i].IOBase == aIOBase)
     1853            return kComKnownPorts [i].name;
    18711854
    18721855    return mUserDefinedPortName;
     
    18801863QString VBoxGlobal::toLPTPortName (ulong aIRQ, ulong aIOBase) const
    18811864{
    1882     for (size_t i = 0; i < RT_ELEMENTS (lptKnownPorts); ++ i)
    1883         if (lptKnownPorts [i].IRQ == aIRQ &&
    1884             lptKnownPorts [i].IOBase == aIOBase)
    1885             return lptKnownPorts [i].name;
     1865    for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i)
     1866        if (kLptKnownPorts [i].IRQ == aIRQ &&
     1867            kLptKnownPorts [i].IOBase == aIOBase)
     1868            return kLptKnownPorts [i].name;
    18861869
    18871870    return mUserDefinedPortName;
     
    18961879                                   ulong &aIOBase) const
    18971880{
    1898     for (size_t i = 0; i < RT_ELEMENTS (comKnownPorts); ++ i)
    1899         if (strcmp (comKnownPorts [i].name, aName.toUtf8().data()) == 0)
    1900         {
    1901             aIRQ = comKnownPorts [i].IRQ;
    1902             aIOBase = comKnownPorts [i].IOBase;
     1881    for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i)
     1882        if (strcmp (kComKnownPorts [i].name, aName.toUtf8().data()) == 0)
     1883        {
     1884            aIRQ = kComKnownPorts [i].IRQ;
     1885            aIOBase = kComKnownPorts [i].IOBase;
    19031886            return true;
    19041887        }
     
    19151898                                   ulong &aIOBase) const
    19161899{
    1917     for (size_t i = 0; i < RT_ELEMENTS (lptKnownPorts); ++ i)
    1918         if (strcmp (lptKnownPorts [i].name, aName.toUtf8().data()) == 0)
    1919         {
    1920             aIRQ = lptKnownPorts [i].IRQ;
    1921             aIOBase = lptKnownPorts [i].IOBase;
     1900    for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i)
     1901        if (strcmp (kLptKnownPorts [i].name, aName.toUtf8().data()) == 0)
     1902        {
     1903            aIRQ = kLptKnownPorts [i].IRQ;
     1904            aIOBase = kLptKnownPorts [i].IOBase;
    19221905            return true;
    19231906        }
     
    21052088    /* generate templates after every language change */
    21062089
    2107     if (!detailReportTemplatesReady)
    2108     {
    2109         detailReportTemplatesReady = true;
     2090    if (!mDetailReportTemplatesReady)
     2091    {
     2092        mDetailReportTemplatesReady = true;
    21102093
    21112094        QString generalItems
     
    33053288void VBoxGlobal::retranslateUi()
    33063289{
    3307     machineStates [KMachineState_PoweredOff] =  tr ("Powered Off", "MachineState");
    3308     machineStates [KMachineState_Saved] =       tr ("Saved", "MachineState");
    3309     machineStates [KMachineState_Aborted] =     tr ("Aborted", "MachineState");
    3310     machineStates [KMachineState_Running] =     tr ("Running", "MachineState");
    3311     machineStates [KMachineState_Paused] =      tr ("Paused", "MachineState");
    3312     machineStates [KMachineState_Stuck] =       tr ("Stuck", "MachineState");
    3313     machineStates [KMachineState_Starting] =    tr ("Starting", "MachineState");
    3314     machineStates [KMachineState_Stopping] =    tr ("Stopping", "MachineState");
    3315     machineStates [KMachineState_Saving] =      tr ("Saving", "MachineState");
    3316     machineStates [KMachineState_Restoring] =   tr ("Restoring", "MachineState");
    3317     machineStates [KMachineState_Discarding] =  tr ("Discarding", "MachineState");
    3318     machineStates [KMachineState_SettingUp] =   tr ("Setting Up", "MachineState");
    3319 
    3320     sessionStates [KSessionState_Closed] =      tr ("Closed", "SessionState");
    3321     sessionStates [KSessionState_Open] =        tr ("Open", "SessionState");
    3322     sessionStates [KSessionState_Spawning] =    tr ("Spawning", "SessionState");
    3323     sessionStates [KSessionState_Closing] =     tr ("Closing", "SessionState");
    3324 
    3325     deviceTypes [KDeviceType_Null] =            tr ("None", "DeviceType");
    3326     deviceTypes [KDeviceType_Floppy] =          tr ("Floppy", "DeviceType");
    3327     deviceTypes [KDeviceType_DVD] =             tr ("CD/DVD-ROM", "DeviceType");
    3328     deviceTypes [KDeviceType_HardDisk] =        tr ("Hard Disk", "DeviceType");
    3329     deviceTypes [KDeviceType_Network] =         tr ("Network", "DeviceType");
    3330     deviceTypes [KDeviceType_USB] =             tr ("USB", "DeviceType");
    3331     deviceTypes [KDeviceType_SharedFolder] =    tr ("Shared Folder", "DeviceType");
    3332 
    3333     storageBuses [KStorageBus_IDE] =
    3334         tr ("IDE", "StorageBus");
    3335     storageBuses [KStorageBus_SATA] =
    3336         tr ("SATA", "StorageBus");
    3337 
    3338     Assert (storageBusChannels.count() == 3);
    3339     storageBusChannels [0] =
    3340         tr ("Primary", "StorageBusChannel");
    3341     storageBusChannels [1] =
    3342         tr ("Secondary", "StorageBusChannel");
    3343     storageBusChannels [2] =
    3344         tr ("Port %1", "StorageBusChannel");
    3345 
    3346     Assert (storageBusDevices.count() == 2);
    3347     storageBusDevices [0] = tr ("Master", "StorageBusDevice");
    3348     storageBusDevices [1] = tr ("Slave", "StorageBusDevice");
    3349 
    3350     diskTypes [KHardDiskType_Normal] =
    3351         tr ("Normal", "DiskType");
    3352     diskTypes [KHardDiskType_Immutable] =
    3353         tr ("Immutable", "DiskType");
    3354     diskTypes [KHardDiskType_Writethrough] =
    3355         tr ("Writethrough", "DiskType");
    3356     diskTypes_Differencing =
    3357         tr ("Differencing", "DiskType");
    3358 
    3359     vrdpAuthTypes [KVRDPAuthType_Null] =
    3360         tr ("Null", "VRDPAuthType");
    3361     vrdpAuthTypes [KVRDPAuthType_External] =
    3362         tr ("External", "VRDPAuthType");
    3363     vrdpAuthTypes [KVRDPAuthType_Guest] =
    3364         tr ("Guest", "VRDPAuthType");
    3365 
    3366     portModeTypes [KPortMode_Disconnected] =
    3367         tr ("Disconnected", "PortMode");
    3368     portModeTypes [KPortMode_HostPipe] =
    3369         tr ("Host Pipe", "PortMode");
    3370     portModeTypes [KPortMode_HostDevice] =
    3371         tr ("Host Device", "PortMode");
    3372 
    3373     usbFilterActionTypes [KUSBDeviceFilterAction_Ignore] =
     3290    mMachineStates [KMachineState_PoweredOff] = tr ("Powered Off", "MachineState");
     3291    mMachineStates [KMachineState_Saved] =      tr ("Saved", "MachineState");
     3292    mMachineStates [KMachineState_Aborted] =    tr ("Aborted", "MachineState");
     3293    mMachineStates [KMachineState_Running] =    tr ("Running", "MachineState");
     3294    mMachineStates [KMachineState_Paused] =     tr ("Paused", "MachineState");
     3295    mMachineStates [KMachineState_Stuck] =      tr ("Stuck", "MachineState");
     3296    mMachineStates [KMachineState_Starting] =   tr ("Starting", "MachineState");
     3297    mMachineStates [KMachineState_Stopping] =   tr ("Stopping", "MachineState");
     3298    mMachineStates [KMachineState_Saving] =     tr ("Saving", "MachineState");
     3299    mMachineStates [KMachineState_Restoring] =  tr ("Restoring", "MachineState");
     3300    mMachineStates [KMachineState_Discarding] = tr ("Discarding", "MachineState");
     3301    mMachineStates [KMachineState_SettingUp] =  tr ("Setting Up", "MachineState");
     3302
     3303    mSessionStates [KSessionState_Closed] =     tr ("Closed", "SessionState");
     3304    mSessionStates [KSessionState_Open] =       tr ("Open", "SessionState");
     3305    mSessionStates [KSessionState_Spawning] =   tr ("Spawning", "SessionState");
     3306    mSessionStates [KSessionState_Closing] =    tr ("Closing", "SessionState");
     3307
     3308    mDeviceTypes [KDeviceType_Null] =           tr ("None", "DeviceType");
     3309    mDeviceTypes [KDeviceType_Floppy] =         tr ("Floppy", "DeviceType");
     3310    mDeviceTypes [KDeviceType_DVD] =            tr ("CD/DVD-ROM", "DeviceType");
     3311    mDeviceTypes [KDeviceType_HardDisk] =       tr ("Hard Disk", "DeviceType");
     3312    mDeviceTypes [KDeviceType_Network] =        tr ("Network", "DeviceType");
     3313    mDeviceTypes [KDeviceType_USB] =            tr ("USB", "DeviceType");
     3314    mDeviceTypes [KDeviceType_SharedFolder] =   tr ("Shared Folder", "DeviceType");
     3315
     3316    mStorageBuses [KStorageBus_IDE] =   tr ("IDE", "StorageBus");
     3317    mStorageBuses [KStorageBus_SATA] =  tr ("SATA", "StorageBus");
     3318
     3319    mStorageBusChannels [0] =   tr ("Primary", "StorageBusChannel");
     3320    mStorageBusChannels [1] =   tr ("Secondary", "StorageBusChannel");
     3321    mStorageBusChannels [2] =   tr ("Port %1", "StorageBusChannel");
     3322
     3323    mStorageBusDevices [0] =    tr ("Master", "StorageBusDevice");
     3324    mStorageBusDevices [1] =    tr ("Slave", "StorageBusDevice");
     3325
     3326    mDiskTypes [KHardDiskType_Normal] =         tr ("Normal", "DiskType");
     3327    mDiskTypes [KHardDiskType_Immutable] =      tr ("Immutable", "DiskType");
     3328    mDiskTypes [KHardDiskType_Writethrough] =   tr ("Writethrough", "DiskType");
     3329    mDiskTypes_Differencing =                   tr ("Differencing", "DiskType");
     3330
     3331    mVRDPAuthTypes [KVRDPAuthType_Null] =       tr ("Null", "VRDPAuthType");
     3332    mVRDPAuthTypes [KVRDPAuthType_External] =   tr ("External", "VRDPAuthType");
     3333    mVRDPAuthTypes [KVRDPAuthType_Guest] =      tr ("Guest", "VRDPAuthType");
     3334
     3335    mPortModeTypes [KPortMode_Disconnected] =   tr ("Disconnected", "PortMode");
     3336    mPortModeTypes [KPortMode_HostPipe] =       tr ("Host Pipe", "PortMode");
     3337    mPortModeTypes [KPortMode_HostDevice] =     tr ("Host Device", "PortMode");
     3338
     3339    mUSBFilterActionTypes [KUSBDeviceFilterAction_Ignore] =
    33743340        tr ("Ignore", "USBFilterActionType");
    3375     usbFilterActionTypes [KUSBDeviceFilterAction_Hold] =
     3341    mUSBFilterActionTypes [KUSBDeviceFilterAction_Hold] =
    33763342        tr ("Hold", "USBFilterActionType");
    33773343
    3378     audioDriverTypes [KAudioDriverType_Null] =
     3344    mAudioDriverTypes [KAudioDriverType_Null] =
    33793345        tr ("Null Audio Driver", "AudioDriverType");
    3380     audioDriverTypes [KAudioDriverType_WinMM] =
     3346    mAudioDriverTypes [KAudioDriverType_WinMM] =
    33813347        tr ("Windows Multimedia", "AudioDriverType");
    3382     audioDriverTypes [KAudioDriverType_SolAudio] =
     3348    mAudioDriverTypes [KAudioDriverType_SolAudio] =
    33833349        tr ("Solaris Audio", "AudioDriverType");
    3384     audioDriverTypes [KAudioDriverType_OSS] =
     3350    mAudioDriverTypes [KAudioDriverType_OSS] =
    33853351        tr ("OSS Audio Driver", "AudioDriverType");
    3386     audioDriverTypes [KAudioDriverType_ALSA] =
     3352    mAudioDriverTypes [KAudioDriverType_ALSA] =
    33873353        tr ("ALSA Audio Driver", "AudioDriverType");
    3388     audioDriverTypes [KAudioDriverType_DirectSound] =
     3354    mAudioDriverTypes [KAudioDriverType_DirectSound] =
    33893355        tr ("Windows DirectSound", "AudioDriverType");
    3390     audioDriverTypes [KAudioDriverType_CoreAudio] =
     3356    mAudioDriverTypes [KAudioDriverType_CoreAudio] =
    33913357        tr ("CoreAudio", "AudioDriverType");
    3392     audioDriverTypes [KAudioDriverType_Pulse] =
     3358    mAudioDriverTypes [KAudioDriverType_Pulse] =
    33933359        tr ("PulseAudio", "AudioDriverType");
    33943360
    3395     audioControllerTypes [KAudioControllerType_AC97] =
     3361    mAudioControllerTypes [KAudioControllerType_AC97] =
    33963362        tr ("ICH AC97", "AudioControllerType");
    3397     audioControllerTypes [KAudioControllerType_SB16] =
     3363    mAudioControllerTypes [KAudioControllerType_SB16] =
    33983364        tr ("SoundBlaster 16", "AudioControllerType");
    33993365
    3400     networkAdapterTypes [KNetworkAdapterType_Am79C970A] =
     3366    mNetworkAdapterTypes [KNetworkAdapterType_Am79C970A] =
    34013367        tr ("PCnet-PCI II (Am79C970A)", "NetworkAdapterType");
    3402     networkAdapterTypes [KNetworkAdapterType_Am79C973] =
     3368    mNetworkAdapterTypes [KNetworkAdapterType_Am79C973] =
    34033369        tr ("PCnet-FAST III (Am79C973)", "NetworkAdapterType");
    3404     networkAdapterTypes [KNetworkAdapterType_I82540EM] =
     3370    mNetworkAdapterTypes [KNetworkAdapterType_I82540EM] =
    34053371        tr ("Intel PRO/1000 MT Desktop (82540EM)", "NetworkAdapterType");
    3406     networkAdapterTypes [KNetworkAdapterType_I82543GC] =
     3372    mNetworkAdapterTypes [KNetworkAdapterType_I82543GC] =
    34073373        tr ("Intel PRO/1000 T Server (82543GC)", "NetworkAdapterType");
    34083374
    3409     networkAttachmentTypes [KNetworkAttachmentType_Null] =
     3375    mNetworkAttachmentTypes [KNetworkAttachmentType_Null] =
    34103376        tr ("Not attached", "NetworkAttachmentType");
    3411     networkAttachmentTypes [KNetworkAttachmentType_NAT] =
     3377    mNetworkAttachmentTypes [KNetworkAttachmentType_NAT] =
    34123378        tr ("NAT", "NetworkAttachmentType");
    3413     networkAttachmentTypes [KNetworkAttachmentType_HostInterface] =
     3379    mNetworkAttachmentTypes [KNetworkAttachmentType_HostInterface] =
    34143380        tr ("Host Interface", "NetworkAttachmentType");
    3415     networkAttachmentTypes [KNetworkAttachmentType_Internal] =
     3381    mNetworkAttachmentTypes [KNetworkAttachmentType_Internal] =
    34163382        tr ("Internal Network", "NetworkAttachmentType");
    34173383
    3418     clipboardTypes [KClipboardMode_Disabled] =
     3384    mClipboardTypes [KClipboardMode_Disabled] =
    34193385        tr ("Disabled", "ClipboardType");
    3420     clipboardTypes [KClipboardMode_HostToGuest] =
     3386    mClipboardTypes [KClipboardMode_HostToGuest] =
    34213387        tr ("Host To Guest", "ClipboardType");
    3422     clipboardTypes [KClipboardMode_GuestToHost] =
     3388    mClipboardTypes [KClipboardMode_GuestToHost] =
    34233389        tr ("Guest To Host", "ClipboardType");
    3424     clipboardTypes [KClipboardMode_Bidirectional] =
     3390    mClipboardTypes [KClipboardMode_Bidirectional] =
    34253391        tr ("Bidirectional", "ClipboardType");
    34263392
    3427     ideControllerTypes [KIDEControllerType_PIIX3] =
     3393    mIDEControllerTypes [KIDEControllerType_PIIX3] =
    34283394        tr ("PIIX3", "IDEControllerType");
    3429     ideControllerTypes [KIDEControllerType_PIIX4] =
     3395    mIDEControllerTypes [KIDEControllerType_PIIX4] =
    34303396        tr ("PIIX4", "IDEControllerType");
    34313397
    3432     USBDeviceStates [KUSBDeviceState_NotSupported] =
     3398    mUSBDeviceStates [KUSBDeviceState_NotSupported] =
    34333399        tr ("Not supported", "USBDeviceState");
    3434     USBDeviceStates [KUSBDeviceState_Unavailable] =
     3400    mUSBDeviceStates [KUSBDeviceState_Unavailable] =
    34353401        tr ("Unavailable", "USBDeviceState");
    3436     USBDeviceStates [KUSBDeviceState_Busy] =
     3402    mUSBDeviceStates [KUSBDeviceState_Busy] =
    34373403        tr ("Busy", "USBDeviceState");
    3438     USBDeviceStates [KUSBDeviceState_Available] =
     3404    mUSBDeviceStates [KUSBDeviceState_Available] =
    34393405        tr ("Available", "USBDeviceState");
    3440     USBDeviceStates [KUSBDeviceState_Held] =
     3406    mUSBDeviceStates [KUSBDeviceState_Held] =
    34413407        tr ("Held", "USBDeviceState");
    3442     USBDeviceStates [KUSBDeviceState_Captured] =
     3408    mUSBDeviceStates [KUSBDeviceState_Captured] =
    34433409        tr ("Captured", "USBDeviceState");
    34443410
     
    34513417    Assert (!mErrorIcon.isNull());
    34523418
    3453     detailReportTemplatesReady = false;
     3419    mDetailReportTemplatesReady = false;
    34543420
    34553421#if defined (Q_WS_PM) || defined (Q_WS_X11)
     
    53085274{
    53095275#ifdef DEBUG
    5310     verString += " [DEBUG]";
     5276    mVerString += " [DEBUG]";
    53115277#endif
    53125278
     
    54425408    }
    54435409
    5444     /* fill in VM state icon dictionary */
    5445     static struct
     5410    /* fill in VM state icon map */
     5411    static const struct
    54465412    {
    54475413        KMachineState state;
    54485414        const char *name;
    54495415    }
    5450     vmStateIcons[] =
     5416    kVMStateIcons[] =
    54515417    {
    54525418        {KMachineState_Null, NULL},
     
    54645430        {KMachineState_SettingUp, ":/settings_16px.png"},
    54655431    };
    5466     for (uint n = 0; n < SIZEOF_ARRAY (vmStateIcons); n ++)
    5467     {
    5468         mStateIcons.insert (vmStateIcons [n].state,
    5469             new QPixmap (vmStateIcons [n].name));
    5470     }
     5432    for (uint n = 0; n < SIZEOF_ARRAY (kVMStateIcons); n ++)
     5433    {
     5434        mVMStateIcons.insert (kVMStateIcons [n].state,
     5435            new QPixmap (kVMStateIcons [n].name));
     5436    }
     5437
     5438    /* initialize state colors map */
     5439    mVMStateColors.insert (KMachineState_Null,          new QColor (Qt::red));
     5440    mVMStateColors.insert (KMachineState_PoweredOff,    new QColor (Qt::gray));
     5441    mVMStateColors.insert (KMachineState_Saved,         new QColor (Qt::yellow));
     5442    mVMStateColors.insert (KMachineState_Aborted,       new QColor (Qt::darkRed));
     5443    mVMStateColors.insert (KMachineState_Running,       new QColor (Qt::green));
     5444    mVMStateColors.insert (KMachineState_Paused,        new QColor (Qt::darkGreen));
     5445    mVMStateColors.insert (KMachineState_Stuck,         new QColor (Qt::darkMagenta));
     5446    mVMStateColors.insert (KMachineState_Starting,      new QColor (Qt::green));
     5447    mVMStateColors.insert (KMachineState_Stopping,      new QColor (Qt::green));
     5448    mVMStateColors.insert (KMachineState_Saving,        new QColor (Qt::green));
     5449    mVMStateColors.insert (KMachineState_Restoring,     new QColor (Qt::green));
     5450    mVMStateColors.insert (KMachineState_Discarding,    new QColor (Qt::green));
     5451    mVMStateColors.insert (KMachineState_SettingUp,     new QColor (Qt::green));
    54715452
    54725453    /* online/offline snapshot icons */
    54735454    mOfflineSnapshotIcon = QPixmap (":/offline_snapshot_16px.png");
    54745455    mOnlineSnapshotIcon = QPixmap (":/online_snapshot_16px.png");
    5475 
    5476     /* initialize state colors vector */
    5477     vm_state_color.insert (KMachineState_Null,           new QColor(Qt::red));
    5478     vm_state_color.insert (KMachineState_PoweredOff,     new QColor(Qt::gray));
    5479     vm_state_color.insert (KMachineState_Saved,          new QColor(Qt::yellow));
    5480     vm_state_color.insert (KMachineState_Aborted,        new QColor(Qt::darkRed));
    5481     vm_state_color.insert (KMachineState_Running,        new QColor(Qt::green));
    5482     vm_state_color.insert (KMachineState_Paused,         new QColor(Qt::darkGreen));
    5483     vm_state_color.insert (KMachineState_Stuck,          new QColor(Qt::darkMagenta));
    5484     vm_state_color.insert (KMachineState_Starting,       new QColor(Qt::green));
    5485     vm_state_color.insert (KMachineState_Stopping,       new QColor(Qt::green));
    5486     vm_state_color.insert (KMachineState_Saving,         new QColor(Qt::green));
    5487     vm_state_color.insert (KMachineState_Restoring,      new QColor(Qt::green));
    5488     vm_state_color.insert (KMachineState_Discarding,     new QColor(Qt::green));
    5489     vm_state_color.insert (KMachineState_SettingUp,      new QColor(Qt::green));
    54905456
    54915457    qApp->installEventFilter (this);
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