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/tools/uic/ui4.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 tools applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    23692369    delete m_properties;
    23702370    delete m_slots;
     2371    delete m_propertyspecifications;
    23712372
    23722373    if (clear_all) {
     
    23822383    m_properties = 0;
    23832384    m_slots = 0;
     2385    m_propertyspecifications = 0;
    23842386}
    23852387
     
    23942396    m_properties = 0;
    23952397    m_slots = 0;
     2398    m_propertyspecifications = 0;
    23962399}
    23972400
     
    24042407    delete m_properties;
    24052408    delete m_slots;
     2409    delete m_propertyspecifications;
    24062410}
    24072411
     
    24692473                continue;
    24702474            }
     2475            if (tag == QLatin1String("propertyspecifications")) {
     2476                DomPropertySpecifications *v = new DomPropertySpecifications();
     2477                v->read(reader);
     2478                setElementPropertyspecifications(v);
     2479                continue;
     2480            }
    24712481            reader.raiseError(QLatin1String("Unexpected element ") + tag);
    24722482        }
     
    25492559                continue;
    25502560            }
     2561            if (tag == QLatin1String("propertyspecifications")) {
     2562                DomPropertySpecifications *v = new DomPropertySpecifications();
     2563                v->read(e);
     2564                setElementPropertyspecifications(v);
     2565                continue;
     2566            }
    25512567    }
    25522568    m_text.clear();
     
    26062622    }
    26072623
     2624    if (m_children & Propertyspecifications) {
     2625        m_propertyspecifications->write(writer, QLatin1String("propertyspecifications"));
     2626    }
     2627
    26082628    if (!m_text.isEmpty())
    26092629        writer.writeCharacters(m_text);
     
    27322752}
    27332753
     2754DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications()
     2755{
     2756    DomPropertySpecifications* a = m_propertyspecifications;
     2757    m_propertyspecifications = 0;
     2758    m_children ^= Propertyspecifications;
     2759    return a;
     2760}
     2761
     2762void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a)
     2763{
     2764    delete m_propertyspecifications;
     2765    m_children |= Propertyspecifications;
     2766    m_propertyspecifications = a;
     2767}
     2768
    27342769void DomCustomWidget::clearElementClass()
    27352770{
     
    27972832    m_slots = 0;
    27982833    m_children &= ~Slots;
     2834}
     2835
     2836void DomCustomWidget::clearElementPropertyspecifications()
     2837{
     2838    delete m_propertyspecifications;
     2839    m_propertyspecifications = 0;
     2840    m_children &= ~Propertyspecifications;
    27992841}
    28002842
     
    1088410926}
    1088510927
     10928void DomPropertySpecifications::clear(bool clear_all)
     10929{
     10930    qDeleteAll(m_stringpropertyspecification);
     10931    m_stringpropertyspecification.clear();
     10932
     10933    if (clear_all) {
     10934    m_text.clear();
     10935    }
     10936
     10937    m_children = 0;
     10938}
     10939
     10940DomPropertySpecifications::DomPropertySpecifications()
     10941{
     10942    m_children = 0;
     10943}
     10944
     10945DomPropertySpecifications::~DomPropertySpecifications()
     10946{
     10947    qDeleteAll(m_stringpropertyspecification);
     10948    m_stringpropertyspecification.clear();
     10949}
     10950
     10951void DomPropertySpecifications::read(QXmlStreamReader &reader)
     10952{
     10953
     10954    for (bool finished = false; !finished && !reader.hasError();) {
     10955        switch (reader.readNext()) {
     10956        case QXmlStreamReader::StartElement : {
     10957            const QString tag = reader.name().toString().toLower();
     10958            if (tag == QLatin1String("stringpropertyspecification")) {
     10959                DomStringPropertySpecification *v = new DomStringPropertySpecification();
     10960                v->read(reader);
     10961                m_stringpropertyspecification.append(v);
     10962                continue;
     10963            }
     10964            reader.raiseError(QLatin1String("Unexpected element ") + tag);
     10965        }
     10966            break;
     10967        case QXmlStreamReader::EndElement :
     10968            finished = true;
     10969            break;
     10970        case QXmlStreamReader::Characters :
     10971            if (!reader.isWhitespace())
     10972                m_text.append(reader.text().toString());
     10973            break;
     10974        default :
     10975            break;
     10976        }
     10977    }
     10978}
     10979
     10980#ifdef QUILOADER_QDOM_READ
     10981void DomPropertySpecifications::read(const QDomElement &node)
     10982{
     10983    for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
     10984        if (!n.isElement())
     10985            continue;
     10986        QDomElement e = n.toElement();
     10987        QString tag = e.tagName().toLower();
     10988            if (tag == QLatin1String("stringpropertyspecification")) {
     10989                DomStringPropertySpecification *v = new DomStringPropertySpecification();
     10990                v->read(e);
     10991                m_stringpropertyspecification.append(v);
     10992                continue;
     10993            }
     10994    }
     10995    m_text.clear();
     10996    for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
     10997        if (child.isText())
     10998            m_text.append(child.nodeValue());
     10999     }
     11000}
     11001#endif
     11002
     11003void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
     11004{
     11005    writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower());
     11006
     11007    for (int i = 0; i < m_stringpropertyspecification.size(); ++i) {
     11008        DomStringPropertySpecification* v = m_stringpropertyspecification[i];
     11009        v->write(writer, QLatin1String("stringpropertyspecification"));
     11010    }
     11011    if (!m_text.isEmpty())
     11012        writer.writeCharacters(m_text);
     11013
     11014    writer.writeEndElement();
     11015}
     11016
     11017void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a)
     11018{
     11019    m_children |= Stringpropertyspecification;
     11020    m_stringpropertyspecification = a;
     11021}
     11022
     11023void DomStringPropertySpecification::clear(bool clear_all)
     11024{
     11025
     11026    if (clear_all) {
     11027    m_text.clear();
     11028    m_has_attr_name = false;
     11029    m_has_attr_type = false;
     11030    m_has_attr_notr = false;
     11031    }
     11032
     11033    m_children = 0;
     11034}
     11035
     11036DomStringPropertySpecification::DomStringPropertySpecification()
     11037{
     11038    m_children = 0;
     11039    m_has_attr_name = false;
     11040    m_has_attr_type = false;
     11041    m_has_attr_notr = false;
     11042}
     11043
     11044DomStringPropertySpecification::~DomStringPropertySpecification()
     11045{
     11046}
     11047
     11048void DomStringPropertySpecification::read(QXmlStreamReader &reader)
     11049{
     11050
     11051    foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
     11052        QStringRef name = attribute.name();
     11053        if (name == QLatin1String("name")) {
     11054            setAttributeName(attribute.value().toString());
     11055            continue;
     11056        }
     11057        if (name == QLatin1String("type")) {
     11058            setAttributeType(attribute.value().toString());
     11059            continue;
     11060        }
     11061        if (name == QLatin1String("notr")) {
     11062            setAttributeNotr(attribute.value().toString());
     11063            continue;
     11064        }
     11065        reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
     11066    }
     11067
     11068    for (bool finished = false; !finished && !reader.hasError();) {
     11069        switch (reader.readNext()) {
     11070        case QXmlStreamReader::StartElement : {
     11071            const QString tag = reader.name().toString().toLower();
     11072            reader.raiseError(QLatin1String("Unexpected element ") + tag);
     11073        }
     11074            break;
     11075        case QXmlStreamReader::EndElement :
     11076            finished = true;
     11077            break;
     11078        case QXmlStreamReader::Characters :
     11079            if (!reader.isWhitespace())
     11080                m_text.append(reader.text().toString());
     11081            break;
     11082        default :
     11083            break;
     11084        }
     11085    }
     11086}
     11087
     11088#ifdef QUILOADER_QDOM_READ
     11089void DomStringPropertySpecification::read(const QDomElement &node)
     11090{
     11091    if (node.hasAttribute(QLatin1String("name")))
     11092        setAttributeName(node.attribute(QLatin1String("name")));
     11093    if (node.hasAttribute(QLatin1String("type")))
     11094        setAttributeType(node.attribute(QLatin1String("type")));
     11095    if (node.hasAttribute(QLatin1String("notr")))
     11096        setAttributeNotr(node.attribute(QLatin1String("notr")));
     11097
     11098    for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
     11099        if (!n.isElement())
     11100            continue;
     11101        QDomElement e = n.toElement();
     11102        QString tag = e.tagName().toLower();
     11103    }
     11104    m_text.clear();
     11105    for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
     11106        if (child.isText())
     11107            m_text.append(child.nodeValue());
     11108     }
     11109}
     11110#endif
     11111
     11112void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
     11113{
     11114    writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower());
     11115
     11116    if (hasAttributeName())
     11117        writer.writeAttribute(QLatin1String("name"), attributeName());
     11118
     11119    if (hasAttributeType())
     11120        writer.writeAttribute(QLatin1String("type"), attributeType());
     11121
     11122    if (hasAttributeNotr())
     11123        writer.writeAttribute(QLatin1String("notr"), attributeNotr());
     11124
     11125    if (!m_text.isEmpty())
     11126        writer.writeCharacters(m_text);
     11127
     11128    writer.writeEndElement();
     11129}
     11130
    1088611131QT_END_NAMESPACE
    1088711132
Note: See TracChangeset for help on using the changeset viewer.