summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/designer/rbuic/uic.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-05 16:20:48 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-05 16:20:48 -0600
commite63beeb5bdb82987b1e00bc35178667786fbad48 (patch)
treeab77b6ac830b7944d5d1eb9ce8f81feb8fdab948 /qtruby/rubylib/designer/rbuic/uic.cpp
parent67557a2b56c0678c22ab1b00c4fd0224c5e9ed99 (diff)
downloadtdebindings-e63beeb5bdb82987b1e00bc35178667786fbad48.tar.gz
tdebindings-e63beeb5bdb82987b1e00bc35178667786fbad48.zip
Fix incorrect conversion
Diffstat (limited to 'qtruby/rubylib/designer/rbuic/uic.cpp')
-rw-r--r--qtruby/rubylib/designer/rbuic/uic.cpp396
1 files changed, 198 insertions, 198 deletions
diff --git a/qtruby/rubylib/designer/rbuic/uic.cpp b/qtruby/rubylib/designer/rbuic/uic.cpp
index 106e9879..9343b4e6 100644
--- a/qtruby/rubylib/designer/rbuic/uic.cpp
+++ b/qtruby/rubylib/designer/rbuic/uic.cpp
@@ -67,42 +67,42 @@ void RubyIndent::calc()
}
-TTQString Uic::getComment( const TTQDomNode& n )
+TQString Uic::getComment( const TQDomNode& n )
{
- TTQDomNode child = n.firstChild();
+ TQDomNode child = n.firstChild();
while ( !child.isNull() ) {
if ( child.toElement().tagName() == "comment" )
return child.toElement().firstChild().toText().data();
child = child.nextSibling();
}
- return TTQString::null;
+ return TQString::null;
}
-TTQString Uic::mkBool( bool b )
+TQString Uic::mkBool( bool b )
{
return b? "true" : "false";
}
-TTQString Uic::mkBool( const TTQString& s )
+TQString Uic::mkBool( const TQString& s )
{
return mkBool( s == "true" || s == "1" );
}
-bool Uic::toBool( const TTQString& s )
+bool Uic::toBool( const TQString& s )
{
return s == "true" || s.toInt() != 0;
}
-TTQString Uic::fixString( const TTQString &str )
+TQString Uic::fixString( const TQString &str )
{
- TTQString s( str );
- s.replace( TTQRegExp( "\\\\" ), "\\\\" );
- s.replace( TTQRegExp( "\"" ), "\\\"" );
- s.replace( TTQRegExp( "\r?\n" ), "\\n\" +\n" + indent + "\"" );
+ TQString s( str );
+ s.replace( TQRegExp( "\\\\" ), "\\\\" );
+ s.replace( TQRegExp( "\"" ), "\\\"" );
+ s.replace( TQRegExp( "\r?\n" ), "\\n\" +\n" + indent + "\"" );
return "\"" + s + "\"";
}
-TTQString Uic::trcall( const TTQString& sourceText, const TTQString& comment )
+TQString Uic::trcall( const TQString& sourceText, const TQString& comment )
{
if ( sourceText.isEmpty() && comment.isEmpty() )
return "nil";
@@ -112,19 +112,19 @@ TTQString Uic::trcall( const TTQString& sourceText, const TTQString& comment )
return trmacro + "(" + fixString( sourceText ) + "," + fixString( comment ) + ")";
}
-TTQString Uic::mkStdSet( const TTQString& prop )
+TQString Uic::mkStdSet( const TQString& prop )
{
- return TTQString( "set" ) + prop[0].upper() + prop.mid(1);
+ return TQString( "set" ) + prop[0].upper() + prop.mid(1);
}
-bool Uic::isEmptyFunction( const TTQString& fname )
+bool Uic::isEmptyFunction( const TQString& fname )
{
- TTQMap<TTQString, TTQString>::Iterator fit = functionImpls.find( Parser::cleanArgs( fname ) );
+ TQMap<TQString, TQString>::Iterator fit = functionImpls.find( Parser::cleanArgs( fname ) );
if ( fit != functionImpls.end() ) {
int begin = (*fit).find( "{" );
- TTQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 );
+ TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 );
return body.simplifyWhiteSpace().isEmpty();
}
// For now ruby functions are always empty, until a rubyeditor Qt Designer plugin exists..
@@ -139,9 +139,9 @@ bool Uic::isEmptyFunction( const TTQString& fname )
The class Uic encapsulates the user interface compiler (uic).
*/
-Uic::Uic( const TTQString &fn, TTQTextStream &outStream, TTQDomDocument doc,
- bool subcl, const TTQString &trm, const TTQString& subClass,
- bool omitForwardDecls, TTQString &uicClass, bool useKDE )
+Uic::Uic( const TQString &fn, TQTextStream &outStream, TQDomDocument doc,
+ bool subcl, const TQString &trm, const TQString& subClass,
+ bool omitForwardDecls, TQString &uicClass, bool useKDE )
: out( outStream ), trout( &languageChangeBody ),
trmacro( trm ), nofwd( omitForwardDecls )
{
@@ -164,16 +164,16 @@ Uic::Uic( const TTQString &fn, TTQTextStream &outStream, TTQDomDocument doc,
uiFileVersion = doc.firstChild().toElement().attribute("version");
stdsetdef = toBool( doc.firstChild().toElement().attribute("stdsetdef") );
- TTQDomElement e = doc.firstChild().firstChild().toElement();
- TTQDomElement widget;
+ TQDomElement e = doc.firstChild().firstChild().toElement();
+ TQDomElement widget;
while ( !e.isNull() ) {
if ( e.tagName() == "widget" ) {
widget = e;
} else if ( e.tagName() == "pixmapinproject" ) {
externPixmaps = true;
} else if ( e.tagName() == "layoutdefaults" ) {
- defSpacing = e.attribute( "spacing", TTQString::number( defSpacing ) ).toInt();
- defMargin = e.attribute( "margin", TTQString::number( defMargin ) ).toInt();
+ defSpacing = e.attribute( "spacing", TQString::number( defSpacing ) ).toInt();
+ defMargin = e.attribute( "margin", TQString::number( defMargin ) ).toInt();
}
e = e.nextSibling().toElement();
}
@@ -193,26 +193,26 @@ Uic::Uic( const TTQString &fn, TTQTextStream &outStream, TTQDomDocument doc,
/*! Extracts a pixmap loader function from \a e
*/
-TTQString Uic::getPixmapLoaderFunction( const TTQDomElement& e )
+TQString Uic::getPixmapLoaderFunction( const TQDomElement& e )
{
- TTQDomElement n;
+ TQDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "pixmapfunction" )
return n.firstChild().toText().data();
}
- return TTQString::null;
+ return TQString::null;
}
/*! Extracts the forms class name from \a e
*/
-TTQString Uic::getFormClassName( const TTQDomElement& e )
+TQString Uic::getFormClassName( const TQDomElement& e )
{
- TTQDomElement n;
- TTQString cn;
+ TQDomElement n;
+ TQString cn;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "class" ) {
- TTQString s = n.firstChild().toText().data();
+ TQString s = n.firstChild().toText().data();
int i;
while ( ( i = s.find(' ' )) != -1 )
s[i] = '_';
@@ -224,16 +224,16 @@ TTQString Uic::getFormClassName( const TTQDomElement& e )
/*! Extracts a Ruby class name from \a e.
*/
-TTQString Uic::getClassName( const TTQDomElement& e )
+TQString Uic::getClassName( const TQDomElement& e )
{
- TTQString s = e.attribute( "class" );
+ TQString s = e.attribute( "class" );
if ( s.isEmpty() && e.tagName() == "toolbar" )
s = "TQt::ToolBar";
else if ( s.isEmpty() && e.tagName() == "menubar" )
s = "TQt::MenuBar";
else
{
- TTQRegExp r("^([QK])(\\S+)");
+ TQRegExp r("^([QK])(\\S+)");
if( r.search( s ) != -1 ) {
if (r.cap(1) == "K") {
hasKDEwidget = true;
@@ -255,11 +255,11 @@ TTQString Uic::getClassName( const TTQDomElement& e )
/*! Returns TRUE if database framework code is generated, else FALSE.
*/
-bool Uic::isFrameworkCodeGenerated( const TTQDomElement& e )
+bool Uic::isFrameworkCodeGenerated( const TQDomElement& e )
{
- TTQDomElement n = getObjectProperty( e, "frameworkCode" );
+ TQDomElement n = getObjectProperty( e, "frameworkCode" );
if ( n.attribute("name") == "frameworkCode" &&
- !DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant( true, 0 ) ).toBool() )
+ !DomTool::elementToVariant( n.firstChild().toElement(), TQVariant( true, 0 ) ).toBool() )
return false;
return true;
}
@@ -267,36 +267,36 @@ bool Uic::isFrameworkCodeGenerated( const TTQDomElement& e )
/*! Extracts an object name from \a e. It's stored in the 'name'
property.
*/
-TTQString Uic::getObjectName( const TTQDomElement& e )
+TQString Uic::getObjectName( const TQDomElement& e )
{
- TTQDomElement n = getObjectProperty( e, "name" );
+ TQDomElement n = getObjectProperty( e, "name" );
if ( n.firstChild().toElement().tagName() == "cstring" )
return n.firstChild().toElement().firstChild().toText().data();
- return TTQString::null;
+ return TQString::null;
}
/*! Extracts an layout name from \a e. It's stored in the 'name'
property of the preceeding sibling (the first child of a TQLayoutWidget).
*/
-TTQString Uic::getLayoutName( const TTQDomElement& e )
+TQString Uic::getLayoutName( const TQDomElement& e )
{
- TTQDomElement p = e.parentNode().toElement();
- TTQString tail = TTQString::null;
+ TQDomElement p = e.parentNode().toElement();
+ TQString tail = TQString::null;
if ( getClassName(p) != "TQt::LayoutWidget" )
tail = "Layout";
- TTQDomElement n = getObjectProperty( p, "name" );
+ TQDomElement n = getObjectProperty( p, "name" );
if ( n.firstChild().toElement().tagName() == "cstring" )
return n.firstChild().toElement().firstChild().toText().data() + tail;
return e.tagName();
}
-TTQString Uic::getDatabaseInfo( const TTQDomElement& e, const TTQString& tag )
+TQString Uic::getDatabaseInfo( const TQDomElement& e, const TQString& tag )
{
- TTQDomElement n;
- TTQDomElement n1;
+ TQDomElement n;
+ TQDomElement n1;
int child = 0;
// database info is a stringlist stored in this order
if ( tag == "connection" )
@@ -306,27 +306,27 @@ TTQString Uic::getDatabaseInfo( const TTQDomElement& e, const TTQString& tag )
else if ( tag == "field" )
child = 2;
else
- return TTQString::null;
+ return TQString::null;
n = getObjectProperty( e, "database" );
if ( n.firstChild().toElement().tagName() == "stringlist" ) {
// find correct stringlist entry
- TTQDomElement n1 = n.firstChild().firstChild().toElement();
+ TQDomElement n1 = n.firstChild().firstChild().toElement();
for ( int i = 0; i < child && !n1.isNull(); ++i )
n1 = n1.nextSibling().toElement();
if ( n1.isNull() )
- return TTQString::null;
+ return TQString::null;
return n1.firstChild().toText().data();
}
- return TTQString::null;
+ return TQString::null;
}
-void Uic::registerLayouts( const TTQDomElement &e )
+void Uic::registerLayouts( const TQDomElement &e )
{
if ( layouts.contains(e.tagName()) )
createObjectDecl(e);
- TTQDomNodeList nl = e.childNodes();
+ TQDomNodeList nl = e.childNodes();
for ( int i = 0; i < (int) nl.length(); ++i )
registerLayouts( nl.item(i).toElement() );
}
@@ -335,32 +335,32 @@ void Uic::registerLayouts( const TTQDomElement &e )
/*!
Returns include file for class \a className or a null string.
*/
-TTQString Uic::getInclude( const TTQString& className )
+TQString Uic::getInclude( const TQString& className )
{
int wid = WidgetDatabase::idFromClassName( className );
if ( wid != -1 )
return WidgetDatabase::includeFile( wid );
- return TTQString::null;
+ return TQString::null;
}
-void Uic::createActionDecl( const TTQDomElement& e )
+void Uic::createActionDecl( const TQDomElement& e )
{
- TTQString objName = getObjectName( e );
+ TQString objName = getObjectName( e );
if ( objName.isEmpty() )
return;
out << indent << objName << endl;
if ( e.tagName() == "actiongroup" ) {
- for ( TTQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
+ for ( TQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "action" || n.tagName() == "actiongroup" )
createActionDecl( n );
}
}
}
-void Uic::createActionImpl( const TTQDomElement &n, const TTQString &parent )
+void Uic::createActionImpl( const TQDomElement &n, const TQString &parent )
{
- for ( TTQDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) {
- TTQString objName = registerObject( getObjectName( ae ) );
+ for ( TQDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) {
+ TQString objName = registerObject( getObjectName( ae ) );
if ( ae.tagName() == "action" )
out << indent << objName << "= TQt::Action.new(" << parent << ", \"" << objName.mid(1) << "\")" << endl;
else if ( ae.tagName() == "actiongroup" )
@@ -369,20 +369,20 @@ void Uic::createActionImpl( const TTQDomElement &n, const TTQString &parent )
continue;
bool subActionsDone = false;
bool hasMenuText = false;
- TTQString actionText;
- for ( TTQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) {
+ TQString actionText;
+ for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) {
if ( n2.tagName() == "property" ) {
bool stdset = stdsetdef;
if ( n2.hasAttribute( "stdset" ) )
stdset = toBool( n2.attribute( "stdset" ) );
- TTQString prop = n2.attribute("name");
+ TQString prop = n2.attribute("name");
if ( prop == "name" )
continue;
- TTQString value = setObjectProperty( "TQt::Action", objName, prop, n2.firstChild().toElement(), stdset );
+ TQString value = setObjectProperty( "TQt::Action", objName, prop, n2.firstChild().toElement(), stdset );
if ( value.isEmpty() )
continue;
- TTQString call = objName + ".";
+ TQString call = objName + ".";
if ( stdset ) {
call += mkStdSet( prop ) + "(" + value + ")";
} else {
@@ -405,13 +405,13 @@ void Uic::createActionImpl( const TTQDomElement &n, const TTQString &parent )
subActionsDone = true;
}
}
- // workaround for loading pre-3.3 files expecting bogus TTQAction behavior
+ // workaround for loading pre-3.3 files expecting bogus TQAction behavior
if (!hasMenuText && !actionText.isEmpty() && uiFileVersion < "3.3")
trout << indent << objName << ".setMenuText(" << actionText << ")" << endl;
}
}
-TTQString get_dock( const TTQString &d )
+TQString get_dock( const TQString &d )
{
if ( d == "0" )
return "DockUnmanaged";
@@ -430,16 +430,16 @@ TTQString get_dock( const TTQString &d )
return "";
}
-void Uic::createToolbarImpl( const TTQDomElement &n, const TTQString &parentClass, const TTQString &parent )
+void Uic::createToolbarImpl( const TQDomElement &n, const TQString &parentClass, const TQString &parent )
{
- TTQDomNodeList nl = n.elementsByTagName( "toolbar" );
+ TQDomNodeList nl = n.elementsByTagName( "toolbar" );
for ( int i = 0; i < (int) nl.length(); i++ ) {
- TTQDomElement ae = nl.item( i ).toElement();
- TTQString dock = get_dock( ae.attribute( "dock" ) );
- TTQString objName = "@" + getObjectName( ae );
+ TQDomElement ae = nl.item( i ).toElement();
+ TQString dock = get_dock( ae.attribute( "dock" ) );
+ TQString objName = "@" + getObjectName( ae );
out << indent << objName << " = TQt::ToolBar.new(\"\", self, " << dock << ")" << endl;
createObjectImpl( ae, parentClass, parent );
- for ( TTQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) {
+ for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) {
if ( n2.tagName() == "action" ) {
out << indent << "@" << n2.attribute( "name" ) << ".addTo( " << objName << " )" << endl;
} else if ( n2.tagName() == "separator" ) {
@@ -448,7 +448,7 @@ void Uic::createToolbarImpl( const TTQDomElement &n, const TTQString &parentClas
if ( n2.attribute( "class" ) != "Spacer" ) {
createObjectImpl( n2, "TQt::ToolBar", objName );
} else {
- TTQString child = createSpacerImpl( n2, parentClass, parent, objName );
+ TQString child = createSpacerImpl( n2, parentClass, parent, objName );
out << indent << "TQt::Application.sendPostedEvents( " << objName
<< ", TQt::Event::ChildInserted)" << endl;
out << indent << objName << ".boxLayout().addItem(" << child << ")" << endl;
@@ -458,21 +458,21 @@ void Uic::createToolbarImpl( const TTQDomElement &n, const TTQString &parentClas
}
}
-void Uic::createMenuBarImpl( const TTQDomElement &n, const TTQString &parentClass, const TTQString &parent )
+void Uic::createMenuBarImpl( const TQDomElement &n, const TQString &parentClass, const TQString &parent )
{
- TTQString objName = "@" + getObjectName( n );
+ TQString objName = "@" + getObjectName( n );
out << indent << objName << " = TQt::MenuBar.new( self, \"" << objName.mid(1) << "\" )" << endl;
createObjectImpl( n, parentClass, parent );
int i = 0;
- TTQDomElement c = n.firstChild().toElement();
+ TQDomElement c = n.firstChild().toElement();
while ( !c.isNull() ) {
if ( c.tagName() == "item" ) {
- TTQString itemName = "@" + c.attribute( "name" );
+ TQString itemName = "@" + c.attribute( "name" );
out << endl;
out << indent << itemName << " = TQt::PopupMenu.new( self )" << endl;
createPopupMenuImpl( c, parentClass, itemName );
out << indent << objName << ".insertItem( \"\", " << itemName << ", " << i << " )" << endl;
- TTQString findItem(objName + ".findItem(%1)");
+ TQString findItem(objName + ".findItem(%1)");
findItem = findItem.arg(i);
trout << indent << "if !" << findItem << ".nil?" << endl;
trout << indent << indent << findItem << ".setText( " << trcall( c.attribute( "text" ) ) << " )" << endl;
@@ -486,15 +486,15 @@ void Uic::createMenuBarImpl( const TTQDomElement &n, const TTQString &parentClas
}
}
-void Uic::createPopupMenuImpl( const TTQDomElement &e, const TTQString &parentClass, const TTQString &parent )
+void Uic::createPopupMenuImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent )
{
int i = 0;
- for ( TTQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
+ for ( TQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "action" || n.tagName() == "actiongroup" ) {
- TTQDomElement n2 = n.nextSibling().toElement();
+ TQDomElement n2 = n.nextSibling().toElement();
if ( n2.tagName() == "item" ) { // the action has a sub menu
- TTQString itemName = "@" + n2.attribute( "name" );
- TTQString itemText = n2.attribute( "text" );
+ TQString itemName = "@" + n2.attribute( "name" );
+ TQString itemText = n2.attribute( "text" );
out << indent << itemName << " = TQt::PopupMenu.new( self )" << endl;
out << indent << indent << parent << ".insertItem( @" << n.attribute( "name" ) << ".iconSet(),";
out << trcall( itemText ) << ", " << itemName << " )" << endl;
@@ -516,17 +516,17 @@ void Uic::createPopupMenuImpl( const TTQDomElement &e, const TTQString &parentCl
Creates implementation of an listbox item tag.
*/
-TTQString Uic::createListBoxItemImpl( const TTQDomElement &e, const TTQString &parent,
- TTQString *value )
+TQString Uic::createListBoxItemImpl( const TQDomElement &e, const TQString &parent,
+ TQString *value )
{
- TTQDomElement n = e.firstChild().toElement();
- TTQString txt;
- TTQString com;
- TTQString pix;
+ TQDomElement n = e.firstChild().toElement();
+ TQString txt;
+ TQString com;
+ TQString pix;
while ( !n.isNull() ) {
if ( n.tagName() == "property" ) {
- TTQString attrib = n.attribute("name");
- TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() );
+ TQString attrib = n.attribute("name");
+ TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() );
if ( attrib == "text" ) {
txt = v.toString();
com = getComment( n );
@@ -536,8 +536,8 @@ TTQString Uic::createListBoxItemImpl( const TTQDomElement &e, const TTQString &p
pix.prepend("@");
}
if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) {
- pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) );
- pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" );
+ pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) );
+ pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" );
}
}
}
@@ -557,16 +557,16 @@ TTQString Uic::createListBoxItemImpl( const TTQDomElement &e, const TTQString &p
Creates implementation of an iconview item tag.
*/
-TTQString Uic::createIconViewItemImpl( const TTQDomElement &e, const TTQString &parent )
+TQString Uic::createIconViewItemImpl( const TQDomElement &e, const TQString &parent )
{
- TTQDomElement n = e.firstChild().toElement();
- TTQString txt;
- TTQString com;
- TTQString pix;
+ TQDomElement n = e.firstChild().toElement();
+ TQString txt;
+ TQString com;
+ TQString pix;
while ( !n.isNull() ) {
if ( n.tagName() == "property" ) {
- TTQString attrib = n.attribute("name");
- TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() );
+ TQString attrib = n.attribute("name");
+ TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() );
if ( attrib == "text" ) {
txt = v.toString();
com = getComment( n );
@@ -576,8 +576,8 @@ TTQString Uic::createIconViewItemImpl( const TTQDomElement &e, const TTQString &
pix.prepend("@");
}
if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) {
- pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) );
- pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" );
+ pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) );
+ pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" );
}
}
}
@@ -594,15 +594,15 @@ TTQString Uic::createIconViewItemImpl( const TTQDomElement &e, const TTQString &
Creates implementation of an listview item tag.
*/
-TTQString Uic::createListViewItemImpl( const TTQDomElement &e, const TTQString &parent,
- const TTQString &parentItem )
+TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &parent,
+ const TQString &parentItem )
{
- TTQString s;
+ TQString s;
- TTQDomElement n = e.firstChild().toElement();
+ TQDomElement n = e.firstChild().toElement();
bool hasChildren = e.elementsByTagName( "item" ).count() > 0;
- TTQString item;
+ TQString item;
if ( hasChildren ) {
item = registerObject( "item" );
@@ -623,22 +623,22 @@ TTQString Uic::createListViewItemImpl( const TTQDomElement &e, const TTQString &
else
s += "TQt::ListViewItem.new(" + parent + ", " + lastItem + ")\n";
- TTQStringList textes;
- TTQStringList pixmaps;
+ TQStringList textes;
+ TQStringList pixmaps;
while ( !n.isNull() ) {
if ( n.tagName() == "property" ) {
- TTQString attrib = n.attribute("name");
- TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() );
+ TQString attrib = n.attribute("name");
+ TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() );
if ( attrib == "text" )
textes << v.toString();
else if ( attrib == "pixmap" ) {
- TTQString pix = v.toString();
+ TQString pix = v.toString();
if (!pix.isEmpty()) {
pix.prepend("@");
}
if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) {
- pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) );
- pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" );
+ pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) );
+ pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" );
}
pixmaps << pix;
}
@@ -651,9 +651,9 @@ TTQString Uic::createListViewItemImpl( const TTQDomElement &e, const TTQString &
for ( int i = 0; i < (int)textes.count(); ++i ) {
if ( !textes[ i ].isEmpty() )
- s += indent + item + ".setText(" + TTQString::number( i ) + ", " + trcall( textes[ i ] ) + ")\n";
+ s += indent + item + ".setText(" + TQString::number( i ) + ", " + trcall( textes[ i ] ) + ")\n";
if ( !pixmaps[ i ].isEmpty() )
- s += indent + item + ".setPixmap(" + TTQString::number( i ) + ", " + pixmaps[ i ] + ")\n";
+ s += indent + item + ".setPixmap(" + TQString::number( i ) + ", " + pixmaps[ i ] + ")\n";
}
lastItem = item;
@@ -664,18 +664,18 @@ TTQString Uic::createListViewItemImpl( const TTQDomElement &e, const TTQString &
Creates implementation of an listview column tag.
*/
-TTQString Uic::createListViewColumnImpl( const TTQDomElement &e, const TTQString &parent,
- TTQString *value )
+TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &parent,
+ TQString *value )
{
- TTQDomElement n = e.firstChild().toElement();
- TTQString txt;
- TTQString com;
- TTQString pix;
+ TQDomElement n = e.firstChild().toElement();
+ TQString txt;
+ TQString com;
+ TQString pix;
bool clickable = false, resizeable = false;
while ( !n.isNull() ) {
if ( n.tagName() == "property" ) {
- TTQString attrib = n.attribute("name");
- TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() );
+ TQString attrib = n.attribute("name");
+ TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() );
if ( attrib == "text" ) {
txt = v.toString();
com = getComment( n );
@@ -685,8 +685,8 @@ TTQString Uic::createListViewColumnImpl( const TTQDomElement &e, const TTQString
pix.prepend("@");
}
if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) {
- pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) );
- pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" );
+ pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) );
+ pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" );
}
} else if ( attrib == "clickable" )
clickable = v.toBool();
@@ -699,7 +699,7 @@ TTQString Uic::createListViewColumnImpl( const TTQDomElement &e, const TTQString
if ( value )
*value = trcall( txt, com );
- TTQString s;
+ TQString s;
s = indent + parent + ".addColumn(" + trcall( txt, com ) + ")\n";
if ( !pix.isEmpty() )
s += indent + parent + ".header().setLabel(" + parent + ".header().count() - 1," + pix + ", " + trcall( txt, com ) + ")\n";
@@ -711,28 +711,28 @@ TTQString Uic::createListViewColumnImpl( const TTQDomElement &e, const TTQString
return s;
}
-TTQString Uic::createTableRowColumnImpl( const TTQDomElement &e, const TTQString &parent,
- TTQString *value )
+TQString Uic::createTableRowColumnImpl( const TQDomElement &e, const TQString &parent,
+ TQString *value )
{
- TTQString objClass = getClassName( e.parentNode().toElement() );
- TTQDomElement n = e.firstChild().toElement();
- TTQString txt;
- TTQString com;
- TTQString pix;
- TTQString field;
+ TQString objClass = getClassName( e.parentNode().toElement() );
+ TQDomElement n = e.firstChild().toElement();
+ TQString txt;
+ TQString com;
+ TQString pix;
+ TQString field;
bool isRow = e.tagName() == "row";
while ( !n.isNull() ) {
if ( n.tagName() == "property" ) {
- TTQString attrib = n.attribute("name");
- TTQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TTQVariant() );
+ TQString attrib = n.attribute("name");
+ TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() );
if ( attrib == "text" ) {
txt = v.toString();
com = getComment( n );
} else if ( attrib == "pixmap" ) {
pix = v.toString();
if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) {
- pix.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) );
- pix.append( TTQString( externPixmaps ? "\"" : "" ) + ")" );
+ pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) );
+ pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" );
}
} else if ( attrib == "field" )
field = v.toString();
@@ -745,9 +745,9 @@ TTQString Uic::createTableRowColumnImpl( const TTQDomElement &e, const TTQString
// ### This generated code sucks! We have to set the number of
// rows/cols before and then only do setLabel/()
- // ### careful, though, since TTQDataTable has an API which makes this code pretty good
+ // ### careful, though, since TQDataTable has an API which makes this code pretty good
- TTQString s;
+ TQString s;
if ( isRow ) {
s = indent + parent + ".setNumRows(" + parent + ".numRows() + 1 )\n";
if ( pix.isEmpty() )
@@ -780,13 +780,13 @@ TTQString Uic::createTableRowColumnImpl( const TTQDomElement &e, const TTQString
/*!
Creates the implementation of a layout tag. Called from createObjectImpl().
*/
-TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parentClass, const TTQString& parent, const TTQString& layout )
+TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout )
{
- TTQDomElement n;
- TTQString objClass, objName;
+ TQDomElement n;
+ TQString objClass, objName;
objClass = e.tagName();
- TTQString qlayout = "TQt::VBoxLayout.new";
+ TQString qlayout = "TQt::VBoxLayout.new";
if ( objClass == "hbox" )
qlayout = "TQt::HBoxLayout.new";
else if ( objClass == "grid" )
@@ -796,11 +796,11 @@ TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parent
objName = registerObject( getLayoutName( e ) );
layoutObjects += objName;
- TTQString margin = DomTool::readProperty( e, "margin", defMargin ).toString();
- TTQString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString();
- TTQString resizeMode = DomTool::readProperty( e, "resizeMode", TTQString::null ).toString();
+ TQString margin = DomTool::readProperty( e, "margin", defMargin ).toString();
+ TQString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString();
+ TQString resizeMode = DomTool::readProperty( e, "resizeMode", TQString::null ).toString();
- TTQString optcells;
+ TQString optcells;
if ( isGrid )
optcells = "1, 1, ";
if ( (parentClass == "TQt::GroupBox" || parentClass == "TQt::ButtonGroup") && layout.isEmpty() ) {
@@ -827,10 +827,10 @@ TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parent
if ( !isGrid ) {
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "spacer" ) {
- TTQString child = createSpacerImpl( n, parentClass, parent, objName );
+ TQString child = createSpacerImpl( n, parentClass, parent, objName );
out << indent << objName << ".addItem(" << child << ")" << endl;
} else if ( tags.contains( n.tagName() ) ) {
- TTQString child = createObjectImpl( n, parentClass, parent, objName );
+ TQString child = createObjectImpl( n, parentClass, parent, objName );
if ( isLayout( child ) )
out << indent << objName << ".addLayout(" << child << ")" << endl;
else
@@ -839,7 +839,7 @@ TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parent
}
} else {
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
- TTQDomElement ae = n;
+ TQDomElement ae = n;
int row = ae.attribute( "row" ).toInt();
int col = ae.attribute( "column" ).toInt();
int rowspan = ae.attribute( "rowspan" ).toInt();
@@ -849,7 +849,7 @@ TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parent
if ( colspan < 1 )
colspan = 1;
if ( n.tagName() == "spacer" ) {
- TTQString child = createSpacerImpl( n, parentClass, parent, objName );
+ TQString child = createSpacerImpl( n, parentClass, parent, objName );
if ( rowspan * colspan != 1 )
out << indent << objName << ".addMultiCell(" << child << ", "
<< row << ", " << row + rowspan - 1 << ", " << col << ", " << col + colspan - 1 << ")" << endl;
@@ -857,9 +857,9 @@ TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parent
out << indent << objName << ".addItem(" << child << ", "
<< row << ", " << col << ")" << endl;
} else if ( tags.contains( n.tagName() ) ) {
- TTQString child = createObjectImpl( n, parentClass, parent, objName );
+ TQString child = createObjectImpl( n, parentClass, parent, objName );
out << endl;
- TTQString o = "Widget";
+ TQString o = "Widget";
if ( isLayout( child ) )
o = "Layout";
if ( rowspan * colspan != 1 )
@@ -877,20 +877,20 @@ TTQString Uic::createLayoutImpl( const TTQDomElement &e, const TTQString& parent
-TTQString Uic::createSpacerImpl( const TTQDomElement &e, const TTQString& /*parentClass*/, const TTQString& /*parent*/, const TTQString& /*layout*/)
+TQString Uic::createSpacerImpl( const TQDomElement &e, const TQString& /*parentClass*/, const TQString& /*parent*/, const TQString& /*layout*/)
{
- TTQDomElement n;
- TTQString objClass, objName;
+ TQDomElement n;
+ TQString objClass, objName;
objClass = e.tagName();
objName = registerObject( getObjectName( e ) );
- TTQSize size = DomTool::readProperty( e, "sizeHint", TTQSize( 0, 0 ) ).toSize();
- TTQString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString();
+ TQSize size = DomTool::readProperty( e, "sizeHint", TQSize( 0, 0 ) ).toSize();
+ TQString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString();
bool isVspacer = DomTool::readProperty( e, "orientation", "Horizontal" ) == "Vertical";
if ( sizeType != "Expanding" && sizeType != "MinimumExpanding" &&
DomTool::hasProperty( e, "geometry" ) ) { // compatibility Qt 2.2
- TTQRect geom = DomTool::readProperty( e, "geometry", TTQRect(0,0,0,0) ).toRect();
+ TQRect geom = DomTool::readProperty( e, "geometry", TQRect(0,0,0,0) ).toRect();
size = geom.size();
}
@@ -916,16 +916,16 @@ static const char* const ColorRole[] = {
/*!
Creates a colorgroup with name \a name from the color group \a cg
*/
-void Uic::createColorGroupImpl( const TTQString& name, const TTQDomElement& e )
+void Uic::createColorGroupImpl( const TQString& name, const TQDomElement& e )
{
- TTQColorGroup cg;
+ TQColorGroup cg;
int r = -1;
- TTQDomElement n = e.firstChild().toElement();
- TTQString color;
+ TQDomElement n = e.firstChild().toElement();
+ TQString color;
while ( !n.isNull() ) {
if ( n.tagName() == "color" ) {
r++;
- TTQColor col = DomTool::readColor( n );
+ TQColor col = DomTool::readColor( n );
color = "TQt::Color.new(%1,%2,%3)";
color = color.arg( col.red() ).arg( col.green() ).arg( col.blue() );
if ( col == white )
@@ -936,11 +936,11 @@ void Uic::createColorGroupImpl( const TTQString& name, const TTQDomElement& e )
out << indent << name << ".setColor(TQt::ColorGroup::" << ColorRole[r] << ", " << color << ")" << endl;
}
} else if ( n.tagName() == "pixmap" ) {
- TTQString pixmap = n.firstChild().toText().data();
+ TQString pixmap = n.firstChild().toText().data();
pixmap.prepend("@");
if ( !pixmapLoaderFunction.isEmpty() ) {
- pixmap.prepend( pixmapLoaderFunction + "(" + TTQString( externPixmaps ? "\"" : "" ) );
- pixmap.append( TTQString( externPixmaps ? "\"" : "" ) + ")" );
+ pixmap.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) );
+ pixmap.append( TQString( externPixmaps ? "\"" : "" ) + ")" );
}
out << indent << name << ".setBrush(TQt::ColorGroup::"
<< ColorRole[r] << ", TQt::Brush.new(" << color << ", " << pixmap << "))" << endl;
@@ -953,16 +953,16 @@ void Uic::createColorGroupImpl( const TTQString& name, const TTQDomElement& e )
Auxiliary function to load a color group. The colorgroup must not
contain pixmaps.
*/
-TTQColorGroup Uic::loadColorGroup( const TTQDomElement &e )
+TQColorGroup Uic::loadColorGroup( const TQDomElement &e )
{
- TTQColorGroup cg;
+ TQColorGroup cg;
int r = -1;
- TTQDomElement n = e.firstChild().toElement();
- TTQColor col;
+ TQDomElement n = e.firstChild().toElement();
+ TQColor col;
while ( !n.isNull() ) {
if ( n.tagName() == "color" ) {
r++;
- cg.setColor( (TTQColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) );
+ cg.setColor( (TQColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) );
}
n = n.nextSibling().toElement();
}
@@ -973,10 +973,10 @@ TTQColorGroup Uic::loadColorGroup( const TTQDomElement &e )
the database \a connection and \a table.
*/
-bool Uic::isWidgetInTable( const TTQDomElement& e, const TTQString& connection, const TTQString& table )
+bool Uic::isWidgetInTable( const TQDomElement& e, const TQString& connection, const TQString& table )
{
- TTQString conn = getDatabaseInfo( e, "connection" );
- TTQString tab = getDatabaseInfo( e, "table" );
+ TQString conn = getDatabaseInfo( e, "connection" );
+ TQString tab = getDatabaseInfo( e, "table" );
if ( conn == connection && tab == table )
return true;
return false;
@@ -986,17 +986,17 @@ bool Uic::isWidgetInTable( const TTQDomElement& e, const TTQString& connection,
Registers all database connections, cursors and forms.
*/
-void Uic::registerDatabases( const TTQDomElement& e )
+void Uic::registerDatabases( const TQDomElement& e )
{
- TTQDomElement n;
- TTQDomNodeList nl;
+ TQDomElement n;
+ TQDomNodeList nl;
int i;
nl = e.parentNode().toElement().elementsByTagName( "widget" );
for ( i = 0; i < (int) nl.length(); ++i ) {
n = nl.item(i).toElement();
- TTQString conn = getDatabaseInfo( n, "connection" );
- TTQString tab = getDatabaseInfo( n, "table" );
- TTQString fld = getDatabaseInfo( n, "field" );
+ TQString conn = getDatabaseInfo( n, "connection" );
+ TQString tab = getDatabaseInfo( n, "table" );
+ TQString fld = getDatabaseInfo( n, "field" );
if ( !conn.isNull() ) {
dbConnections += conn;
if ( !tab.isNull() ) {
@@ -1016,7 +1016,7 @@ void Uic::registerDatabases( const TTQDomElement& e )
\sa registeredName(), isObjectRegistered()
*/
-TTQString Uic::registerObject( const TTQString& name )
+TQString Uic::registerObject( const TQString& name )
{
if ( objectNames.isEmpty() ) {
// some temporary variables we need
@@ -1025,7 +1025,7 @@ TTQString Uic::registerObject( const TTQString& name )
objectNames += "cg";
objectNames += "pal";
}
- TTQString result("@");
+ TQString result("@");
result += name;
int i;
while ( ( i = result.find(' ' )) != -1 ) {
@@ -1034,10 +1034,10 @@ TTQString Uic::registerObject( const TTQString& name )
if ( objectNames.contains( result ) ) {
int i = 2;
- while ( objectNames.contains( result + "_" + TTQString::number(i) ) )
+ while ( objectNames.contains( result + "_" + TQString::number(i) ) )
i++;
result += "_";
- result += TTQString::number(i);
+ result += TQString::number(i);
}
objectNames += result;
objectMapper.insert( name, result );
@@ -1050,7 +1050,7 @@ TTQString Uic::registerObject( const TTQString& name )
\sa registerObject(), isObjectRegistered()
*/
-TTQString Uic::registeredName( const TTQString& name )
+TQString Uic::registeredName( const TQString& name )
{
if ( !objectMapper.contains( name ) )
return name;
@@ -1060,24 +1060,24 @@ TTQString Uic::registeredName( const TTQString& name )
/*!
Returns whether the object \a name was registered yet or not.
*/
-bool Uic::isObjectRegistered( const TTQString& name )
+bool Uic::isObjectRegistered( const TQString& name )
{
return objectMapper.contains( name );
}
/*!
- Unifies the entries in stringlist \a list. Should really be a TTQStringList feature.
+ Unifies the entries in stringlist \a list. Should really be a TQStringList feature.
*/
-TTQStringList Uic::unique( const TTQStringList& list )
+TQStringList Uic::unique( const TQStringList& list )
{
- TTQStringList result;
+ TQStringList result;
if ( list.isEmpty() )
return result;
- TTQStringList l = list;
+ TQStringList l = list;
l.sort();
result += l.first();
- for ( TTQStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
+ for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
if ( *it != result.last() )
result += *it;
}
@@ -1089,7 +1089,7 @@ TTQStringList Uic::unique( const TTQStringList& list )
/*!
Creates an instance of class \a objClass, with parent \a parent and name \a objName
*/
-TTQString Uic::createObjectInstance( const TTQString& objClass, const TTQString& parent, const TTQString& objName )
+TQString Uic::createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName )
{
if ( objClass.mid( 4 ) == "ComboBox" ) {
@@ -1098,7 +1098,7 @@ TTQString Uic::createObjectInstance( const TTQString& objClass, const TTQString&
return objClass + ".new(" + parent + ", \"" + objName.mid(1) + "\")";
}
-bool Uic::isLayout( const TTQString& name ) const
+bool Uic::isLayout( const TQString& name ) const
{
return layoutObjects.contains( name );
}