VirtualBox

Ignore:
Timestamp:
Jun 18, 2007 3:05:33 PM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Slightly improved r22048.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r2981 r3144  
    433433    static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
    434434
     435    static QString removeAccelMark (const QString &aText);
     436
    435437signals:
    436438
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r3136 r3144  
    29522952}
    29532953
     2954/**
     2955 *  Removes the acceletartor mark (the ampersand symbol) from the given string
     2956 *  and returns the result. The string is supposed to be a menu item's text
     2957 *  that may (or may not) contain the accelerator mark.
     2958 *
     2959 *  In order to support accelerators used in non-alphabet languages
     2960 *  (e.g. Japanese) that has a form of "(&<L>)" (where <L> is a latin letter),
     2961 *  this method first searches for this pattern and, if found, removes it as a
     2962 *  whole. If such a pattern is not found, then the '&' character is simply
     2963 *  removed from the string.
     2964 *
     2965 *  @note This function removes only the first occurense of the accelerator
     2966 *  mark.
     2967 *
     2968 *  @param aText Menu item's text to remove the acceletaror mark from.
     2969 *
     2970 *  @return The resulting string.
     2971 */
     2972/* static */
     2973QString VBoxGlobal::removeAccelMark (const QString &aText)
     2974{
     2975    QString result = aText;
     2976
     2977    QRegExp accel ("\\(&[a-zA-Z]\\)");
     2978    int pos = accel.search (result);
     2979    if (pos >= 0)
     2980        result.remove (pos, accel.cap().length());
     2981    else
     2982    {
     2983        pos = result.find ('&');
     2984        if (pos >= 0)
     2985            result.remove (pos, 1);
     2986    }
     2987
     2988    return result;
     2989}
     2990
    29542991// Protected members
    29552992////////////////////////////////////////////////////////////////////////////////
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui.h

    r3143 r3144  
    391391        QString type = rbDynamicType->isOn() ? rbDynamicType->text()
    392392                                             : rbFixedType->text();
    393         type.remove (QRegExp( "\\(&\\w\\)" ));
    394         type.remove ('&');
     393        type = VBoxGlobal::removeAccelMark (type);
    395394
    396395        Q_UINT64 sizeB = imageSize() * _1M;
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