diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /languages/kjssupport/subclassingdlg.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/kjssupport/subclassingdlg.cpp')
-rw-r--r-- | languages/kjssupport/subclassingdlg.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/languages/kjssupport/subclassingdlg.cpp b/languages/kjssupport/subclassingdlg.cpp index be1ad83e..284d0471 100644 --- a/languages/kjssupport/subclassingdlg.cpp +++ b/languages/kjssupport/subclassingdlg.cpp @@ -21,20 +21,20 @@ #include <kdevelop/filetemplate.h> #include <kdevelop/codemodel.h> -#include <qradiobutton.h> -#include <qstringlist.h> -#include <qcheckbox.h> -#include <qmessagebox.h> +#include <tqradiobutton.h> +#include <tqstringlist.h> +#include <tqcheckbox.h> +#include <tqmessagebox.h> #include <kfiledialog.h> #include <klineedit.h> -#include <qpushbutton.h> +#include <tqpushbutton.h> #include <domutil.h> -#include <qdom.h> +#include <tqdom.h> #include <kstandarddirs.h> #include <kdebug.h> #include <klocale.h> -#include <qfile.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqregexp.h> #include <kconfig.h> @@ -53,17 +53,17 @@ #define SLOT_HELP SlotItem(m_slotView,"help()","virtual","protected","void",false,true) -SlotItem::SlotItem(QListView *parent,const QString &methodName, - const QString &specifier, - const QString &access, const QString &returnType, +SlotItem::SlotItem(TQListView *parent,const TQString &methodName, + const TQString &specifier, + const TQString &access, const TQString &returnType, bool isFunc,bool callBaseClass) -: QCheckListItem(parent,methodName,QCheckListItem::CheckBox) +: TQCheckListItem(parent,methodName,TQCheckListItem::CheckBox) { setOn(true); m_methodName = methodName; - m_access = access.isEmpty() ? (const QString) "public" : access; - m_specifier = specifier.isEmpty() ? (const QString) "virtual" : specifier; - m_returnType = returnType.isEmpty() ? (const QString) "void" : returnType; + m_access = access.isEmpty() ? (const TQString) "public" : access; + m_specifier = specifier.isEmpty() ? (const TQString) "virtual" : specifier; + m_returnType = returnType.isEmpty() ? (const TQString) "void" : returnType; m_isFunc = isFunc; m_callBaseClass = callBaseClass; setText(0,m_methodName); @@ -93,8 +93,8 @@ void SlotItem::setAllreadyInSubclass() } -SubclassingDlg::SubclassingDlg(kjsSupportPart* kjsSupport, const QString &formFile,QStringList &newFileNames, - QWidget* parent, const char* name,bool modal, WFlags fl) +SubclassingDlg::SubclassingDlg(kjsSupportPart* kjsSupport, const TQString &formFile,TQStringList &newFileNames, + TQWidget* parent, const char* name,bool modal, WFlags fl) : SubclassingDlgBase(parent,name,modal,fl), m_newFileNames(newFileNames), m_kjsSupport( kjsSupport ) //================================================= @@ -115,8 +115,8 @@ m_newFileNames(newFileNames), m_kjsSupport( kjsSupport ) } -/*SubclassingDlg::SubclassingDlg(kjsSupportPart* kjsSupport, const QString &formFile,const QString &filename,QStringList &dummy, - QWidget* parent, const char* name,bool modal, WFlags fl) +/*SubclassingDlg::SubclassingDlg(kjsSupportPart* kjsSupport, const TQString &formFile,const TQString &filename,TQStringList &dummy, + TQWidget* parent, const char* name,bool modal, WFlags fl) : SubclassingDlgBase(parent,name,modal,fl), m_newFileNames(dummy), m_kjsSupport( kjsSupport ) //================================================= @@ -134,12 +134,12 @@ m_newFileNames(dummy), m_kjsSupport( kjsSupport ) reformat_box->setChecked(true); } - QStringList pathsplit(QStringList::split('/',filename)); + TQStringList pathsplit(TQStringList::split('/',filename)); - QString baseClass = readBaseClassName(); - if (!kjsSupport->codeModel()->hasFile(filename+QString(".h"))) + TQString baseClass = readBaseClassName(); + if (!kjsSupport->codeModel()->hasFile(filename+TQString(".h"))) return; - ClassList myClasses = kjsSupport->codeModel()->fileByName(filename+QString(".h"))->classList(); + ClassList myClasses = kjsSupport->codeModel()->fileByName(filename+TQString(".h"))->classList(); for (ClassList::const_iterator classIt = myClasses.begin(); classIt != myClasses.end(); ++classIt) { kdDebug() << "base class " << baseClass << " class " << (*classIt)->name() @@ -162,7 +162,7 @@ m_newFileNames(dummy), m_kjsSupport( kjsSupport ) m_btnOk->setEnabled(true); } */ -bool SubclassingDlg::alreadyInSubclass(const QString &method) +bool SubclassingDlg::alreadyInSubclass(const TQString &method) { for (uint i=0;i<m_parsedMethods.count();i++) if (method.find(m_parsedMethods[i])==0) @@ -172,13 +172,13 @@ bool SubclassingDlg::alreadyInSubclass(const QString &method) void SubclassingDlg::readUiFile() { - QStringList splitPath = QStringList::split('/',m_formFile); - m_formName = QStringList::split('.',splitPath[splitPath.count()-1])[0]; // "somedlg.ui" = "somedlg" + TQStringList splitPath = TQStringList::split('/',m_formFile); + m_formName = TQStringList::split('.',splitPath[splitPath.count()-1])[0]; // "somedlg.ui" = "somedlg" splitPath.pop_back(); m_formPath = "/" + splitPath.join("/"); // join path to ui-file m_btnOk->setEnabled(false); - QDomDocument doc; + TQDomDocument doc; DomUtil::openDOMFile(doc,m_formFile); m_baseClassName = DomUtil::elementByPathExt(doc,WIDGET_CLASS_NAME).text(); @@ -188,13 +188,13 @@ void SubclassingDlg::readUiFile() // Special widget specific slots SlotItem *newSlot; - m_qtBaseClassName = DomUtil::elementByPathExt(doc,"widget").attribute("class","QDialog"); + m_qtBaseClassName = DomUtil::elementByPathExt(doc,"widget").attribute("class","TQDialog"); - if ( (m_qtBaseClassName=="QMainWindow") || (m_qtBaseClassName=="QWidget") ) + if ( (m_qtBaseClassName=="TQMainWindow") || (m_qtBaseClassName=="TQWidget") ) m_canBeModal = false; else m_canBeModal = true; - if (m_qtBaseClassName != "QWidget") + if (m_qtBaseClassName != "TQWidget") { newSlot = new SLOT_ACCEPT; newSlot->setOn(false); @@ -211,7 +211,7 @@ void SubclassingDlg::readUiFile() m_slots << newSlot; } - if (m_qtBaseClassName == "QWizard") + if (m_qtBaseClassName == "TQWizard") { newSlot = new SLOT_NEXT; m_slotView->insertItem(newSlot); @@ -231,12 +231,12 @@ void SubclassingDlg::readUiFile() m_slots << newSlot; } - QDomElement slotsElem = DomUtil::elementByPathExt(doc,WIDGET_SLOTS); - QDomNodeList slotnodes = slotsElem.childNodes(); + TQDomElement slotsElem = DomUtil::elementByPathExt(doc,WIDGET_SLOTS); + TQDomNodeList slotnodes = slotsElem.childNodes(); for (unsigned int i=0; i<slotnodes.count();i++) { - QDomElement slotelem = slotnodes.item(i).toElement(); + TQDomElement slotelem = slotnodes.item(i).toElement(); newSlot = new SlotItem(m_slotView,slotelem.text(), slotelem.attributeNode("specifier").value(), slotelem.attributeNode("access").value(), @@ -247,12 +247,12 @@ void SubclassingDlg::readUiFile() m_slots << newSlot; } - QDomElement funcsElem = DomUtil::elementByPathExt(doc,WIDGET_FUNCTIONS); - QDomNodeList funcnodes = funcsElem.childNodes(); + TQDomElement funcsElem = DomUtil::elementByPathExt(doc,WIDGET_FUNCTIONS); + TQDomNodeList funcnodes = funcsElem.childNodes(); SlotItem *newFunc; for (unsigned int i=0; i<funcnodes.count();i++) { - QDomElement funcelem = funcnodes.item(i).toElement(); + TQDomElement funcelem = funcnodes.item(i).toElement(); newFunc = new SlotItem(m_slotView,funcelem.text(), funcelem.attributeNode("specifier").value(), funcelem.attributeNode("access").value(), @@ -263,11 +263,11 @@ void SubclassingDlg::readUiFile() m_slots << newFunc; } - QDomElement connElem = DomUtil::elementByPathExt(doc,"connections"); - QDomNodeList connnodes = connElem.childNodes(); + TQDomElement connElem = DomUtil::elementByPathExt(doc,"connections"); + TQDomNodeList connnodes = connElem.childNodes(); for (unsigned int i=0; i<connnodes.count();i++) { - QDomElement connelem = connnodes.item(i).toElement(); + TQDomElement connelem = connnodes.item(i).toElement(); connections += "$NEWCLASS$.connect("; if (connelem.namedItem("sender").toElement().text() == m_baseClassName) connections += "this"; @@ -293,7 +293,7 @@ void SubclassingDlg::updateDlg() { } -void SubclassingDlg::replace(QString &string, const QString& search, const QString& replace) +void SubclassingDlg::replace(TQString &string, const TQString& search, const TQString& replace) //========================================================================================== { int nextPos = string.find(search); @@ -305,11 +305,11 @@ void SubclassingDlg::replace(QString &string, const QString& search, const QStri } } -bool SubclassingDlg::loadBuffer(QString &buffer, const QString& filename) +bool SubclassingDlg::loadBuffer(TQString &buffer, const TQString& filename) //====================================================================== { // open file and buffer it - QFile dataFile(filename); + TQFile dataFile(filename); if (!dataFile.open(IO_ReadOnly)) return false; char *temp = new char[dataFile.size()+1]; @@ -321,7 +321,7 @@ bool SubclassingDlg::loadBuffer(QString &buffer, const QString& filename) return true; } -bool SubclassingDlg::replaceKeywords(QString &buffer,bool canBeModal) +bool SubclassingDlg::replaceKeywords(TQString &buffer,bool canBeModal) //=================================================================== { replace(buffer,"$NEWFILENAMEUC$",m_edFileName->text().upper()); @@ -346,12 +346,12 @@ bool SubclassingDlg::replaceKeywords(QString &buffer,bool canBeModal) return true; } -bool SubclassingDlg::saveBuffer(QString &buffer, const QString& filename) +bool SubclassingDlg::saveBuffer(TQString &buffer, const TQString& filename) //======================================================================= { // save buffer - QFile dataFile(filename); + TQFile dataFile(filename); if (!dataFile.open(IO_WriteOnly | IO_Truncate)) return false; dataFile.writeBlock((buffer+"\n").ascii(),(buffer+"\n").length()); @@ -374,19 +374,19 @@ void SubclassingDlg::accept() // h - file - QString public_slot = + TQString public_slot = "/*$PUBLIC_SLOTS$*/\n "; - QString protected_slot = + TQString protected_slot = "/*$PROTECTED_SLOTS$*/\n "; - QString public_func = + TQString public_func = "/*$PUBLIC_FUNCTIONS$*/\n "; - QString protected_func = + TQString protected_func = "/*$PROTECTED_FUNCTIONS$*/\n "; - QString buffer; + TQString buffer; if (m_creatingNewSubclass) { loadBuffer(buffer,::locate("data", "kdevkjssupport/subclassing/subclass_template.js")); @@ -394,18 +394,18 @@ void SubclassingDlg::accept() buffer = "var $NEWCLASS$ = Factory.loadui(\"$BASEFILENAME$.ui\", this);\n\n" + buffer; buffer = FileTemplate::read(m_kjsSupport, "js") + buffer + connections; kdDebug() << "buffer: " << buffer << endl; - QFileInfo fi(m_filename + ".js"); - QString module = fi.baseName(); - QString basefilename = fi.baseName(true); - buffer.replace(QRegExp("\\$MODULE\\$"),module); - buffer.replace(QRegExp("\\$FILENAME\\$"),basefilename); + TQFileInfo fi(m_filename + ".js"); + TQString module = fi.baseName(); + TQString basefilename = fi.baseName(true); + buffer.replace(TQRegExp("\\$MODULE\\$"),module); + buffer.replace(TQRegExp("\\$FILENAME\\$"),basefilename); } else loadBuffer(buffer,m_filename+".js"); // js - file - QString implementation = + TQString implementation = "/*$SPECIALIZATION$*/\n" "function $METHOD$\n" "{\n" @@ -418,7 +418,7 @@ void SubclassingDlg::accept() if (!slitem->isOn() || slitem->m_alreadyInSubclass) continue; - QString impl = implementation; + TQString impl = implementation; replace(impl,"$RETURNTYPE$",slitem->m_returnType); replace(impl,"$NEWCLASS$",m_edClassName->text()); replace(impl,"$METHOD$", slitem->m_methodName); @@ -453,9 +453,9 @@ void SubclassingDlg::onChangedClassName() m_btnOk->setEnabled(true); } -QString SubclassingDlg::readBaseClassName( ) +TQString SubclassingDlg::readBaseClassName( ) { - QDomDocument doc; + TQDomDocument doc; DomUtil::openDOMFile(doc,m_formFile); return DomUtil::elementByPathExt(doc,WIDGET_CLASS_NAME).text(); } |