diff options
Diffstat (limited to 'kdevdesigner/shared/ui2uib.cpp')
-rw-r--r-- | kdevdesigner/shared/ui2uib.cpp | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/kdevdesigner/shared/ui2uib.cpp b/kdevdesigner/shared/ui2uib.cpp index 91fa7dee..76c522f9 100644 --- a/kdevdesigner/shared/ui2uib.cpp +++ b/kdevdesigner/shared/ui2uib.cpp @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qt Designer. +** This file is part of TQt Designer. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition -** licenses may use this file in accordance with the Qt Commercial License +** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition +** licenses may use this file in accordance with the TQt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -17,7 +17,7 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** See http://www.trolltech.com/pricing.html or email [email protected] for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact [email protected] if any conditions of this licensing are ** not clear to you. @@ -89,7 +89,7 @@ string-table is preinitialized with very common strings, so that these need not be stored along with .uib files. - 2. QObjects are referred to by index in a table rather than by + 2. TQObjects are referred to by index in a table rather than by name. The table itself is not stored in the .uib file; it is rather build dynamically by ui2uib and TQWidgetFactory as new objects are specified. In ui2uib, the table is represented by @@ -97,7 +97,7 @@ TQObject pointers suffices. 3. The data is packed to take as little place as possible, - without slowing down QLayoutFactory too much. For example, an + without slowing down TQLayoutFactory too much. For example, an index into the string-table is a 32-bit integer, but in practice it is rarely above 65534, so only 16 bits are used for them; when an index above 65534 is met, the index is @@ -119,9 +119,9 @@ specified. 6. Some of the information stored in a .ui file is useful only - by uic, not to QLayoutFactory. That information is, for now, + by uic, not to TQLayoutFactory. That information is, for now, not taken along in the .uib file. Likewise, needless - QLayoutWidget objects are not taken along. + TQLayoutWidget objects are not taken along. The arbitrary constants related to the .uib file formats are defined in uib.h. Constants such as Block_Actions and @@ -129,25 +129,25 @@ .uib files easier to read in a hexadecimal editor. The file format isn't designed to be extensible. Any extension - that prevents an older version of QLayoutWidget of reading the + that prevents an older version of TQLayoutWidget of reading the file correctly must have a different magic number. The plan is to use UibMagic + 1 for version 2, UibMagic + 2 for version 3, etc. */ -static TQCString layoutForTag( const TQString& tag ) +static TQCString tqlayoutForTag( const TQString& tag ) { if ( tag == "grid" ) { - return "TQGridLayout"; + return TQGRIDLAYOUT_OBJECT_NAME_STRING; } else if ( tag == "hbox" ) { - return "TQHBoxLayout"; + return TQHBOXLAYOUT_OBJECT_NAME_STRING; } else if ( tag == "vbox" ) { - return "TQVBoxLayout"; + return TQVBOXLAYOUT_OBJECT_NAME_STRING; } else { - return "TQLayout"; + return TQLAYOUT_OBJECT_NAME_STRING; } } -class UibHack : public QObject +class UibHack : public TQObject { public: static TQString normalize( const TQString& member ) { @@ -164,7 +164,7 @@ public: int insert() { return next++; } void setName( int no, const TQString& name ); - int find( const TQString& name, int deflt = -1 ) const; + int tqfind( const TQString& name, int deflt = -1 ) const; int count() const { return next; } private: @@ -181,32 +181,32 @@ void UibIndexMap::setName( int no, const TQString& name ) } } -int UibIndexMap::find( const TQString& name, int deflt ) const +int UibIndexMap::tqfind( const TQString& name, int deflt ) const { - TQMap<TQString, int>::ConstIterator no = nameMap.find( name ); - if ( no == nameMap.end() || conflicts.contains(name) ) { + TQMap<TQString, int>::ConstIterator no = nameMap.tqfind( name ); + if ( no == nameMap.end() || conflicts.tqcontains(name) ) { return deflt; } else { return *no; } } -static void packUInt16( TQDataStream& out, Q_UINT16 n ) +static void packUInt16( TQDataStream& out, TQ_UINT16 n ) { if ( n < 255 ) { - out << (Q_UINT8) n; + out << (TQ_UINT8) n; } else { - out << (Q_UINT8) 255; + out << (TQ_UINT8) 255; out << n; } } -static void packUInt32( TQDataStream& out, Q_UINT32 n ) +static void packUInt32( TQDataStream& out, TQ_UINT32 n ) { if ( n < 65535 ) { - out << (Q_UINT16) n; + out << (TQ_UINT16) n; } else { - out << (Q_UINT16) 65535; + out << (TQ_UINT16) 65535; out << n; } } @@ -232,7 +232,7 @@ static void packString( UibStrTable& strings, TQDataStream& out, static void packStringSplit( UibStrTable& strings, TQDataStream& out, const TQString& str, TQChar sep ) { - int pos = str.find( sep ); + int pos = str.tqfind( sep ); if ( pos == -1 ) pos = str.length(); packString( strings, out, str.left(pos) ); @@ -244,7 +244,7 @@ static void packVariant( UibStrTable& strings, TQDataStream& out, { TQStringList::ConstIterator s; - Q_UINT8 type = value.type(); + TQ_UINT8 type = value.type(); if ( tag == "pixmap" ) { type = TQVariant::Pixmap; } else if ( tag == "image" ) { @@ -293,7 +293,7 @@ static void packVariant( UibStrTable& strings, TQDataStream& out, packUInt32( out, value.asInt() ); break; case TQVariant::Bool: - out << (Q_UINT8) value.asBool(); + out << (TQ_UINT8) value.asBool(); break; case TQVariant::Double: out << value.asDouble(); @@ -333,8 +333,8 @@ static void outputProperty( TQMap<int, TQStringList>& buddies, int objectNo, if ( tag == "font" ) { TQString family; - Q_UINT16 pointSize = 65535; - Q_UINT8 fontFlags = 0; + TQ_UINT16 pointSize = 65535; + TQ_UINT8 fontFlags = 0; TQDomElement g = f.firstChild().toElement(); while ( !g.isNull() ) { @@ -344,7 +344,7 @@ static void outputProperty( TQMap<int, TQStringList>& buddies, int objectNo, family = text; } else if ( g.tagName() == "pointsize" ) { fontFlags |= Font_PointSize; - pointSize = (Q_UINT16) text.toUInt(); + pointSize = (TQ_UINT16) text.toUInt(); } else { if ( g.firstChild().toText().data().toInt() != 0 ) { if ( g.tagName() == "bold" ) { @@ -361,7 +361,7 @@ static void outputProperty( TQMap<int, TQStringList>& buddies, int objectNo, g = g.nextSibling().toElement(); } - out << (Q_UINT8) Object_FontProperty; + out << (TQ_UINT8) Object_FontProperty; packCString( strings, out, name ); out << fontFlags; if ( fontFlags & Font_Family ) @@ -369,34 +369,34 @@ static void outputProperty( TQMap<int, TQStringList>& buddies, int objectNo, if ( fontFlags & Font_PointSize ) packUInt16( out, pointSize ); } else if ( tag == "palette" ) { - out << (Q_UINT8) Object_PaletteProperty; + out << (TQ_UINT8) Object_PaletteProperty; packCString( strings, out, name ); TQDomElement g = f.firstChild().toElement(); while ( !g.isNull() ) { TQDomElement h = g.firstChild().toElement(); while ( !h.isNull() ) { - value = DomTool::elementToVariant( h, Qt::gray ); + value = DomTool::elementToVariant( h, TQt::gray ); if ( h.tagName() == "color" ) { - out << (Q_UINT8) Palette_Color; + out << (TQ_UINT8) Palette_Color; out << value.asColor(); } else if ( h.tagName() == "pixmap" ) { - out << (Q_UINT8) Palette_Pixmap; + out << (TQ_UINT8) Palette_Pixmap; packVariant( strings, out, value, "pixmap" ); } h = h.nextSibling().toElement(); } if ( g.tagName() == "active" ) { - out << (Q_UINT8) Palette_Active; + out << (TQ_UINT8) Palette_Active; } else if ( g.tagName() == "inactive" ) { - out << (Q_UINT8) Palette_Inactive; + out << (TQ_UINT8) Palette_Inactive; } else { - out << (Q_UINT8) Palette_Disabled; + out << (TQ_UINT8) Palette_Disabled; } g = g.nextSibling().toElement(); } - out << (Q_UINT8) Palette_End; + out << (TQ_UINT8) Palette_End; } else { value = DomTool::elementToVariant( f, value, comment ); if ( value.isValid() ) { @@ -404,12 +404,12 @@ static void outputProperty( TQMap<int, TQStringList>& buddies, int objectNo, buddies[objectNo] += value.asString(); } else { if ( tag == "string" ) { - out << (Q_UINT8) Object_TextProperty; + out << (TQ_UINT8) Object_TextProperty; packCString( strings, out, name ); packCString( strings, out, value.asString().utf8() ); packCString( strings, out, comment.utf8() ); } else { - out << (Q_UINT8) Object_VariantProperty; + out << (TQ_UINT8) Object_VariantProperty; packCString( strings, out, name ); packVariant( strings, out, value, tag ); } @@ -430,7 +430,7 @@ static void outputGridCell( TQDataStream& out, TQDomElement elem ) rowspan = 1; if ( column != 0 || row != 0 || colspan != 1 || rowspan != 1 ) { - out << (Q_UINT8) Object_GridCell; + out << (TQ_UINT8) Object_GridCell; packUInt16( out, column ); packUInt16( out, row ); packUInt16( out, colspan ); @@ -456,9 +456,9 @@ static void outputLayoutWidgetsSubLayout( TQMap<int, TQStringList>& buddies, while ( !f.isNull() ) { TQString tag = f.tagName(); if ( tag == "grid" || tag == "hbox" || tag == "vbox" ) { - out << (Q_UINT8) Object_SubLayout; + out << (TQ_UINT8) Object_SubLayout; subLayoutNo = outputObject( buddies, objects, strings, out, f, - layoutForTag(tag) ); + tqlayoutForTag(tag) ); } else if ( tag == "property" ) { if ( f.attribute("name") == "name" ) { name = DomTool::elementToVariant( f, name ).asCString(); @@ -470,14 +470,14 @@ static void outputLayoutWidgetsSubLayout( TQMap<int, TQStringList>& buddies, if ( subLayoutNo != -1 ) { /* - Remove the sub-layout's Object_End marker, append the grid + Remove the sub-tqlayout's Object_End marker, append the grid cell and the correct name property, and put the Object_End marker back. */ - out.device()->at( out.device()->at() - 1 ); + out.tqdevice()->at( out.tqdevice()->at() - 1 ); outputGridCell( out, elem ); outputProperty( buddies, subLayoutNo, strings, out, nameElem ); - out << (Q_UINT8) Object_End; + out << (TQ_UINT8) Object_End; objects.setName( subLayoutNo, name ); } @@ -488,15 +488,15 @@ static int outputObject( TQMap<int, TQStringList>& buddies, TQDataStream& out, TQDomElement elem, TQCString className ) { - bool isQObject = !className.isEmpty(); + bool isTQObject = !className.isEmpty(); - if ( className == "TQToolBar" ) - out << (Q_UINT8) elem.attribute( "dock", "0" ).toInt(); - if ( className == "TQWidget" ) + if ( className == TQTOOLBAR_OBJECT_NAME_STRING ) + out << (TQ_UINT8) elem.attribute( "dock", "0" ).toInt(); + if ( className == TQWIDGET_OBJECT_NAME_STRING ) className = elem.attribute( "class", className ).latin1(); int objectNo = -1; - if ( isQObject ) { + if ( isTQObject ) { packCString( strings, out, className ); objectNo = objects.insert(); } @@ -504,7 +504,7 @@ static int outputObject( TQMap<int, TQStringList>& buddies, outputGridCell( out, elem ); // optimization: insert '&Foo' into string-table before 'Foo' - if ( className == "TQAction" || className == "TQActionGroup" ) { + if ( className == TQACTION_OBJECT_NAME_STRING || className == TQACTIONGROUP_OBJECT_NAME_STRING ) { TQVariant value = DomTool::readProperty( elem, "menuText", TQVariant() ); if ( value.asString().startsWith("&") ) strings.insertString( value.asString() ); @@ -516,67 +516,67 @@ static int outputObject( TQMap<int, TQStringList>& buddies, if ( tag == "action" ) { if ( elem.tagName() == "item" || elem.tagName() == "toolbar" ) { TQString actionName = f.attribute( "name" ); - int no = objects.find( actionName ); + int no = objects.tqfind( actionName ); if ( no != -1 ) { - out << (Q_UINT8) Object_ActionRef; + out << (TQ_UINT8) Object_ActionRef; packUInt16( out, no ); } } else { - out << (Q_UINT8) Object_SubAction; - outputObject( buddies, objects, strings, out, f, "TQAction" ); + out << (TQ_UINT8) Object_SubAction; + outputObject( buddies, objects, strings, out, f, TQACTION_OBJECT_NAME_STRING ); } } else if ( tag == "actiongroup" ) { - out << (Q_UINT8) Object_SubAction; - outputObject( buddies, objects, strings, out, f, "TQActionGroup" ); + out << (TQ_UINT8) Object_SubAction; + outputObject( buddies, objects, strings, out, f, TQACTIONGROUP_OBJECT_NAME_STRING ); } else if ( tag == "attribute" ) { - out << (Q_UINT8) Object_Attribute; + out << (TQ_UINT8) Object_Attribute; outputProperty( buddies, objectNo, strings, out, f ); } else if ( tag == "column" ) { - out << (Q_UINT8) Object_Column; + out << (TQ_UINT8) Object_Column; outputObject( buddies, objects, strings, out, f ); } else if ( tag == "event" ) { - out << (Q_UINT8) Object_Event; + out << (TQ_UINT8) Object_Event; packCString( strings, out, f.attribute("name").latin1() ); packVariant( strings, out, TQStringList::split(',', f.attribute("functions")) ); } else if ( tag == "grid" || tag == "hbox" || tag == "vbox" ) { - out << (Q_UINT8) Object_SubLayout; + out << (TQ_UINT8) Object_SubLayout; outputObject( buddies, objects, strings, out, f, - layoutForTag(tag) ); + tqlayoutForTag(tag) ); } else if ( tag == "item" ) { if ( elem.tagName() == "menubar" ) { - out << (Q_UINT8) Object_MenuItem; + out << (TQ_UINT8) Object_MenuItem; packCString( strings, out, f.attribute("name").latin1() ); packCString( strings, out, f.attribute("text").utf8() ); outputObject( buddies, objects, strings, out, f ); } else { - out << (Q_UINT8) Object_Item; + out << (TQ_UINT8) Object_Item; outputObject( buddies, objects, strings, out, f ); } } else if ( tag == "property" ) { outputProperty( buddies, objectNo, strings, out, f ); } else if ( tag == "row" ) { - out << (Q_UINT8) Object_Row; + out << (TQ_UINT8) Object_Row; outputObject( buddies, objects, strings, out, f ); } else if ( tag == "separator" ) { - out << (Q_UINT8) Object_Separator; + out << (TQ_UINT8) Object_Separator; } else if ( tag == "spacer" ) { - out << (Q_UINT8) Object_Spacer; + out << (TQ_UINT8) Object_Spacer; outputObject( buddies, objects, strings, out, f ); } else if ( tag == "widget" ) { - if ( f.attribute("class") == "QLayoutWidget" && + if ( f.attribute("class") == TQLAYOUTWIDGET_OBJECT_NAME_STRING && elem.tagName() != "widget" ) { outputLayoutWidgetsSubLayout( buddies, objects, strings, out, f ); } else { - out << (Q_UINT8) Object_SubWidget; - outputObject( buddies, objects, strings, out, f, "TQWidget" ); + out << (TQ_UINT8) Object_SubWidget; + outputObject( buddies, objects, strings, out, f, TQWIDGET_OBJECT_NAME_STRING ); } } f = f.nextSibling().toElement(); } - out << (Q_UINT8) Object_End; - if ( isQObject ) + out << (TQ_UINT8) Object_End; + if ( isTQObject ) objects.setName( objectNo, DomTool::readProperty(elem, "name", "").asString() ); return objectNo; @@ -586,7 +586,7 @@ static void outputBlock( TQDataStream& out, BlockTag tag, const TQByteArray& data ) { if ( !data.isEmpty() ) { - out << (Q_UINT8) tag; + out << (TQ_UINT8) tag; packByteArray( out, data ); } } @@ -619,9 +619,9 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) UibIndexMap objects; int widgetNo = -1; TQCString className; - Q_INT16 defaultMargin = -32768; - Q_INT16 defaultSpacing = -32768; - Q_UINT8 introFlags = 0; + TQ_INT16 defaultMargin = -32768; + TQ_INT16 defaultSpacing = -32768; + TQ_UINT8 introFlags = 0; TQDomElement elem = doc.firstChild().toElement().firstChild().toElement(); while ( !elem.isNull() ) { @@ -682,7 +682,7 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) } break; case 'l': - if ( tag == "layoutdefaults" ) { + if ( tag == "tqlayoutdefaults" ) { TQString margin = elem.attribute( "margin" ); if ( !margin.isEmpty() ) defaultMargin = margin.toInt(); @@ -747,7 +747,7 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) { TQDataStream out2( widgetBlock, IO_WriteOnly ); widgetNo = outputObject( buddies, objects, strings, out2, widgetElem, - "TQWidget" ); + TQWIDGET_OBJECT_NAME_STRING ); } if ( !tabstopsElem.isNull() ) { @@ -756,7 +756,7 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) while ( !f.isNull() ) { if ( f.tagName() == "tabstop" ) { TQString widgetName = f.firstChild().toText().data(); - int no = objects.find( widgetName ); + int no = objects.tqfind( widgetName ); if ( no != -1 ) packUInt16( out2, no ); } @@ -772,7 +772,7 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) if ( !menubarElem.isNull() ) { TQDataStream out2( menubarBlock, IO_WriteOnly ); outputObject( buddies, objects, strings, out2, menubarElem, - "TQMenuBar" ); + TQMENUBAR_OBJECT_NAME_STRING ); } if ( !toolbarsElem.isNull() ) { @@ -780,7 +780,7 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) TQDomElement f = toolbarsElem.firstChild().toElement(); while ( !f.isNull() ) { if ( f.tagName() == "toolbar" ) - outputObject( buddies, objects, strings, out2, f, "TQToolBar" ); + outputObject( buddies, objects, strings, out2, f, TQTOOLBAR_OBJECT_NAME_STRING ); f = f.nextSibling().toElement(); } } @@ -791,7 +791,7 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) while ( a != buddies.end() ) { TQStringList::ConstIterator b = (*a).begin(); while ( b != (*a).end() ) { - int no = objects.find( *b ); + int no = objects.tqfind( *b ); if ( no != -1 ) { packUInt16( out2, a.key() ); packUInt16( out2, no ); @@ -822,12 +822,12 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) } TQString language = f.attribute( "language", "C++" ); - int senderNo = objects.find( argMap["sender"], widgetNo ); - int receiverNo = objects.find( argMap["receiver"], widgetNo ); + int senderNo = objects.tqfind( argMap["sender"], widgetNo ); + int receiverNo = objects.tqfind( argMap["receiver"], widgetNo ); TQString signal = UibHack::normalize( argMap["signal"] ); TQString slot = UibHack::normalize( argMap["slot"] ); - Q_UINT8 connectionFlags = 0; + TQ_UINT8 connectionFlags = 0; if ( language != prevLanguage ) connectionFlags |= Connection_Language; if ( senderNo != prevSenderNo ) @@ -873,9 +873,9 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) } out << UibMagic; - out << (Q_UINT8) '\n'; - out << (Q_UINT8) '\r'; - out << (Q_UINT8) out.version(); + out << (TQ_UINT8) '\n'; + out << (TQ_UINT8) '\r'; + out << (TQ_UINT8) out.version(); outputBlock( out, Block_Strings, strings.block() ); outputBlock( out, Block_Intro, introBlock ); outputBlock( out, Block_Images, imagesBlock ); @@ -889,5 +889,5 @@ void convertUiToUib( TQDomDocument& doc, TQDataStream& out ) outputBlock( out, Block_Functions, functionsBlock ); outputBlock( out, Block_Buddies, buddiesBlock ); outputBlock( out, Block_Connections, connectionsBlock ); - out << (Q_UINT8) Block_End; + out << (TQ_UINT8) Block_End; } |