Changeset 561 for trunk/src/tools/uic/ui4.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/tools/uic/ui4.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the tools applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 2369 2369 delete m_properties; 2370 2370 delete m_slots; 2371 delete m_propertyspecifications; 2371 2372 2372 2373 if (clear_all) { … … 2382 2383 m_properties = 0; 2383 2384 m_slots = 0; 2385 m_propertyspecifications = 0; 2384 2386 } 2385 2387 … … 2394 2396 m_properties = 0; 2395 2397 m_slots = 0; 2398 m_propertyspecifications = 0; 2396 2399 } 2397 2400 … … 2404 2407 delete m_properties; 2405 2408 delete m_slots; 2409 delete m_propertyspecifications; 2406 2410 } 2407 2411 … … 2469 2473 continue; 2470 2474 } 2475 if (tag == QLatin1String("propertyspecifications")) { 2476 DomPropertySpecifications *v = new DomPropertySpecifications(); 2477 v->read(reader); 2478 setElementPropertyspecifications(v); 2479 continue; 2480 } 2471 2481 reader.raiseError(QLatin1String("Unexpected element ") + tag); 2472 2482 } … … 2549 2559 continue; 2550 2560 } 2561 if (tag == QLatin1String("propertyspecifications")) { 2562 DomPropertySpecifications *v = new DomPropertySpecifications(); 2563 v->read(e); 2564 setElementPropertyspecifications(v); 2565 continue; 2566 } 2551 2567 } 2552 2568 m_text.clear(); … … 2606 2622 } 2607 2623 2624 if (m_children & Propertyspecifications) { 2625 m_propertyspecifications->write(writer, QLatin1String("propertyspecifications")); 2626 } 2627 2608 2628 if (!m_text.isEmpty()) 2609 2629 writer.writeCharacters(m_text); … … 2732 2752 } 2733 2753 2754 DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications() 2755 { 2756 DomPropertySpecifications* a = m_propertyspecifications; 2757 m_propertyspecifications = 0; 2758 m_children ^= Propertyspecifications; 2759 return a; 2760 } 2761 2762 void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a) 2763 { 2764 delete m_propertyspecifications; 2765 m_children |= Propertyspecifications; 2766 m_propertyspecifications = a; 2767 } 2768 2734 2769 void DomCustomWidget::clearElementClass() 2735 2770 { … … 2797 2832 m_slots = 0; 2798 2833 m_children &= ~Slots; 2834 } 2835 2836 void DomCustomWidget::clearElementPropertyspecifications() 2837 { 2838 delete m_propertyspecifications; 2839 m_propertyspecifications = 0; 2840 m_children &= ~Propertyspecifications; 2799 2841 } 2800 2842 … … 10884 10926 } 10885 10927 10928 void 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 10940 DomPropertySpecifications::DomPropertySpecifications() 10941 { 10942 m_children = 0; 10943 } 10944 10945 DomPropertySpecifications::~DomPropertySpecifications() 10946 { 10947 qDeleteAll(m_stringpropertyspecification); 10948 m_stringpropertyspecification.clear(); 10949 } 10950 10951 void 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 10981 void 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 11003 void 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 11017 void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a) 11018 { 11019 m_children |= Stringpropertyspecification; 11020 m_stringpropertyspecification = a; 11021 } 11022 11023 void 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 11036 DomStringPropertySpecification::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 11044 DomStringPropertySpecification::~DomStringPropertySpecification() 11045 { 11046 } 11047 11048 void 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 11089 void 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 11112 void 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 10886 11131 QT_END_NAMESPACE 10887 11132
Note:
See TracChangeset
for help on using the changeset viewer.