Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/activeqt/container/qaxbase.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the ActiveQt framework of the Qt Toolkit.
     
    4041//#define QAX_NO_CLASSINFO
    4142
    42 #ifndef UNICODE
    43 #define UNICODE
    44 #endif
    45 
    4643#define QT_CHECK_STATE
    4744
     
    175172        // get the Dispatch ID from the object
    176173        QString unicodeName = QLatin1String(name);
    177         OLECHAR *names = (TCHAR*)unicodeName.utf16();
     174        OLECHAR *names = (wchar_t*)unicodeName.utf16();
    178175        disp->GetIDsOfNames(IID_NULL, &names, 1, LOCALE_USER_DEFAULT, &dispid);
    179176        if (dispid != DISPID_UNKNOWN)
     
    422419                    } else {
    423420                        argv[p + 1] = const_cast<void*>(varp[p + 1].constData());
    424                         if (ptype.endsWith("*")) {
     421                        if (ptype.endsWith('*')) {
    425422                            argv_pointer[p + 1] = argv[p + 1];
    426423                            argv[p + 1] = argv_pointer + p + 1;
     
    639636    typeinfo->GetNames(dispID, &names, 1, &cNames);
    640637    if (cNames) {
    641         propname = QString::fromUtf16((const ushort *)names).toLatin1();
     638        propname = QString::fromWCharArray(names).toLatin1();
    642639        SysFreeString(names);
    643640    }
     
    649646    const QMetaProperty prop = mo->property(index);
    650647    propsignal += prop.typeName();
    651     propsignal += ")";
     648    propsignal += ')';
    652649    addProperty(dispID, propname, propsignal);
    653650
     
    913910    \brief the name of the COM object wrapped by this QAxBase object.
    914911
    915     Setting this property initilializes the COM object. Any COM object
     912    Setting this property initializes the COM object. Any COM object
    916913    previously set is shut down.
    917914
     
    973970        if (uuid.isNull()) {
    974971            CLSID clsid;
    975             HRESULT res = CLSIDFromProgID((WCHAR*)c.utf16(), &clsid);
     972            HRESULT res = CLSIDFromProgID((wchar_t*)c.utf16(), &clsid);
    976973            if (res == S_OK)
    977974                search = QUuid(clsid).toString();
     
    11381135                    if (!verb.lpszVerbName)
    11391136                        continue;
    1140                     QString verbName = QString::fromUtf16((const ushort *)verb.lpszVerbName);
     1137                    QString verbName = QString::fromWCharArray(verb.lpszVerbName);
    11411138                    if (!verbName.isEmpty())
    11421139                        d->verbs.insert(verbName, verb.lVerb);
     
    12661263                BSTR licenseKey;
    12671264                factory2->RequestLicKey(0, &licenseKey);
    1268                 QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey);
     1265                QString qlicenseKey = QString::fromWCharArray(licenseKey);
    12691266                SysFreeString(licenseKey);
    12701267                qWarning("Use license key is '%s' to create object on unlicensed machine.",
     
    12761273                BSTR licenseKey;
    12771274                factory2->RequestLicKey(0, &licenseKey);
    1278                 QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey);
     1275                QString qlicenseKey = QString::fromWCharArray(licenseKey);
    12791276                SysFreeString(licenseKey);
    12801277
     
    14361433    serverInfo.dwReserved2 = 0;
    14371434    serverInfo.pAuthInfo = &authInfo;
    1438     serverInfo.pwszName = (WCHAR*)server.utf16();
     1435    serverInfo.pwszName = (wchar_t*)server.utf16();
    14391436
    14401437    IClassFactory *factory = 0;
     
    16611658    void addProperty(const QByteArray &type, const QByteArray &name, uint flags)
    16621659    {
     1660        QByteArray propertyType(type);
     1661        if (propertyType.endsWith('&'))
     1662            propertyType.chop(1);
     1663
    16631664        Property &prop = property_list[name];
    1664         if (!type.isEmpty() && type != "HRESULT") {
    1665             prop.type = replaceType(type);
    1666             if (prop.type != type)
    1667                 prop.realType = type;
     1665        if (!propertyType.isEmpty() && propertyType != "HRESULT") {
     1666            prop.type = replaceType(propertyType);
     1667            if (prop.type != propertyType)
     1668                prop.realType = propertyType;
    16681669        }
    16691670        if (flags & Writable)
     
    17441745        return 0;
    17451746
    1746     className = QString::fromUtf16((const ushort *)bstr);
     1747    className = QString::fromWCharArray(bstr);
    17471748    SysFreeString(bstr);
    17481749
     
    17651766        return 0;
    17661767
    1767     className = QString::fromUtf16((const ushort *)bstr);
     1768    className = QString::fromWCharArray(bstr);
    17681769    SysFreeString(bstr);
    17691770
     
    17921793
    17931794            interfaceInfo->GetDocumentation(-1, &bstr, 0, 0, 0);
    1794             QString interfaceName = QString::fromUtf16((const ushort *)bstr);
     1795            QString interfaceName = QString::fromWCharArray(bstr);
    17951796            SysFreeString(bstr);
    17961797            QByteArray key;
     
    18401841        BSTR bstr;
    18411842        typelib->GetDocumentation(-1, &bstr, 0, 0, 0);
    1842         current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1();
     1843        current_typelib = QString::fromWCharArray(bstr).toLatin1();
    18431844        SysFreeString(bstr);
    18441845    }
     
    18881889            BSTR typelibname = 0;
    18891890            usertypelib->GetDocumentation(-1, &typelibname, 0, 0, 0);
    1890             QByteArray typeLibName = QString::fromUtf16((const ushort *)typelibname).toLatin1();
     1891            QByteArray typeLibName = QString::fromWCharArray(typelibname).toLatin1();
    18911892            SysFreeString(typelibname);
    18921893
     
    18941895            BSTR usertypename = 0;
    18951896            usertypelib->GetDocumentation(index, &usertypename, 0, 0, 0);
    1896             QByteArray userTypeName = QString::fromUtf16((const ushort *)usertypename).toLatin1();
     1897            QByteArray userTypeName = QString::fromWCharArray(usertypename).toLatin1();
    18971898            SysFreeString(usertypename);
    18981899
     
    20432044        case VT_UINT:
    20442045        case VT_CY:
    2045             str += "&";
     2046            str += '&';
    20462047            break;
    20472048        case VT_PTR:
    20482049            if (str == "QFont" || str == "QPixmap") {
    2049                 str += "&";
     2050                str += '&';
    20502051                break;
    20512052            } else if (str == "void*") {
     
    20562057        default:
    20572058            if (str == "QColor")
    2058                 str += "&";
     2059                str += '&';
    20592060            else if (str == "QDateTime")
    2060                 str += "&";
     2061                str += '&';
    20612062            else if (str == "QVariantList")
    2062                 str += "&";
     2063                str += '&';
    20632064            else if (str == "QByteArray")
    2064                 str += "&";
     2065                str += '&';
    20652066            else if (str == "QStringList")
    2066                 str += "&";
     2067                str += '&';
    20672068            else if (!str.isEmpty() && hasEnum(str))
    2068                 str += "&";
     2069                str += '&';
    20692070            else if (!str.isEmpty() && str != "QFont" && str != "QPixmap" && str != "QVariant")
    2070                 str += "*";
     2071                str += '*';
    20712072        }
    20722073        break;
     
    20862087            str = guessTypes(tdesc.lpadesc->tdescElem, info, function);
    20872088            if (!str.isEmpty())
    2088                 str = "QList<" + str + ">";
     2089                str = "QList<" + str + '>';
    20892090            break;
    20902091        }
     
    20942095        if (!str.isEmpty()) {
    20952096            for (int index = 0; index < tdesc.lpadesc->cDims; ++index)
    2096                 str += "[" + QByteArray::number((int)tdesc.lpadesc->rgbounds[index].cElements) + "]";
     2097                str += '[' + QByteArray::number((int)tdesc.lpadesc->rgbounds[index].cElements) + ']';
    20972098        }
    20982099        break;
     
    21112112
    21122113    if (tdesc.vt & VT_BYREF)
    2113         str += "&";
     2114        str += '&';
    21142115
    21152116    str.replace("&*", "**");
     
    21382139                QString coClassIDstr = iidnames.value(QLatin1String("/CLSID/") + coClassID + QLatin1String("/Default"), coClassID).toString();
    21392140                addClassInfo("CoClass", coClassIDstr.isEmpty() ? coClassID.toLatin1() : coClassIDstr.toLatin1());
    2140                 QByteArray version = QByteArray::number(typeattr->wMajorVerNum) + "." + QByteArray::number(typeattr->wMinorVerNum);
     2141                QByteArray version = QByteArray::number(typeattr->wMajorVerNum) + '.' + QByteArray::number(typeattr->wMinorVerNum);
    21412142                if (version != "0.0")
    21422143                    addClassInfo("Version", version);
     
    21712172                QString version = *vit;
    21722173                ++vit;
    2173                 tlfile = controls.value(QLatin1String("/") + version + QLatin1String("/0/win32/.")).toString();
     2174                tlfile = controls.value(QLatin1Char('/') + version + QLatin1String("/0/win32/.")).toString();
    21742175            }
    21752176            controls.endGroup();
     
    22842285            QByteArray enumName;
    22852286            if (typelib->GetDocumentation(i, &enumname, 0, 0, 0) == S_OK) {
    2286                 enumName = QString::fromUtf16((const ushort *)enumname).toLatin1();
     2287                enumName = QString::fromWCharArray(enumname).toLatin1();
    22872288                SysFreeString(enumname);
    22882289            } else {
     
    23072308                        enuminfo->GetNames(memid, &valuename, 1, &maxNamesOut);
    23082309                        if (maxNamesOut) {
    2309                             valueName = QString::fromUtf16((const ushort *)valuename).toLatin1();
     2310                            valueName = QString::fromWCharArray(valuename).toLatin1();
    23102311                            SysFreeString(valuename);
    23112312                        } else {
     
    23442345    QByteArray signalName(function);
    23452346    signalName += "Changed";
    2346     QByteArray signalProto = signalName + "(" + replaceType(type) + ")";
     2347    QByteArray signalProto = signalName + '(' + replaceType(type) + ')';
    23472348    if (!hasSignal(signalProto))
    23482349        addSignal(signalProto, function);
     
    23612362        prototype[0] = toupper(prototype[0]);
    23622363    }
    2363     prototype = set + prototype + "(" + propertyType(property) + ")";
     2364    prototype = set + prototype + '(' + propertyType(property) + ')';
    23642365    if (!hasSlot(prototype))
    23652366        addSlot(0, prototype, property);
     
    23782379    }
    23792380
    2380     prototype = function + "(";
     2381    prototype = function + '(';
    23812382    if (funcdesc->invkind == INVOKE_FUNC && type == hresult)
    23822383        type = 0;
     
    23922393        QByteArray ptype = guessTypes(tdesc, typeinfo, function);
    23932394        if (pdesc.wParamFlags & PARAMFLAG_FRETVAL) {
    2394             if (ptype.endsWith("&")) {
     2395            if (ptype.endsWith('&')) {
    23952396                ptype.truncate(ptype.length() - 1);
    23962397            } else if (ptype.endsWith("**")) {
     
    24002401        } else {
    24012402            prototype += ptype;
    2402             if (pdesc.wParamFlags & PARAMFLAG_FOUT && !ptype.endsWith("&") && !ptype.endsWith("**"))
    2403                 prototype += "&";
     2403            if (pdesc.wParamFlags & PARAMFLAG_FOUT && !ptype.endsWith('&') && !ptype.endsWith("**"))
     2404                prototype += '&';
    24042405            if (optional || pdesc.wParamFlags & PARAMFLAG_FOPT)
    24052406                paramName += "=0";
     
    24112412        }
    24122413        if (p < funcdesc->cParams && !(pdesc.wParamFlags & PARAMFLAG_FRETVAL))
    2413             prototype += ",";
     2414            prototype += ',';
    24142415    }
    24152416
    24162417    if (!prototype.isEmpty()) {
    2417         if (prototype.right(1) == ",") {
     2418        if (prototype.endsWith(',')) {
    24182419            if (funcdesc->invkind == INVOKE_PROPERTYPUT && p == funcdesc->cParams) {
    24192420                TYPEDESC tdesc = funcdesc->lprgelemdescParam[p-1].tdesc;
    24202421                QByteArray ptype = guessTypes(tdesc, typeinfo, function);
    24212422                prototype += ptype;
    2422                 prototype += ")";
     2423                prototype += ')';
    24232424                parameters << "rhs";
    24242425            } else {
     
    24262427            }
    24272428        } else {
    2428             prototype += ")";
     2429            prototype += ')';
    24292430        }
    24302431    }
     
    24642465        int p;
    24652466        for (p = 0; p < (int)maxNamesOut; ++p) {
    2466             names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1();
     2467            names << QString::fromWCharArray(bstrNames[p]).toLatin1();
    24672468            SysFreeString(bstrNames[p]);
    24682469        }
     
    25742575                    if (defargs) {
    25752576                        parameters.takeLast();
    2576                         int lastParam = prototype.lastIndexOf(",");
     2577                        int lastParam = prototype.lastIndexOf(',');
    25772578                        if (lastParam == -1)
    2578                             lastParam = prototype.indexOf("(") + 1;
     2579                            lastParam = prototype.indexOf('(') + 1;
    25792580                        prototype.truncate(lastParam);
    2580                         prototype += ")";
     2581                        prototype += ')';
    25812582                    }
    25822583                } while (defargs);
     
    25912592        BSTR bstrDocu;
    25922593        info->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0);
    2593         QString strDocu = QString::fromUtf16((const ushort*)bstrDocu);
     2594        QString strDocu = QString::fromWCharArray(bstrDocu);
    25942595        SysFreeString(bstrDocu);
    25952596        if (!!strDocu)
    2596             desc += "[" + strDocu + "]";
    2597         desc += "\n";
     2597            desc += '[' + strDocu + ']';
     2598        desc += '\n';
    25982599#endif
    25992600        typeinfo->ReleaseFuncDesc(funcdesc);
     
    26382639        uint flags = 0;
    26392640
    2640         variableName = QString::fromUtf16((const ushort *)bstrName).toLatin1();
     2641        variableName = QString::fromWCharArray(bstrName).toLatin1();
    26412642        SysFreeString(bstrName);
    26422643
     
    26742675        BSTR bstrDocu;
    26752676        info->GetDocumentation(vardesc->memid, 0, &bstrDocu, 0, 0);
    2676         QString strDocu = QString::fromUtf16((const ushort*)bstrDocu);
     2677        QString strDocu = QString::fromWCharArray(bstrDocu);
    26772678        SysFreeString(bstrDocu);
    26782679        if (!!strDocu)
    2679             desc += "[" + strDocu + "]";
    2680         desc += "\n";
     2680            desc += '[' + strDocu + ']';
     2681        desc += '\n';
    26812682#endif
    26822683        typeinfo->ReleaseVarDesc(vardesc);
     
    27972798        int p;
    27982799        for (p = 0; p < (int)maxNamesOut; ++p) {
    2799             names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1();
     2800            names << QString::fromWCharArray(bstrNames[p]).toLatin1();
    28002801            SysFreeString(bstrNames[p]);
    28012802        }
     
    28212822        BSTR bstrDocu;
    28222823        eventinfo->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0);
    2823         QString strDocu = QString::fromUtf16((const ushort*)bstrDocu);
     2824        QString strDocu = QString::fromWCharArray(bstrDocu);
    28242825        SysFreeString(bstrDocu);
    28252826        if (!!strDocu)
    2826             desc += "[" + strDocu + "]";
    2827         desc += "\n";
     2827            desc += '[' + strDocu + ']';
     2828        desc += '\n';
    28282829#endif
    28292830        eventinfo->ReleaseFuncDesc(funcdesc);
     
    29792980            BSTR bstr;
    29802981            typelib->GetDocumentation(-1, &bstr, 0, 0, 0);
    2981             current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1();
     2982            current_typelib = QString::fromWCharArray(bstr).toLatin1();
    29822983            SysFreeString(bstr);
    29832984        }
     
    32053206
    32063207static QMetaObject qaxobject_staticMetaObject = {
    3207     &QObject::staticMetaObject, qt_meta_stringdata_QAxBase,
    3208         qt_meta_data_QAxBase, 0
     3208    { &QObject::staticMetaObject, qt_meta_stringdata_QAxBase,
     3209        qt_meta_data_QAxBase, 0 }
    32093210};
    32103211static QMetaObject qaxwidget_staticMetaObject = {
    3211     &QWidget::staticMetaObject, qt_meta_stringdata_QAxBase,
    3212         qt_meta_data_QAxBase, 0
     3212    { &QWidget::staticMetaObject, qt_meta_stringdata_QAxBase,
     3213        qt_meta_data_QAxBase, 0 }
    32133214};
    32143215
     
    33883389
    33893390                code = exc->wCode ? exc->wCode : exc->scode;
    3390                 source = QString::fromUtf16((const ushort *)exc->bstrSource);
    3391                 desc = QString::fromUtf16((const ushort *)exc->bstrDescription);
    3392                 help = QString::fromUtf16((const ushort *)exc->bstrHelpFile);
     3391                source = QString::fromWCharArray(exc->bstrSource);
     3392                desc = QString::fromWCharArray(exc->bstrDescription);
     3393                help = QString::fromWCharArray(exc->bstrHelpFile);
    33933394                uint helpContext = exc->dwHelpContext;
    33943395
     
    36933694            id = internalInvoke(call, id, v);
    36943695            break;
     3696        default:
     3697            break;
    36953698        }
    36963699        break;
     
    37063709    case QMetaObject::QueryPropertyUser:
    37073710        id -= mo->propertyCount();
     3711        break;
     3712    default:
    37083713        break;
    37093714    }
     
    39063911                paramType = d->metaobj->paramType(normFunction, i, &out);
    39073912
    3908             if (!parse && d->useMetaObject && var.type() == QVariant::String || var.type() == QVariant::ByteArray) {
     3913            if ((!parse && d->useMetaObject && var.type() == QVariant::String) || var.type() == QVariant::ByteArray) {
    39093914                int enumIndex =mo->indexOfEnumerator(paramType);
    39103915                if (enumIndex != -1) {
     
    42254230            return E_POINTER;
    42264231
    4227         QString property = QString::fromUtf16((const ushort *)name);
     4232        QString property = QString::fromWCharArray(name);
    42284233        QVariant qvar = map.value(property);
    42294234        QVariantToVARIANT(qvar, *var);
     
    42344239        if (!var)
    42354240            return E_POINTER;
    4236         QString property = QString::fromUtf16((const ushort *)name);
     4241        QString property = QString::fromWCharArray(name);
    42374242        QVariant qvar = VARIANTToQVariant(*var, 0);
    42384243        map[property] = qvar;
     
    43954400        QObject *object = qObject();
    43964401        if (QMetaType::type(cn))
    4397             qvar = QVariant(qRegisterMetaType<QObject*>(cn + "*"), &object);
    4398 //            qVariantSetValue(qvar, qObject(), cn + "*");
     4402            qvar = QVariant(qRegisterMetaType<QObject*>(cn + '*'), &object);
     4403//            qVariantSetValue(qvar, qObject(), cn + '*');
    43994404    }
    44004405
Note: See TracChangeset for help on using the changeset viewer.