diff options
Diffstat (limited to 'kexi/formeditor/formIO.cpp')
-rw-r--r-- | kexi/formeditor/formIO.cpp | 910 |
1 files changed, 455 insertions, 455 deletions
diff --git a/kexi/formeditor/formIO.cpp b/kexi/formeditor/formIO.cpp index 2327fb91..4b46f8fe 100644 --- a/kexi/formeditor/formIO.cpp +++ b/kexi/formeditor/formIO.cpp @@ -20,18 +20,18 @@ #include <kdebug.h> -#include <qmetaobject.h> -#include <qdom.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qcursor.h> -#include <qbuffer.h> -#include <qimage.h> -#include <qlayout.h> -#include <qobjectlist.h> -#include <qdatetime.h> -#include <qlabel.h> -#include <qpainter.h> +#include <tqmetaobject.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqcursor.h> +#include <tqbuffer.h> +#include <tqimage.h> +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqdatetime.h> +#include <tqlabel.h> +#include <tqpainter.h> #include <kfiledialog.h> #include <klocale.h> @@ -52,10 +52,10 @@ #include "formIO.h" /// A blank widget used when the class name is not supported -CustomWidget::CustomWidget(const QCString &className, QWidget *parent, const char *name) -: QWidget(parent, name), m_className(className) +CustomWidget::CustomWidget(const TQCString &className, TQWidget *tqparent, const char *name) +: TQWidget(tqparent, name), m_className(className) { - setBackgroundMode(Qt::PaletteDark); + setBackgroundMode(TQt::PaletteDark); } CustomWidget::~CustomWidget() @@ -63,18 +63,18 @@ CustomWidget::~CustomWidget() } void -CustomWidget::paintEvent(QPaintEvent *) +CustomWidget::paintEvent(TQPaintEvent *) { - QPainter p(this); - p.setPen(palette().active().text()); - QRect r(rect()); + TQPainter p(this); + p.setPen(tqpalette().active().text()); + TQRect r(rect()); r.setX(r.x()+2); - p.drawText(r, Qt::AlignTop, m_className); + p.drawText(r, TQt::AlignTop, m_className); } using namespace KFormDesigner; -QDict<QLabel> *FormIO::m_buddies = 0; +TQDict<TQLabel> *FormIO::m_buddies = 0; ObjectTreeItem *FormIO::m_currentItem = 0; Form *FormIO::m_currentForm = 0; bool FormIO::m_savePixmapsInline = false; @@ -99,15 +99,15 @@ FormIO::~FormIO() } bool -FormIO::saveFormToFile(Form *form, const QString &filename) +FormIO::saveFormToFile(Form *form, const TQString &filename) { - QString m_filename; + TQString m_filename; if(!form->filename().isNull() && filename.isNull()) m_filename = form->filename(); if(filename.isNull()) { - m_filename = KFileDialog::getSaveFileName(QString::null, i18n("*.ui|Qt Designer UI Files")); + m_filename = KFileDialog::getSaveFileName(TQString(), i18n("*.ui|TQt Designer UI Files")); if(m_filename.isNull()) return false; } @@ -115,15 +115,15 @@ FormIO::saveFormToFile(Form *form, const QString &filename) m_filename = filename; form->setFilename(m_filename); - QDomDocument domDoc; + TQDomDocument domDoc; if (!saveFormToDom(form, domDoc)) return false; - QFile file(m_filename); + TQFile file(m_filename); if (!file.open(IO_WriteOnly)) return false; - QTextStream stream(&file); + TQTextStream stream(&file); stream << domDoc.toString(3) << endl; file.close(); @@ -131,9 +131,9 @@ FormIO::saveFormToFile(Form *form, const QString &filename) } bool -FormIO::saveFormToByteArray(Form *form, QByteArray &dest) +FormIO::saveFormToByteArray(Form *form, TQByteArray &dest) { - QDomDocument domDoc; + TQDomDocument domDoc; if (!saveFormToDom(form, domDoc)) return false; dest = domDoc.toCString(); @@ -141,9 +141,9 @@ FormIO::saveFormToByteArray(Form *form, QByteArray &dest) } bool -FormIO::saveFormToString(Form *form, QString &dest, int indent) +FormIO::saveFormToString(Form *form, TQString &dest, int indent) { - QDomDocument domDoc; + TQDomDocument domDoc; if (!saveFormToDom(form, domDoc)) return false; dest = domDoc.toString(indent); @@ -151,54 +151,54 @@ FormIO::saveFormToString(Form *form, QString &dest, int indent) } bool -FormIO::saveFormToDom(Form *form, QDomDocument &domDoc) +FormIO::saveFormToDom(Form *form, TQDomDocument &domDoc) { m_currentForm = form; - domDoc = QDomDocument("UI"); - QDomElement uiElement = domDoc.createElement("UI"); + domDoc = TQDomDocument("UI"); + TQDomElement uiElement = domDoc.createElement("UI"); domDoc.appendChild(uiElement); uiElement.setAttribute("version", "3.1"); uiElement.setAttribute("stdsetdef", 1); //update format version information - form->headerProperties()->insert("version", QString::number(form->formatVersion())); + form->headerProperties()->insert("version", TQString::number(form->formatVersion())); //custom properties - QDomElement headerPropertiesEl = domDoc.createElement("kfd:customHeader"); - for (QMapConstIterator<QCString,QString> it=form->headerProperties()->constBegin(); it!=form->headerProperties()->constEnd(); ++it) { + TQDomElement headerPropertiesEl = domDoc.createElement("kfd:customHeader"); + for (TQMapConstIterator<TQCString,TQString> it=form->headerProperties()->constBegin(); it!=form->headerProperties()->constEnd(); ++it) { headerPropertiesEl.setAttribute(it.key(), it.data()); } uiElement.appendChild(headerPropertiesEl); /// We save the savePixmapsInline property in the Form - QDomElement inlinePix = domDoc.createElement("pixmapinproject"); + TQDomElement inlinePix = domDoc.createElement("pixmapinproject"); uiElement.appendChild(inlinePix); // We create the top class element - QDomElement baseClass = domDoc.createElement("class"); + TQDomElement baseClass = domDoc.createElement("class"); uiElement.appendChild(baseClass); - QDomText baseClassV = domDoc.createTextNode("QWidget"); + TQDomText baseClassV = domDoc.createTextNode(TQWIDGET_OBJECT_NAME_STRING); baseClass.appendChild(baseClassV); // Save the toplevel widgets, and so the whole Form saveWidget(form->objectTree(), uiElement, domDoc); - // We then save the layoutdefaults element - QDomElement layoutDefaults = domDoc.createElement("layoutDefaults"); - layoutDefaults.setAttribute("spacing", QString::number(form->defaultSpacing())); - layoutDefaults.setAttribute("margin", QString::number(form->defaultMargin())); - uiElement.appendChild(layoutDefaults); + // We then save the tqlayoutdefaults element + TQDomElement tqlayoutDefaults = domDoc.createElement("tqlayoutDefaults"); + tqlayoutDefaults.setAttribute("spacing", TQString::number(form->defaultSpacing())); + tqlayoutDefaults.setAttribute("margin", TQString::number(form->defaultMargin())); + uiElement.appendChild(tqlayoutDefaults); /// Save tab Stops if(form->autoTabStops()) form->autoAssignTabStops(); - QDomElement tabStops = domDoc.createElement("tabstops"); + TQDomElement tabStops = domDoc.createElement("tabstops"); uiElement.appendChild(tabStops); for(ObjectTreeListIterator it( form->tabStopsIterator() ); it.current(); ++it) { - QDomElement tabstop = domDoc.createElement("tabstop"); + TQDomElement tabstop = domDoc.createElement("tabstop"); tabStops.appendChild(tabstop); - QDomText tabStopText = domDoc.createTextNode(it.current()->name()); + TQDomText tabStopText = domDoc.createTextNode(it.current()->name()); tabstop.appendChild(tabStopText); } @@ -217,13 +217,13 @@ FormIO::saveFormToDom(Form *form, QDomDocument &domDoc) } bool -FormIO::loadFormFromByteArray(Form *form, QWidget *container, QByteArray &src, bool preview) +FormIO::loadFormFromByteArray(Form *form, TQWidget *container, TQByteArray &src, bool preview) { - QString errMsg; + TQString errMsg; int errLine; int errCol; - QDomDocument inBuf; + TQDomDocument inBuf; bool parsed = inBuf.setContent(src, false, &errMsg, &errLine, &errCol); if(!parsed) @@ -241,9 +241,9 @@ FormIO::loadFormFromByteArray(Form *form, QWidget *container, QByteArray &src, b } bool -FormIO::loadFormFromString(Form *form, QWidget *container, QString &src, bool preview) +FormIO::loadFormFromString(Form *form, TQWidget *container, TQString &src, bool preview) { - QString errMsg; + TQString errMsg; int errLine; int errCol; @@ -251,7 +251,7 @@ FormIO::loadFormFromString(Form *form, QWidget *container, QString &src, bool pr form->m_recentlyLoadedUICode = src; #endif - QDomDocument inBuf; + TQDomDocument inBuf; bool parsed = inBuf.setContent(src, false, &errMsg, &errLine, &errCol); if(!parsed) @@ -269,32 +269,32 @@ FormIO::loadFormFromString(Form *form, QWidget *container, QString &src, bool pr } bool -FormIO::loadFormFromFile(Form *form, QWidget *container, const QString &filename) +FormIO::loadFormFromFile(Form *form, TQWidget *container, const TQString &filename) { - QString errMsg; + TQString errMsg; int errLine; int errCol; - QString m_filename; + TQString m_filename; if(filename.isNull()) { - m_filename = KFileDialog::getOpenFileName(QString::null, i18n("*.ui|Qt Designer UI Files")); + m_filename = KFileDialog::getOpenFileName(TQString(), i18n("*.ui|TQt Designer UI Files")); if(m_filename.isNull()) return false; } else m_filename = filename; - QFile file(m_filename); + TQFile file(m_filename); if(!file.open(IO_ReadOnly)) { kdDebug() << "Cannot open the file " << filename << endl; return false; } - QTextStream stream(&file); - QString text = stream.read(); + TQTextStream stream(&file); + TQString text = stream.read(); - QDomDocument inBuf; + TQDomDocument inBuf; bool parsed = inBuf.setContent(text, false, &errMsg, &errLine, &errCol); if(!parsed) @@ -308,23 +308,23 @@ FormIO::loadFormFromFile(Form *form, QWidget *container, const QString &filename } bool -FormIO::loadFormFromDom(Form *form, QWidget *container, QDomDocument &inBuf) +FormIO::loadFormFromDom(Form *form, TQWidget *container, TQDomDocument &inBuf) { m_currentForm = form; - QDomElement ui = inBuf.namedItem("UI").toElement(); + TQDomElement ui = inBuf.namedItem("UI").toElement(); //custom properties form->headerProperties()->clear(); - QDomElement headerPropertiesEl = ui.namedItem("kfd:customHeader").toElement(); - QDomAttr attr = headerPropertiesEl.firstChild().toAttr(); + TQDomElement headerPropertiesEl = ui.namedItem("kfd:customHeader").toElement(); + TQDomAttr attr = headerPropertiesEl.firstChild().toAttr(); while (!attr.isNull() && attr.isAttr()) { form->headerProperties()->insert(attr.name().latin1(), attr.value()); attr = attr.nextSibling().toAttr(); } //update format version information uint ver = 1; //the default - if (form->headerProperties()->contains("version")) { + if (form->headerProperties()->tqcontains("version")) { bool ok; uint v = (*form->headerProperties())["version"].toUInt(&ok); if (ok) @@ -350,26 +350,26 @@ FormIO::loadFormFromDom(Form *form, QWidget *container, QDomDocument &inBuf) m_savePixmapsInline = ( (ui.namedItem("pixmapinproject").isNull()) || (!ui.namedItem("images").isNull()) ); form->pixmapCollection()->load(ui.namedItem("collection")); - QDomElement element = ui.namedItem("widget").toElement(); + TQDomElement element = ui.namedItem("widget").toElement(); createToplevelWidget(form, container, element); // Loading the tabstops - QDomElement tabStops = ui.namedItem("tabstops").toElement(); + TQDomElement tabStops = ui.namedItem("tabstops").toElement(); // if(tabStops.isNull()) // return 1; if(!tabStops.isNull()) { int i = 0; uint itemsNotFound = 0; - for(QDomNode n = tabStops.firstChild(); !n.isNull(); n = n.nextSibling(), i++) + for(TQDomNode n = tabStops.firstChild(); !n.isNull(); n = n.nextSibling(), i++) { - QString name = n.toElement().text(); + TQString name = n.toElement().text(); ObjectTreeItem *item = form->objectTree()->lookup(name); if(!item) { kdDebug() << "FormIO::loadFormFromDom ERROR : no ObjectTreeItem " << endl; continue; } - const int index = form->tabStops()->findRef(item); + const int index = form->tabStops()->tqfindRef(item); /* Compute a real destination index: "a number of not found items so far". */ const int realIndex = i - itemsNotFound; if((index != -1) && (index != realIndex)) // the widget is not in the same place, so we move it @@ -398,32 +398,32 @@ FormIO::loadFormFromDom(Form *form, QWidget *container, QDomDocument &inBuf) ///////////////////////////////////////////////////////////////////////////// void -FormIO::savePropertyValue(QDomElement &parentNode, QDomDocument &parent, const char *name, - const QVariant &value, QWidget *w, WidgetLibrary *lib) +FormIO::savePropertyValue(TQDomElement &tqparentNode, TQDomDocument &tqparent, const char *name, + const TQVariant &value, TQWidget *w, WidgetLibrary *lib) { // Widget specific properties and attributes /////////////// // kdDebug() << "FormIO::savePropertyValue() Saving the property: " << name << endl; WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(w); - QWidget *subwidget = w; + TQWidget *subwidget = w; bool addSubwidgetFlag = false; - int propertyId = w->metaObject()->findProperty(name, true); + int propertyId = w->tqmetaObject()->tqfindProperty(name, true); if (propertyId == -1 && subpropIface && subpropIface->subwidget()) { // try property from subwidget subwidget = subpropIface->subwidget(); - propertyId = subpropIface->subwidget()->metaObject()->findProperty(name, true); + propertyId = subpropIface->subwidget()->tqmetaObject()->tqfindProperty(name, true); addSubwidgetFlag = true; } if(propertyId == -1) { kdDebug() << "FormIO::savePropertyValue() The object doesn't have this property. Let's try the WidgetLibrary." << endl; if(lib) - lib->saveSpecialProperty(w->className(), name, value, w, parentNode, parent); + lib->saveSpecialProperty(w->className(), name, value, w, tqparentNode, tqparent); return; } - const QMetaProperty *meta = subwidget->metaObject()->property(propertyId, true); + const TQMetaProperty *meta = subwidget->tqmetaObject()->property(propertyId, true); if (!meta->stored( subwidget )) //not storable return; - QDomElement propertyE = parent.createElement("property"); + TQDomElement propertyE = tqparent.createElement("property"); propertyE.setAttribute("name", name); if (addSubwidgetFlag) propertyE.setAttribute("subwidget", "true"); @@ -431,81 +431,81 @@ FormIO::savePropertyValue(QDomElement &parentNode, QDomDocument &parent, const c if(meta && meta->isEnumType()) { // this property is enum or set type - QDomElement type; - QDomText valueE; + TQDomElement type; + TQDomText valueE; if(meta->isSetType()) { - QStringList list = QStringList::fromStrList(meta->valueToKeys(value.toInt())); - type = parent.createElement("set"); - valueE = parent.createTextNode(list.join("|")); + TQStringList list = TQStringList::fromStrList(meta->valueToKeys(value.toInt())); + type = tqparent.createElement("set"); + valueE = tqparent.createTextNode(list.join("|")); type.appendChild(valueE); } else { - QString s = meta->valueToKey(value.toInt()); - type = parent.createElement("enum"); - valueE = parent.createTextNode(s); + TQString s = meta->valueToKey(value.toInt()); + type = tqparent.createElement("enum"); + valueE = tqparent.createTextNode(s); type.appendChild(valueE); } propertyE.appendChild(type); - parentNode.appendChild(propertyE); + tqparentNode.appendChild(propertyE); return; } - if(value.type() == QVariant::Pixmap) { - QDomText valueE; - QDomElement type = parent.createElement("pixmap"); - QCString property = propertyE.attribute("name").latin1(); -//todo QCString pixmapName = m_currentItem->widget()->property("pixmapName").toCString(); + if(value.type() == TQVariant::Pixmap) { + TQDomText valueE; + TQDomElement type = tqparent.createElement("pixmap"); + TQCString property = propertyE.attribute("name").latin1(); +//todo TQCString pixmapName = m_currentItem->widget()->property("pixmapName").toCString(); if(m_savePixmapsInline /* (js)too risky: || m_currentItem->pixmapName(property).isNull() */) - valueE = parent.createTextNode(saveImage(parent, value.toPixmap())); + valueE = tqparent.createTextNode(saveImage(tqparent, value.toPixmap())); else - valueE = parent.createTextNode(m_currentItem->pixmapName(property)); + valueE = tqparent.createTextNode(m_currentItem->pixmapName(property)); type.appendChild(valueE); propertyE.appendChild(type); - parentNode.appendChild(propertyE); + tqparentNode.appendChild(propertyE); return; } // Saving a "normal" property - writeVariant(parent, propertyE, value); - parentNode.appendChild(propertyE); + writeVariant(tqparent, propertyE, value); + tqparentNode.appendChild(propertyE); } void -FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant value) +FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &tqparentNode, TQVariant value) { - QDomElement type; - QDomText valueE; + TQDomElement type; + TQDomText valueE; switch(value.type()) { - case QVariant::String: + case TQVariant::String: { - type = parent.createElement("string"); - valueE = parent.createTextNode(value.toString()); + type = tqparent.createElement("string"); + valueE = tqparent.createTextNode(value.toString()); type.appendChild(valueE); break; } - case QVariant::CString: + case TQVariant::CString: { - type = parent.createElement("cstring"); - valueE = parent.createTextNode(value.toString()); + type = tqparent.createElement("cstring"); + valueE = tqparent.createTextNode(value.toString()); type.appendChild(valueE); break; } - case QVariant::Rect: + case TQVariant::Rect: { - type = parent.createElement("rect"); - QDomElement x = parent.createElement("x"); - QDomElement y = parent.createElement("y"); - QDomElement w = parent.createElement("width"); - QDomElement h = parent.createElement("height"); - QDomText valueX = parent.createTextNode(QString::number(value.toRect().x())); - QDomText valueY = parent.createTextNode(QString::number(value.toRect().y())); - QDomText valueW = parent.createTextNode(QString::number(value.toRect().width())); - QDomText valueH = parent.createTextNode(QString::number(value.toRect().height())); + type = tqparent.createElement("rect"); + TQDomElement x = tqparent.createElement("x"); + TQDomElement y = tqparent.createElement("y"); + TQDomElement w = tqparent.createElement("width"); + TQDomElement h = tqparent.createElement("height"); + TQDomText valueX = tqparent.createTextNode(TQString::number(value.toRect().x())); + TQDomText valueY = tqparent.createTextNode(TQString::number(value.toRect().y())); + TQDomText valueW = tqparent.createTextNode(TQString::number(value.toRect().width())); + TQDomText valueH = tqparent.createTextNode(TQString::number(value.toRect().height())); x.appendChild(valueX); y.appendChild(valueY); @@ -518,15 +518,15 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(h); break; } - case QVariant::Color: + case TQVariant::Color: { - type = parent.createElement("color"); - QDomElement r = parent.createElement("red"); - QDomElement g = parent.createElement("green"); - QDomElement b = parent.createElement("blue"); - QDomText valueR = parent.createTextNode(QString::number(value.toColor().red())); - QDomText valueG = parent.createTextNode(QString::number(value.toColor().green())); - QDomText valueB = parent.createTextNode(QString::number(value.toColor().blue())); + type = tqparent.createElement("color"); + TQDomElement r = tqparent.createElement("red"); + TQDomElement g = tqparent.createElement("green"); + TQDomElement b = tqparent.createElement("blue"); + TQDomText valueR = tqparent.createTextNode(TQString::number(value.toColor().red())); + TQDomText valueG = tqparent.createTextNode(TQString::number(value.toColor().green())); + TQDomText valueB = tqparent.createTextNode(TQString::number(value.toColor().blue())); r.appendChild(valueR); g.appendChild(valueG); @@ -537,29 +537,29 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(b); break; } - case QVariant::Bool: + case TQVariant::Bool: { - type = parent.createElement("bool"); - //valueE = parent.createTextNode(QString::number(value.toBool())); - valueE = parent.createTextNode(value.toBool() ? "true" : "false"); + type = tqparent.createElement("bool"); + //valueE = tqparent.createTextNode(TQString::number(value.toBool())); + valueE = tqparent.createTextNode(value.toBool() ? "true" : "false"); type.appendChild(valueE); break; } - case QVariant::Int: - case QVariant::UInt: + case TQVariant::Int: + case TQVariant::UInt: { - type = parent.createElement("number"); - valueE = parent.createTextNode(QString::number(value.toInt())); + type = tqparent.createElement("number"); + valueE = tqparent.createTextNode(TQString::number(value.toInt())); type.appendChild(valueE); break; } - case QVariant::Size: + case TQVariant::Size: { - type = parent.createElement("size"); - QDomElement w = parent.createElement("width"); - QDomElement h = parent.createElement("height"); - QDomText valueW = parent.createTextNode(QString::number(value.toSize().width())); - QDomText valueH = parent.createTextNode(QString::number(value.toSize().height())); + type = tqparent.createElement("size"); + TQDomElement w = tqparent.createElement("width"); + TQDomElement h = tqparent.createElement("height"); + TQDomText valueW = tqparent.createTextNode(TQString::number(value.toSize().width())); + TQDomText valueH = tqparent.createTextNode(TQString::number(value.toSize().height())); w.appendChild(valueW); h.appendChild(valueH); @@ -568,13 +568,13 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(h); break; } - case QVariant::Point: + case TQVariant::Point: { - type = parent.createElement("point"); - QDomElement x = parent.createElement("x"); - QDomElement y = parent.createElement("y"); - QDomText valueX = parent.createTextNode(QString::number(value.toPoint().x())); - QDomText valueY = parent.createTextNode(QString::number(value.toPoint().y())); + type = tqparent.createElement("point"); + TQDomElement x = tqparent.createElement("x"); + TQDomElement y = tqparent.createElement("y"); + TQDomText valueX = tqparent.createTextNode(TQString::number(value.toPoint().x())); + TQDomText valueY = tqparent.createTextNode(TQString::number(value.toPoint().y())); x.appendChild(valueX); y.appendChild(valueY); @@ -583,23 +583,23 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(y); break; } - case QVariant::Font: + case TQVariant::Font: { - type = parent.createElement("font"); - QDomElement f = parent.createElement("family"); - QDomElement p = parent.createElement("pointsize"); - QDomElement w = parent.createElement("weight"); - QDomElement b = parent.createElement("bold"); - QDomElement i = parent.createElement("italic"); - QDomElement u = parent.createElement("underline"); - QDomElement s = parent.createElement("strikeout"); - QDomText valueF = parent.createTextNode(value.toFont().family()); - QDomText valueP = parent.createTextNode(QString::number(value.toFont().pointSize())); - QDomText valueW = parent.createTextNode(QString::number(value.toFont().weight())); - QDomText valueB = parent.createTextNode(QString::number(value.toFont().bold())); - QDomText valueI = parent.createTextNode(QString::number(value.toFont().italic())); - QDomText valueU = parent.createTextNode(QString::number(value.toFont().underline())); - QDomText valueS = parent.createTextNode(QString::number(value.toFont().strikeOut())); + type = tqparent.createElement("font"); + TQDomElement f = tqparent.createElement("family"); + TQDomElement p = tqparent.createElement("pointsize"); + TQDomElement w = tqparent.createElement("weight"); + TQDomElement b = tqparent.createElement("bold"); + TQDomElement i = tqparent.createElement("italic"); + TQDomElement u = tqparent.createElement("underline"); + TQDomElement s = tqparent.createElement("strikeout"); + TQDomText valueF = tqparent.createTextNode(value.toFont().family()); + TQDomText valueP = tqparent.createTextNode(TQString::number(value.toFont().pointSize())); + TQDomText valueW = tqparent.createTextNode(TQString::number(value.toFont().weight())); + TQDomText valueB = tqparent.createTextNode(TQString::number(value.toFont().bold())); + TQDomText valueI = tqparent.createTextNode(TQString::number(value.toFont().italic())); + TQDomText valueU = tqparent.createTextNode(TQString::number(value.toFont().underline())); + TQDomText valueS = tqparent.createTextNode(TQString::number(value.toFont().strikeOut())); f.appendChild(valueF); p.appendChild(valueP); @@ -618,24 +618,24 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(s); break; } - case QVariant::Cursor: + case TQVariant::Cursor: { - type = parent.createElement("cursor"); - valueE = parent.createTextNode(QString::number(value.toCursor().shape())); + type = tqparent.createElement("cursor"); + valueE = tqparent.createTextNode(TQString::number(value.toCursor().tqshape())); type.appendChild(valueE); break; } - case QVariant::SizePolicy: + case TQVariant::SizePolicy: { - type = parent.createElement("sizepolicy"); - QDomElement h = parent.createElement("hsizetype"); - QDomElement v = parent.createElement("vsizetype"); - QDomElement hs = parent.createElement("horstretch"); - QDomElement vs = parent.createElement("verstretch"); - QDomText valueH = parent.createTextNode(QString::number(value.toSizePolicy().horData())); - QDomText valueV = parent.createTextNode(QString::number(value.toSizePolicy().verData())); - QDomText valueHS = parent.createTextNode(QString::number(value.toSizePolicy().horStretch())); - QDomText valueVS = parent.createTextNode(QString::number(value.toSizePolicy().verStretch())); + type = tqparent.createElement("sizepolicy"); + TQDomElement h = tqparent.createElement("hsizetype"); + TQDomElement v = tqparent.createElement("vsizetype"); + TQDomElement hs = tqparent.createElement("horstretch"); + TQDomElement vs = tqparent.createElement("verstretch"); + TQDomText valueH = tqparent.createTextNode(TQString::number(value.toSizePolicy().horData())); + TQDomText valueV = tqparent.createTextNode(TQString::number(value.toSizePolicy().verData())); + TQDomText valueHS = tqparent.createTextNode(TQString::number(value.toSizePolicy().horStretch())); + TQDomText valueVS = tqparent.createTextNode(TQString::number(value.toSizePolicy().verStretch())); h.appendChild(valueH); v.appendChild(valueV); @@ -648,15 +648,15 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(vs); break; } - case QVariant::Time: + case TQVariant::Time: { - type = parent.createElement("time"); - QDomElement h = parent.createElement("hour"); - QDomElement m = parent.createElement("minute"); - QDomElement s = parent.createElement("second"); - QDomText valueH = parent.createTextNode(QString::number(value.toTime().hour())); - QDomText valueM = parent.createTextNode(QString::number(value.toTime().minute())); - QDomText valueS = parent.createTextNode(QString::number(value.toTime().second())); + type = tqparent.createElement("time"); + TQDomElement h = tqparent.createElement("hour"); + TQDomElement m = tqparent.createElement("minute"); + TQDomElement s = tqparent.createElement("second"); + TQDomText valueH = tqparent.createTextNode(TQString::number(value.toTime().hour())); + TQDomText valueM = tqparent.createTextNode(TQString::number(value.toTime().minute())); + TQDomText valueS = tqparent.createTextNode(TQString::number(value.toTime().second())); h.appendChild(valueH); m.appendChild(valueM); @@ -667,15 +667,15 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(s); break; } - case QVariant::Date: + case TQVariant::Date: { - type = parent.createElement("date"); - QDomElement y = parent.createElement("year"); - QDomElement m = parent.createElement("month"); - QDomElement d = parent.createElement("day"); - QDomText valueY = parent.createTextNode(QString::number(value.toDate().year())); - QDomText valueM = parent.createTextNode(QString::number(value.toDate().month())); - QDomText valueD = parent.createTextNode(QString::number(value.toDate().day())); + type = tqparent.createElement("date"); + TQDomElement y = tqparent.createElement("year"); + TQDomElement m = tqparent.createElement("month"); + TQDomElement d = tqparent.createElement("day"); + TQDomText valueY = tqparent.createTextNode(TQString::number(value.toDate().year())); + TQDomText valueM = tqparent.createTextNode(TQString::number(value.toDate().month())); + TQDomText valueD = tqparent.createTextNode(TQString::number(value.toDate().day())); y.appendChild(valueY); m.appendChild(valueM); @@ -686,21 +686,21 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val type.appendChild(d); break; } - case QVariant::DateTime: + case TQVariant::DateTime: { - type = parent.createElement("datetime"); - QDomElement h = parent.createElement("hour"); - QDomElement m = parent.createElement("minute"); - QDomElement s = parent.createElement("second"); - QDomElement y = parent.createElement("year"); - QDomElement mo = parent.createElement("month"); - QDomElement d = parent.createElement("day"); - QDomText valueH = parent.createTextNode(QString::number(value.toDateTime().time().hour())); - QDomText valueM = parent.createTextNode(QString::number(value.toDateTime().time().minute())); - QDomText valueS = parent.createTextNode(QString::number(value.toDateTime().time().second())); - QDomText valueY = parent.createTextNode(QString::number(value.toDateTime().date().year())); - QDomText valueMo = parent.createTextNode(QString::number(value.toDateTime().date().month())); - QDomText valueD = parent.createTextNode(QString::number(value.toDateTime().date().day())); + type = tqparent.createElement("datetime"); + TQDomElement h = tqparent.createElement("hour"); + TQDomElement m = tqparent.createElement("minute"); + TQDomElement s = tqparent.createElement("second"); + TQDomElement y = tqparent.createElement("year"); + TQDomElement mo = tqparent.createElement("month"); + TQDomElement d = tqparent.createElement("day"); + TQDomText valueH = tqparent.createTextNode(TQString::number(value.toDateTime().time().hour())); + TQDomText valueM = tqparent.createTextNode(TQString::number(value.toDateTime().time().minute())); + TQDomText valueS = tqparent.createTextNode(TQString::number(value.toDateTime().time().second())); + TQDomText valueY = tqparent.createTextNode(TQString::number(value.toDateTime().date().year())); + TQDomText valueMo = tqparent.createTextNode(TQString::number(value.toDateTime().date().month())); + TQDomText valueD = tqparent.createTextNode(TQString::number(value.toDateTime().date().day())); h.appendChild(valueH); m.appendChild(valueM); @@ -721,60 +721,60 @@ FormIO::writeVariant(QDomDocument &parent, QDomElement &parentNode, QVariant val break; } - parentNode.appendChild(type); + tqparentNode.appendChild(type); } void -FormIO::savePropertyElement(QDomElement &parentNode, QDomDocument &domDoc, const QString &tagName, const QString &property, const QVariant &value) +FormIO::savePropertyElement(TQDomElement &tqparentNode, TQDomDocument &domDoc, const TQString &tagName, const TQString &property, const TQVariant &value) { - QDomElement propertyE = domDoc.createElement(tagName); + TQDomElement propertyE = domDoc.createElement(tagName); propertyE.setAttribute("name", property); writeVariant(domDoc, propertyE, value); - parentNode.appendChild(propertyE); + tqparentNode.appendChild(propertyE); } -QVariant -FormIO::readPropertyValue(QDomNode node, QObject *obj, const QString &name) +TQVariant +FormIO::readPropertyValue(TQDomNode node, TQObject *obj, const TQString &name) { - QDomElement tag = node.toElement(); - QString text = tag.text(); - QString type = tag.tagName(); + TQDomElement tag = node.toElement(); + TQString text = tag.text(); + TQString type = tag.tagName(); if(type == "string" || type == "cstring") return text; else if(type == "rect") { - QDomElement x = node.namedItem("x").toElement(); - QDomElement y = node.namedItem("y").toElement(); - QDomElement w = node.namedItem("width").toElement(); - QDomElement h = node.namedItem("height").toElement(); + TQDomElement x = node.namedItem("x").toElement(); + TQDomElement y = node.namedItem("y").toElement(); + TQDomElement w = node.namedItem("width").toElement(); + TQDomElement h = node.namedItem("height").toElement(); int rx = x.text().toInt(); int ry = y.text().toInt(); int rw = w.text().toInt(); int rh = h.text().toInt(); - return QRect(rx, ry, rw, rh); + return TQRect(rx, ry, rw, rh); } else if(type == "color") { - QDomElement r = node.namedItem("red").toElement(); - QDomElement g = node.namedItem("green").toElement(); - QDomElement b = node.namedItem("blue").toElement(); + TQDomElement r = node.namedItem("red").toElement(); + TQDomElement g = node.namedItem("green").toElement(); + TQDomElement b = node.namedItem("blue").toElement(); int red = r.text().toInt(); int green = g.text().toInt(); int blue = b.text().toInt(); - return QColor(red, green, blue); + return TQColor(red, green, blue); } else if(type == "bool") { if(text == "true") - return QVariant(true, 3); + return TQVariant(true, 3); else if(text == "false") - return QVariant(false, 3); - return QVariant(text.toInt(), 3); + return TQVariant(false, 3); + return TQVariant(text.toInt(), 3); } else if(type == "number") { @@ -782,29 +782,29 @@ FormIO::readPropertyValue(QDomNode node, QObject *obj, const QString &name) } else if(type == "size") { - QDomElement w = node.namedItem("width").toElement(); - QDomElement h = node.namedItem("height").toElement(); + TQDomElement w = node.namedItem("width").toElement(); + TQDomElement h = node.namedItem("height").toElement(); - return QSize(w.text().toInt(), h.text().toInt()); + return TQSize(w.text().toInt(), h.text().toInt()); } else if(type == "point") { - QDomElement x = node.namedItem("x").toElement(); - QDomElement y = node.namedItem("y").toElement(); + TQDomElement x = node.namedItem("x").toElement(); + TQDomElement y = node.namedItem("y").toElement(); - return QPoint(x.text().toInt(), y.text().toInt()); + return TQPoint(x.text().toInt(), y.text().toInt()); } else if(type == "font") { - QDomElement fa = node.namedItem("family").toElement(); - QDomElement p = node.namedItem("pointsize").toElement(); - QDomElement w = node.namedItem("weight").toElement(); - QDomElement b = node.namedItem("bold").toElement(); - QDomElement i = node.namedItem("italic").toElement(); - QDomElement u = node.namedItem("underline").toElement(); - QDomElement s = node.namedItem("strikeout").toElement(); - - QFont f; + TQDomElement fa = node.namedItem("family").toElement(); + TQDomElement p = node.namedItem("pointsize").toElement(); + TQDomElement w = node.namedItem("weight").toElement(); + TQDomElement b = node.namedItem("bold").toElement(); + TQDomElement i = node.namedItem("italic").toElement(); + TQDomElement u = node.namedItem("underline").toElement(); + TQDomElement s = node.namedItem("strikeout").toElement(); + + TQFont f; f.setFamily(fa.text()); f.setPointSize(p.text().toInt()); f.setWeight(w.text().toInt()); @@ -817,77 +817,77 @@ FormIO::readPropertyValue(QDomNode node, QObject *obj, const QString &name) } else if(type == "cursor") { - return QCursor(text.toInt()); + return TQCursor(text.toInt()); } else if(type == "time") { - QDomElement h = node.namedItem("hour").toElement(); - QDomElement m = node.namedItem("minute").toElement(); - QDomElement s = node.namedItem("second").toElement(); + TQDomElement h = node.namedItem("hour").toElement(); + TQDomElement m = node.namedItem("minute").toElement(); + TQDomElement s = node.namedItem("second").toElement(); - return QTime(h.text().toInt(), m.text().toInt(), s.text().toInt()); + return TQTime(h.text().toInt(), m.text().toInt(), s.text().toInt()); } else if(type == "date") { - QDomElement y = node.namedItem("year").toElement(); - QDomElement m = node.namedItem("month").toElement(); - QDomElement d = node.namedItem("day").toElement(); + TQDomElement y = node.namedItem("year").toElement(); + TQDomElement m = node.namedItem("month").toElement(); + TQDomElement d = node.namedItem("day").toElement(); - return QDate(y.text().toInt(), m.text().toInt(), d.text().toInt()); + return TQDate(y.text().toInt(), m.text().toInt(), d.text().toInt()); } else if(type == "datetime") { - QDomElement h = node.namedItem("hour").toElement(); - QDomElement m = node.namedItem("minute").toElement(); - QDomElement s = node.namedItem("second").toElement(); - QDomElement y = node.namedItem("year").toElement(); - QDomElement mo = node.namedItem("month").toElement(); - QDomElement d = node.namedItem("day").toElement(); + TQDomElement h = node.namedItem("hour").toElement(); + TQDomElement m = node.namedItem("minute").toElement(); + TQDomElement s = node.namedItem("second").toElement(); + TQDomElement y = node.namedItem("year").toElement(); + TQDomElement mo = node.namedItem("month").toElement(); + TQDomElement d = node.namedItem("day").toElement(); - QTime t(h.text().toInt(), m.text().toInt(), s.text().toInt()); - QDate da(y.text().toInt(), mo.text().toInt(), d.text().toInt()); + TQTime t(h.text().toInt(), m.text().toInt(), s.text().toInt()); + TQDate da(y.text().toInt(), mo.text().toInt(), d.text().toInt()); - return QDateTime(da, t); + return TQDateTime(da, t); } else if(type == "sizepolicy") { - QDomElement h = node.namedItem("hsizetype").toElement(); - QDomElement v = node.namedItem("vsizetype").toElement(); - QDomElement hs = node.namedItem("horstretch").toElement(); - QDomElement vs = node.namedItem("verstretch").toElement(); - - QSizePolicy s; - s.setHorData((QSizePolicy::SizeType)h.text().toInt()); - s.setVerData((QSizePolicy::SizeType)v.text().toInt()); + TQDomElement h = node.namedItem("hsizetype").toElement(); + TQDomElement v = node.namedItem("vsizetype").toElement(); + TQDomElement hs = node.namedItem("horstretch").toElement(); + TQDomElement vs = node.namedItem("verstretch").toElement(); + + TQSizePolicy s; + s.setHorData((TQSizePolicy::SizeType)h.text().toInt()); + s.setVerData((TQSizePolicy::SizeType)v.text().toInt()); s.setHorStretch(hs.text().toInt()); s.setVerStretch(vs.text().toInt()); return s; } else if(type == "pixmap") { - if(m_savePixmapsInline || !m_currentForm || !m_currentItem || !m_currentForm->pixmapCollection()->contains(text)) + if(m_savePixmapsInline || !m_currentForm || !m_currentItem || !m_currentForm->pixmapCollection()->tqcontains(text)) return loadImage(tag.ownerDocument(), text); else { m_currentItem->setPixmapName(name.latin1(), text); return m_currentForm->pixmapCollection()->getPixmap(text); } - return QVariant(QPixmap()); + return TQVariant(TQPixmap()); } else if(type == "enum") return text; else if(type == "set") { WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(obj); - QObject *subobject = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : obj; - const int count = subobject->metaObject()->findProperty(name.latin1(), true); - const QMetaProperty *meta = count!=-1 ? subobject->metaObject()->property(count, true) : 0; + TQObject *subobject = (subpropIface && subpropIface->subwidget()) ? TQT_TQOBJECT(subpropIface->subwidget()) : obj; + const int count = subobject->tqmetaObject()->tqfindProperty(name.latin1(), true); + const TQMetaProperty *meta = count!=-1 ? subobject->tqmetaObject()->property(count, true) : 0; if (meta) { if (meta->isSetType()) { - QStrList keys; - const QStringList list( QStringList::split("|", text) ); - for (QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) + TQStrList keys; + const TQStringList list( TQStringList::split("|", text) ); + for (TQStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) keys.append((*it).latin1()); return meta->keysToValue(keys); @@ -898,10 +898,10 @@ FormIO::readPropertyValue(QDomNode node, QObject *obj, const QString &name) // We will return a string list here with hope that names will // be resolved and translated into an integer value later when subwidget is created, // e.g. near KexiFormView::updateValuesForSubproperties() - return QStringList::split("|", text); + return TQStringList::split("|", text); } } - return QVariant(); + return TQVariant(); } ///////////////////////////////////////////////////////////////////////////// @@ -909,7 +909,7 @@ FormIO::readPropertyValue(QDomNode node, QObject *obj, const QString &name) ///////////////////////////////////////////////////////////////////////////// void -FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domDoc, bool insideGridLayout) +FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument &domDoc, bool insideGridLayout) { if (!item) return; @@ -917,7 +917,7 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD // we let Spring class handle saving itself if(item->className() == "Spring") { - Spring::saveSpring(item, parent, domDoc, insideGridLayout); + Spring::saveSpring(item, tqparent, domDoc, insideGridLayout); return; } @@ -926,7 +926,7 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD if(!m_currentForm) // copying widget { resetCurrentForm = true; - m_currentForm = item->container() ? item->container()->form() : item->parent()->container()->form(); + m_currentForm = item->container() ? item->container()->form() : item->tqparent()->container()->form(); } @@ -934,11 +934,11 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD // if(item->container()) // lib = item->container()->form()->manager()->lib(); // else -// lib = item->parent()->container()->form()->manager()->lib(); +// lib = item->tqparent()->container()->form()->manager()->lib(); // We create the "widget" element - QDomElement tclass = domDoc.createElement("widget"); - parent.appendChild(tclass); + TQDomElement tclass = domDoc.createElement("widget"); + tqparent.appendChild(tclass); if(insideGridLayout) { @@ -951,12 +951,12 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD } } - if(!item->parent()) // Toplevel widget - tclass.setAttribute("class", "QWidget"); - // For compatibility, HBox, VBox and Grid are saved as "QLayoutWidget" + if(!item->tqparent()) // Toplevel widget + tclass.setAttribute("class", TQWIDGET_OBJECT_NAME_STRING); + // For compatibility, HBox, VBox and Grid are saved as TQLAYOUTWIDGET_OBJECT_NAME_STRING else if(item->widget()->isA("HBox") || item->widget()->isA("VBox") || item->widget()->isA("Grid") || item->widget()->isA("HFlow") || item->widget()->isA("VFlow")) - tclass.setAttribute("class", "QLayoutWidget"); + tclass.setAttribute("class", TQLAYOUTWIDGET_OBJECT_NAME_STRING); else if(item->widget()->isA("CustomWidget")) tclass.setAttribute("class", item->className()); else // Normal widgets @@ -964,42 +964,42 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD savePropertyValue(tclass, domDoc, "name", item->widget()->property("name"), item->widget()); - // Important: save dataSource property FIRST before properties like "alignment" + // Important: save dataSource property FIRST before properties like "tqalignment" // - needed when subproperties are defined after subwidget creation, and subwidget is created after setting "dataSource" // (this is the case for KexiDBAutoField) //! @todo more properties like "dataSource" may needed here... -// if (-1 != item->widget()->metaObject()->findProperty("dataSource")) +// if (-1 != item->widget()->tqmetaObject()->findProperty("dataSource")) // savePropertyValue(tclass, domDoc, "dataSource", item->widget()->property("dataSource"), item->widget()); - // We don't want to save the geometry if the widget is inside a layout (so parent.tagName() == "grid" for example) - if(item && !item->parent()) { + // We don't want to save the tqgeometry if the widget is inside a tqlayout (so tqparent.tagName() == "grid" for example) + if(item && !item->tqparent()) { // save form widget size, but not its position savePropertyValue(tclass, domDoc, "geometry", - QRect( QPoint(0,0), item->widget()->size()), + TQRect( TQPoint(0,0), item->widget()->size()), item->widget()); } // normal widget (if == "UI', it means we're copying widget) - else if(parent.tagName() == "widget" || parent.tagName() == "UI") + else if(tqparent.tagName() == "widget" || tqparent.tagName() == "UI") savePropertyValue(tclass, domDoc, "geometry", item->widget()->property("geometry"), item->widget()); // Save the buddy widget for a label - if(item->widget()->inherits("QLabel") && ((QLabel*)item->widget())->buddy()) - savePropertyElement(tclass, domDoc, "property", "buddy", ((QLabel*)item->widget())->buddy()->name()); + if(item->widget()->inherits(TQLABEL_OBJECT_NAME_STRING) && ((TQLabel*)item->widget())->buddy()) + savePropertyElement(tclass, domDoc, "property", "buddy", ((TQLabel*)item->widget())->buddy()->name()); // We save every property in the modifProp list of the ObjectTreeItem - QVariantMap *map = new QVariantMap( *(item->modifiedProperties()) ); - QMap<QString,QVariant>::ConstIterator endIt = map->constEnd(); - for(QMap<QString,QVariant>::ConstIterator it = map->constBegin(); it != endIt; ++it) + TQVariantMap *map = new TQVariantMap( *(item->modifiedProperties()) ); + TQMap<TQString,TQVariant>::ConstIterator endIt = map->constEnd(); + for(TQMap<TQString,TQVariant>::ConstIterator it = map->constBegin(); it != endIt; ++it) { - const QCString name( it.key().latin1() ); - if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "alignment") { + const TQCString name( it.key().latin1() ); + if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "tqalignment") { if(!savedAlignment) // not to save it twice { - savePropertyValue(tclass, domDoc, "alignment", item->widget()->property("alignment"), item->widget()); + savePropertyValue(tclass, domDoc, "tqalignment", item->widget()->property("tqalignment"), item->widget()); savedAlignment = true; } } - else if(name == "name" || name == "geometry" || name == "layout") { + else if(name == "name" || name == "geometry" || name == "tqlayout") { // these have already been saved } else { @@ -1010,87 +1010,87 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD delete map; if(item->widget()->isA("CustomWidget")) { - QDomDocument doc("TEMP"); + TQDomDocument doc("TEMP"); doc.setContent(item->m_unknownProps); - for(QDomNode n = doc.firstChild(); !n.isNull(); n = n.nextSibling()) { + for(TQDomNode n = doc.firstChild(); !n.isNull(); n = n.nextSibling()) { tclass.appendChild(n.cloneNode()); } } - // Saving container 's layout if there is one - QDomElement layout; - if(item->container() && item->container()->layoutType() != Container::NoLayout) + // Saving container 's tqlayout if there is one + TQDomElement tqlayout; + if(item->container() && item->container()->tqlayoutType() != Container::NoLayout) { - if(item->container()->layout()) // there is a layout + if(item->container()->tqlayout()) // there is a tqlayout { - layout = domDoc.createElement("temp"); - savePropertyValue(layout, domDoc, "name", "unnamed", item->widget()); - if(item->modifiedProperties()->contains("layoutMargin")) - savePropertyElement(layout, domDoc, "property", "margin", item->container()->layoutMargin()); - if(item->modifiedProperties()->contains("layoutSpacing")) - savePropertyElement(layout, domDoc, "property", "spacing", item->container()->layoutSpacing()); - tclass.appendChild(layout); + tqlayout = domDoc.createElement("temp"); + savePropertyValue(tqlayout, domDoc, "name", "unnamed", item->widget()); + if(item->modifiedProperties()->tqcontains("tqlayoutMargin")) + savePropertyElement(tqlayout, domDoc, "property", "margin", item->container()->tqlayoutMargin()); + if(item->modifiedProperties()->tqcontains("tqlayoutSpacing")) + savePropertyElement(tqlayout, domDoc, "property", "spacing", item->container()->tqlayoutSpacing()); + tclass.appendChild(tqlayout); } } - int layoutType = item->container() ? item->container()->layoutType() : Container::NoLayout; - switch(layoutType) { - case Container::Grid: // grid layout + int tqlayoutType = item->container() ? item->container()->tqlayoutType() : Container::NoLayout; + switch(tqlayoutType) { + case Container::Grid: // grid tqlayout { - layout.setTagName("grid"); - for(ObjectTreeItem *objIt = item->children()->first(); objIt; objIt = item->children()->next()) - saveWidget(objIt, layout, domDoc, true); + tqlayout.setTagName("grid"); + for(ObjectTreeItem *objIt = item->tqchildren()->first(); objIt; objIt = item->tqchildren()->next()) + saveWidget(objIt, tqlayout, domDoc, true); break; } case Container::HBox: case Container::VBox: { - // as we don't save geometry, we need to sort widgets in the right order, not creation order + // as we don't save tqgeometry, we need to sort widgets in the right order, not creation order WidgetList *list; - if(layout.tagName() == "hbox") { + if(tqlayout.tagName() == "hbox") { list = new HorWidgetList(item->container()->form()->toplevelContainer()->widget()); - layout.setTagName("hbox"); + tqlayout.setTagName("hbox"); } else { list = new VerWidgetList(item->container()->form()->toplevelContainer()->widget()); - layout.setTagName("vbox"); + tqlayout.setTagName("vbox"); } - for(ObjectTreeItem *objTree = item->children()->first(); objTree; objTree = item->children()->next()) + for(ObjectTreeItem *objTree = item->tqchildren()->first(); objTree; objTree = item->tqchildren()->next()) list->append(objTree->widget()); list->sort(); - for(QWidget *obj = list->first(); obj; obj = list->next()) { + for(TQWidget *obj = list->first(); obj; obj = list->next()) { ObjectTreeItem *titem = item->container()->form()->objectTree()->lookup(obj->name()); if(item) - saveWidget(titem, layout, domDoc); + saveWidget(titem, tqlayout, domDoc); } delete list; break; } case Container::HFlow: case Container::VFlow: { - layout.setTagName("grid"); - KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->layout()); + tqlayout.setTagName("grid"); + KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->tqlayout()); if(!flow) break; WidgetList *list = (WidgetList*)flow->widgetList(); // save some special properties - savePropertyElement(layout, domDoc, "property", "customLayout", Container::layoutTypeToString(item->container()->layoutType()) ); - savePropertyElement(layout, domDoc, "property", "justify", QVariant(static_cast<KexiFlowLayout*>(item->container()->layout())->isJustified(), 3) ); + savePropertyElement(tqlayout, domDoc, "property", "customLayout", Container::tqlayoutTypeToString(item->container()->tqlayoutType()) ); + savePropertyElement(tqlayout, domDoc, "property", "justify", TQVariant(static_cast<KexiFlowLayout*>(item->container()->tqlayout())->isJustified(), 3) ); - // fill the widget's grid info, ie just simulate grid layout + // fill the widget's grid info, ie just simulate grid tqlayout item->container()->createGridLayout(true); - for(QWidget *obj = list->first(); obj; obj = list->next()) { + for(TQWidget *obj = list->first(); obj; obj = list->next()) { ObjectTreeItem *titem = item->container()->form()->objectTree()->lookup(obj->name()); if(item) - saveWidget(titem, layout, domDoc, true); // save grid info for compatibility with QtDesigner + saveWidget(titem, tqlayout, domDoc, true); // save grid info for compatibility with TQtDesigner } delete list; break; } default: { - for(ObjectTreeItem *objIt = item->children()->first(); objIt; objIt = item->children()->next()) + for(ObjectTreeItem *objIt = item->tqchildren()->first(); objIt; objIt = item->tqchildren()->next()) saveWidget(objIt, tclass, domDoc); } } @@ -1103,20 +1103,20 @@ FormIO::saveWidget(ObjectTreeItem *item, QDomElement &parent, QDomDocument &domD } void -FormIO::cleanClipboard(QDomElement &uiElement) +FormIO::cleanClipboard(TQDomElement &uiElement) { // remove includehints element not needed if(!uiElement.namedItem("includehints").isNull()) uiElement.removeChild(uiElement.namedItem("includehints")); // and ensure images and connection are at the end if(!uiElement.namedItem("connections").isNull()) - uiElement.insertAfter(uiElement.namedItem("connections"), QDomNode()); + uiElement.insertAfter(uiElement.namedItem("connections"), TQDomNode()); if(!uiElement.namedItem("images").isNull()) - uiElement.insertAfter(uiElement.namedItem("images"), QDomNode()); + uiElement.insertAfter(uiElement.namedItem("images"), TQDomNode()); } void -FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) +FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *tqparent) { bool resetCurrentForm = false; if(!m_currentForm) // pasting widget @@ -1126,8 +1126,8 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) } // We first look for the widget's name - QString wname; - for(QDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) + TQString wname; + for(TQDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) { if((n.toElement().tagName() == "property") && (n.toElement().attribute("name") == "name")) { @@ -1136,16 +1136,16 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) } } - QWidget *w; - QCString classname, alternate; + TQWidget *w; + TQCString classname, alternate; // We translate some name (for compatibility) if(el.tagName() == "spacer") classname = "Spring"; - else if(el.attribute("class") == "QLayoutWidget") + else if(el.attribute("class") == TQLAYOUTWIDGET_OBJECT_NAME_STRING) { - for(QDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) + for(TQDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) { - QString tagName = n.toElement().tagName(); + TQString tagName = n.toElement().tagName(); if(tagName == "property") continue; if(tagName == "hbox") @@ -1153,8 +1153,8 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) else if(tagName == "vbox") classname = "VBox"; else if(tagName == "grid") { - // first, see if it is flow layout - for(QDomNode child = n.firstChild(); !child.isNull(); child = child.nextSibling()) { + // first, see if it is flow tqlayout + for(TQDomNode child = n.firstChild(); !child.isNull(); child = child.nextSibling()) { if((child.toElement().tagName() == "property") && (child.toElement().attribute("name") == "customLayout")) { @@ -1187,11 +1187,11 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) widgetOptions ^= WidgetFactory::DesignViewMode; } - if(!parent) + if(!tqparent) w = container->form()->library()->createWidget(classname, container->widget(), wname.latin1(), container, widgetOptions); else - w = container->form()->library()->createWidget(classname, parent, wname.latin1(), + w = container->form()->library()->createWidget(classname, tqparent, wname.latin1(), container, widgetOptions); } @@ -1204,7 +1204,7 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) KAcceleratorManager::setNoAccel(w); } #endif - w->setStyle(&(container->widget()->style())); + w->setStyle(&(container->widget()->tqstyle())); w->show(); // We create and insert the ObjectTreeItem at the good place in the ObjectTree @@ -1213,12 +1213,12 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) // not yet created item = new ObjectTreeItem(container->form()->library()->displayName(classname), wname, w, container); - if(parent) { - ObjectTreeItem *titem = container->form()->objectTree()->lookup(parent->name()); + if(tqparent) { + ObjectTreeItem *titem = container->form()->objectTree()->lookup(tqparent->name()); if(titem) container->form()->objectTree()->addItem(titem, item); else - kdDebug() << "FORMIO :: ERROR no parent widget " << endl; + kdDebug() << "FORMIO :: ERROR no tqparent widget " << endl; } else container->form()->objectTree()->addItem(container->objectTree(), item); @@ -1231,37 +1231,37 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) m_currentItem = item; // if we are inside a Grid, we need to insert the widget in the good cell - if(container->layoutType() == Container::Grid) { - QGridLayout *layout = (QGridLayout*)container->layout(); + if(container->tqlayoutType() == Container::Grid) { + TQGridLayout *tqlayout = (TQGridLayout*)container->tqlayout(); if(el.hasAttribute("rowspan")) { // widget spans multiple cells - if(layout) - layout->addMultiCellWidget(w, el.attribute("row").toInt(), el.attribute("row").toInt() + el.attribute("rowspan").toInt()-1, + if(tqlayout) + tqlayout->addMultiCellWidget(w, el.attribute("row").toInt(), el.attribute("row").toInt() + el.attribute("rowspan").toInt()-1, el.attribute("column").toInt(), el.attribute("column").toInt() + el.attribute("colspan").toInt()-1); item->setGridPos(el.attribute("row").toInt(), el.attribute("column").toInt(), el.attribute("rowspan").toInt(), el.attribute("colspan").toInt()); } else { - if(layout) - layout->addWidget(w, el.attribute("row").toInt(), el.attribute("column").toInt()); + if(tqlayout) + tqlayout->addWidget(w, el.attribute("row").toInt(), el.attribute("column").toInt()); item->setGridPos(el.attribute("row").toInt(), el.attribute("column").toInt(), 0, 0); } } - else if(container->layout()) - container->layout()->add(w); + else if(container->tqlayout()) + container->tqlayout()->add(w); readChildNodes(item, container, el, w); - if(item->container() && item->container()->layout()) - item->container()->layout()->activate(); + if(item->container() && item->container()->tqlayout()) + item->container()->tqlayout()->activate(); // We add the autoSaveProperties in the modifProp list of the ObjectTreeItem, so that they are saved later - QValueList<QCString> list(container->form()->library()->autoSaveProperties(w->className())); - QValueList<QCString>::ConstIterator endIt = list.constEnd(); + TQValueList<TQCString> list(container->form()->library()->autoSaveProperties(w->className())); + TQValueList<TQCString>::ConstIterator endIt = list.constEnd(); KFormDesigner::WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<KFormDesigner::WidgetWithSubpropertiesInterface*>(w); - QWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : w; - for(QValueList<QCString>::ConstIterator it = list.constBegin(); it != endIt; ++it) { - if(subwidget->metaObject()->findProperty(*it, true) != -1) + TQWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : w; + for(TQValueList<TQCString>::ConstIterator it = list.constBegin(); it != endIt; ++it) { + if(subwidget->tqmetaObject()->tqfindProperty(*it, true) != -1) item->addModifiedProperty(*it, subwidget->property(*it)); } @@ -1271,11 +1271,11 @@ FormIO::loadWidget(Container *container, const QDomElement &el, QWidget *parent) } void -FormIO::createToplevelWidget(Form *form, QWidget *container, QDomElement &el) +FormIO::createToplevelWidget(Form *form, TQWidget *container, TQDomElement &el) { // We first look for the widget's name - QString wname; - for(QDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) + TQString wname; + for(TQDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) { if((n.toElement().tagName() == "property") && (n.toElement().attribute("name") == "name")) { @@ -1290,16 +1290,16 @@ FormIO::createToplevelWidget(Form *form, QWidget *container, QDomElement &el) form->objectTree()->rename(form->objectTree()->name(), wname); form->setInteractiveMode(false); - QDict<QLabel> *oldBuddies = 0; + TQDict<TQLabel> *oldBuddies = 0; if(m_buddies) // save old buddies (for subforms) oldBuddies = m_buddies; - m_buddies = new QDict<QLabel>(); + m_buddies = new TQDict<TQLabel>(); m_currentItem = form->objectTree(); readChildNodes(form->objectTree(), form->toplevelContainer(), el, container); // Now the Form is fully loaded, we can assign the buddies - QDictIterator<QLabel> it(*m_buddies); + TQDictIterator<TQLabel> it(*m_buddies); for(; it.current(); ++it) { ObjectTreeItem *item = form->objectTree()->lookup(it.currentKey()); @@ -1319,31 +1319,31 @@ FormIO::createToplevelWidget(Form *form, QWidget *container, QDomElement &el) } void -FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const QDomElement &el, QWidget *w) +FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomElement &el, TQWidget *w) { - QString eltag = el.tagName(); + TQString eltag = el.tagName(); WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(w); - QWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : w; + TQWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : w; - for(QDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) + for(TQDomNode n = el.firstChild(); !n.isNull(); n = n.nextSibling()) { - QString tag = n.toElement().tagName(); - QDomElement node = n.toElement(); + TQString tag = n.toElement().tagName(); + TQDomElement node = n.toElement(); if((tag == "property") || (tag == "attribute")) { - QString name = node.attribute("name"); + TQString name = node.attribute("name"); //if(name == "geometry") // hasGeometryProp = true; if( ((eltag == "grid") || (eltag == "hbox") || (eltag == "vbox")) && - (name == "name")) // we don't care about layout names + (name == "name")) // we don't care about tqlayout names continue; if (node.attribute("subwidget")=="true") { //this is property for subwidget: remember it for delayed setting //because now the subwidget could be not created yet (true e.g. for KexiDBAutoField) - const QVariant val( readPropertyValue(node.firstChild(), w, name) ); + const TQVariant val( readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name) ); kdDebug() << val.toStringList() << endl; item->addSubproperty( name.latin1(), val ); //subwidget->setProperty(name.latin1(), val); @@ -1353,32 +1353,32 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const QDomEle // We cannot assign the buddy now as the buddy widget may not be created yet if(name == "buddy") - m_buddies->insert(readPropertyValue(node.firstChild(), w, name).toString(), (QLabel*)w); + m_buddies->insert(readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toString(), (TQLabel*)w); else if(((eltag == "grid") || (eltag == "hbox") || (eltag == "vbox")) && - item->container() && item->container()->layout()) { + item->container() && item->container()->tqlayout()) { // We load the margin of a Layout if(name == "margin") { - int margin = readPropertyValue(node.firstChild(), w, name).toInt(); + int margin = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toInt(); item->container()->setLayoutMargin(margin); - item->container()->layout()->setMargin(margin); + item->container()->tqlayout()->setMargin(margin); } // We load the spacing of a Layout else if(name == "spacing") { - int spacing = readPropertyValue(node.firstChild(), w, name).toInt(); + int spacing = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toInt(); item->container()->setLayoutSpacing(spacing); - item->container()->layout()->setSpacing(spacing); + item->container()->tqlayout()->setSpacing(spacing); } else if((name == "justify")){ - bool justify = readPropertyValue(node.firstChild(), w, name).toBool(); - KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->layout()); + bool justify = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toBool(); + KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->tqlayout()); if(flow) flow->setJustified(justify); } } // If the object doesn't have this property, we let the Factory handle it (maybe a special property) - else if(subwidget->metaObject()->findProperty(name.latin1(), true) == -1) + else if(subwidget->tqmetaObject()->tqfindProperty(name.latin1(), true) == -1) { - if(w->className() == QString::fromLatin1("CustomWidget")) + if(w->className() == TQString::tqfromLatin1("CustomWidget")) item->storeUnknownProperty(node); else { bool read = container->form()->library()->readSpecialProperty( @@ -1389,10 +1389,10 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const QDomEle } else // we have a normal property, let's load it { - QVariant val( readPropertyValue(node.firstChild(), w, name) ); + TQVariant val( readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name) ); if(name == "geometry" && dynamic_cast<FormWidget*>(w)) { - //fix geometry if needed - this is top level form widget - QRect r( val.toRect() ); + //fix tqgeometry if needed - this is top level form widget + TQRect r( val.toRect() ); if (r.left()<0) //negative X! r.moveLeft(0); if (r.top()<0) //negative Y! @@ -1400,8 +1400,8 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const QDomEle val = r; } subwidget->setProperty(name.latin1(), val); -// int count = w->metaObject()->findProperty(name, true); -// const QMetaProperty *meta = w->metaObject()->property(count, true); +// int count = w->tqmetaObject()->findProperty(name, true); +// const TQMetaProperty *meta = w->tqmetaObject()->property(count, true); // if(meta && meta->isEnumType()) { // val = w->property(name.latin1()); //update: we want a numeric value of enum // } @@ -1419,48 +1419,48 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const QDomEle loadWidget(container, node, w); } else if(tag == "grid") { - // first, see if it is flow layout - QString layoutName; - for(QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { + // first, see if it is flow tqlayout + TQString tqlayoutName; + for(TQDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { if((child.toElement().tagName() == "property") && (child.toElement().attribute("name") == "customLayout")) { - layoutName = child.toElement().text(); + tqlayoutName = child.toElement().text(); break; } } - if(layoutName == "HFlow") { + if(tqlayoutName == "HFlow") { item->container()->m_layType = Container::HFlow; - KexiFlowLayout *layout = new KexiFlowLayout(item->widget()); - layout->setOrientation(Horizontal); - item->container()->m_layout = (QLayout*)layout; + KexiFlowLayout *tqlayout = new KexiFlowLayout(item->widget()); + tqlayout->setOrientation(Qt::Horizontal); + item->container()->m_layout = (TQLayout*)tqlayout; } - else if(layoutName == "VFlow") { + else if(tqlayoutName == "VFlow") { item->container()->m_layType = Container::VFlow; - KexiFlowLayout *layout = new KexiFlowLayout(item->widget()); - layout->setOrientation(Vertical); - item->container()->m_layout = (QLayout*)layout; + KexiFlowLayout *tqlayout = new KexiFlowLayout(item->widget()); + tqlayout->setOrientation(Qt::Vertical); + item->container()->m_layout = (TQLayout*)tqlayout; } - else { // grid layout + else { // grid tqlayout item->container()->m_layType = Container::Grid; - QGridLayout *layout = new QGridLayout(item->widget(), 1, 1); - item->container()->m_layout = (QLayout*)layout; + TQGridLayout *tqlayout = new TQGridLayout(item->widget(), 1, 1); + item->container()->m_layout = (TQLayout*)tqlayout; } readChildNodes(item, container, node, w); } else if(tag == "vbox") { item->container()->m_layType = Container::VBox; - QVBoxLayout *layout = new QVBoxLayout(item->widget()); - item->container()->m_layout = (QLayout*)layout; + TQVBoxLayout *tqlayout = new TQVBoxLayout(item->widget()); + item->container()->m_layout = (TQLayout*)tqlayout; readChildNodes(item, container, node, w); } else if(tag == "hbox") { item->container()->m_layType = Container::HBox; - QHBoxLayout *layout = new QHBoxLayout(item->widget()); - item->container()->m_layout = (QLayout*)layout; + TQHBoxLayout *tqlayout = new TQHBoxLayout(item->widget()); + item->container()->m_layout = (TQLayout*)tqlayout; readChildNodes(item, container, node, w); } else {// unknown tag, we let the Factory handle it - if(w->className() == QString::fromLatin1("CustomWidget")) + if(w->className() == TQString::tqfromLatin1("CustomWidget")) item->storeUnknownProperty(node); else { bool read = container->form()->library()->readSpecialProperty( @@ -1477,13 +1477,13 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const QDomEle ///////////////////////////////////////////////////////////////////////////// void -FormIO::addIncludeFileName(const QString &include, QDomDocument &domDoc) +FormIO::addIncludeFileName(const TQString &include, TQDomDocument &domDoc) { if(include.isEmpty()) return; - QDomElement includes; - QDomElement uiEl = domDoc.namedItem("UI").toElement(); + TQDomElement includes; + TQDomElement uiEl = domDoc.namedItem("UI").toElement(); if(uiEl.namedItem("includehints").isNull()) { includes = domDoc.createElement("includehints"); @@ -1493,57 +1493,57 @@ FormIO::addIncludeFileName(const QString &include, QDomDocument &domDoc) includes = uiEl.namedItem("includehints").toElement(); // Check if this include has already been saved, and return if it is the case - for(QDomNode n = includes.firstChild(); !n.isNull(); n = n.nextSibling()) + for(TQDomNode n = includes.firstChild(); !n.isNull(); n = n.nextSibling()) { if(n.toElement().text() == include) return; } - QDomElement includeHint = domDoc.createElement("includehint"); + TQDomElement includeHint = domDoc.createElement("includehint"); includes.appendChild(includeHint); - QDomText includeText = domDoc.createTextNode(include); + TQDomText includeText = domDoc.createTextNode(include); includeHint.appendChild(includeText); } -//////// Qt Designer code: these two functions were copied (and adapted) from Qt Designer for compatibility //////// +//////// TQt Designer code: these two functions were copied (and adapted) from TQt Designer for compatibility //////// -QString -FormIO::saveImage(QDomDocument &domDoc, const QPixmap &pixmap) +TQString +FormIO::saveImage(TQDomDocument &domDoc, const TQPixmap &pixmap) { - QDomNode node = domDoc.namedItem("images"); - QDomElement images; + TQDomNode node = domDoc.namedItem("images"); + TQDomElement images; if(node.isNull()) { images = domDoc.createElement("images"); - QDomElement ui = domDoc.namedItem("UI").toElement(); + TQDomElement ui = domDoc.namedItem("UI").toElement(); ui.appendChild(images); } else images = node.toElement(); int count = images.childNodes().count(); - QDomElement image = domDoc.createElement("image"); - QString name = "image" + QString::number(count); + TQDomElement image = domDoc.createElement("image"); + TQString name = "image" + TQString::number(count); image.setAttribute("name", name); - QImage img = pixmap.convertToImage(); - QByteArray ba; - QBuffer buf(ba); + TQImage img = pixmap.convertToImage(); + TQByteArray ba; + TQBuffer buf(ba); buf.open( IO_WriteOnly | IO_Translate ); - QString format = img.depth() > 1 ? "XPM" : "XBM"; - QImageIO iio( &buf, format.latin1() ); + TQString format = img.depth() > 1 ? "XPM" : "XBM"; + TQImageIO iio( &buf, format.latin1() ); iio.setImage( img ); iio.write(); buf.close(); - QByteArray bazip = qCompress( ba ); + TQByteArray bazip = tqCompress( ba ); ulong len = bazip.size(); - QDomElement data = domDoc.createElement("data"); + TQDomElement data = domDoc.createElement("data"); data.setAttribute("format", format + ".GZ"); data.setAttribute("length", ba.size()); static const char hexchars[] = "0123456789abcdef"; - QString content; + TQString content; for(int i = 4; i < (int)len; ++i) { uchar s = (uchar) bazip[i]; @@ -1551,7 +1551,7 @@ FormIO::saveImage(QDomDocument &domDoc, const QPixmap &pixmap) content += hexchars[s & 0x0f]; } - QDomText text = domDoc.createTextNode(content); + TQDomText text = domDoc.createTextNode(content); data.appendChild(text); image.appendChild(data); images.appendChild(image); @@ -1559,15 +1559,15 @@ FormIO::saveImage(QDomDocument &domDoc, const QPixmap &pixmap) return name; } -QPixmap -FormIO::loadImage(QDomDocument domDoc, const QString& name) +TQPixmap +FormIO::loadImage(TQDomDocument domDoc, const TQString& name) { - QDomElement images = domDoc.namedItem("UI").namedItem("images").toElement(); + TQDomElement images = domDoc.namedItem("UI").namedItem("images").toElement(); if(images.isNull()) return 0; - QDomElement image; - for(QDomNode n = images.firstChild(); !n.isNull(); n = n.nextSibling()) + TQDomElement image; + for(TQDomNode n = images.firstChild(); !n.isNull(); n = n.nextSibling()) { if((n.toElement().tagName() == "image") && (n.toElement().attribute("name") == name)) { @@ -1576,8 +1576,8 @@ FormIO::loadImage(QDomDocument domDoc, const QString& name) } } - QPixmap pix; - QString data = image.namedItem("data").toElement().text(); + TQPixmap pix; + TQString data = image.namedItem("data").toElement().text(); const int lengthOffset = 4; int baSize = data.length() / 2 + lengthOffset; uchar *ba = new uchar[baSize]; @@ -1598,20 +1598,20 @@ FormIO::loadImage(QDomDocument domDoc, const QString& name) ba[i] = r; } - QString format = image.namedItem("data").toElement().attribute("format", "PNG"); + TQString format = image.namedItem("data").toElement().attribute("format", "PNG"); if((format == "XPM.GZ") || (format == "XBM.GZ")) { ulong len = image.attribute("length").toULong(); if(len < data.length() * 5) len = data.length() * 5; - // qUncompress() expects the first 4 bytes to be the expected length of + // tqUncompress() expects the first 4 bytes to be the expected length of // the uncompressed data ba[0] = ( len & 0xff000000 ) >> 24; ba[1] = ( len & 0x00ff0000 ) >> 16; ba[2] = ( len & 0x0000ff00 ) >> 8; ba[3] = ( len & 0x000000ff ); - QByteArray baunzip = qUncompress(ba, baSize); - pix.loadFromData( (const uchar*)baunzip.data(), baunzip.size(), format.left(format.find('.')).latin1() ); + TQByteArray baunzip = tqUncompress(ba, baSize); + pix.loadFromData( (const uchar*)baunzip.data(), baunzip.size(), format.left(format.tqfind('.')).latin1() ); } else pix.loadFromData( (const uchar*)ba+lengthOffset, baSize-lengthOffset, format.latin1() ); @@ -1621,6 +1621,6 @@ FormIO::loadImage(QDomDocument domDoc, const QString& name) return pix; } -//////// End of Qt Designer code //////////////////////////////////////////////////////// +//////// End of TQt Designer code //////////////////////////////////////////////////////// #include "formIO.moc" |