summaryrefslogtreecommitdiffstats
path: root/languages/cpp/subclassingdlg.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /languages/cpp/subclassingdlg.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-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/cpp/subclassingdlg.cpp')
-rw-r--r--languages/cpp/subclassingdlg.cpp132
1 files changed, 66 insertions, 66 deletions
diff --git a/languages/cpp/subclassingdlg.cpp b/languages/cpp/subclassingdlg.cpp
index fa5aece9..562cd010 100644
--- a/languages/cpp/subclassingdlg.cpp
+++ b/languages/cpp/subclassingdlg.cpp
@@ -22,20 +22,20 @@
#include "filetemplate.h"
#include "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>
@@ -54,17 +54,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(CppSupportPart* cppSupport, const QString &formFile,
- QStringList &newFileNames, QWidget* parent,
+SubclassingDlg::SubclassingDlg(CppSupportPart* cppSupport, const TQString &formFile,
+ TQStringList &newFileNames, TQWidget* parent,
const char* name,bool modal, WFlags fl)
: SubclassingDlgBase(parent,name,modal,fl),
m_newFileNames(newFileNames), m_cppSupport( cppSupport )
@@ -115,9 +115,9 @@ m_newFileNames(newFileNames), m_cppSupport( cppSupport )
}
-SubclassingDlg::SubclassingDlg(CppSupportPart* cppSupport, const QString &formFile,
- const QString &filename, QStringList &dummy,
- QWidget* parent, const char* name, bool modal, WFlags fl)
+SubclassingDlg::SubclassingDlg(CppSupportPart* cppSupport, 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_cppSupport( cppSupport )
@@ -135,12 +135,12 @@ m_newFileNames(dummy), m_cppSupport( cppSupport )
reformat_box->setChecked(true);
}
- QStringList pathsplit(QStringList::split('/',filename));
+ TQStringList pathsplit(TQStringList::split('/',filename));
- QString baseClass = readBaseClassName();
- if (!cppSupport->codeModel()->hasFile(filename+QString(".h")))
+ TQString baseClass = readBaseClassName();
+ if (!cppSupport->codeModel()->hasFile(filename+TQString(".h")))
return;
- ClassList myClasses = cppSupport->codeModel()->fileByName(filename+QString(".h"))->classList();
+ ClassList myClasses = cppSupport->codeModel()->fileByName(filename+TQString(".h"))->classList();
for (ClassList::const_iterator classIt = myClasses.begin(); classIt != myClasses.end(); ++classIt)
{
kdDebug() << "base class " << baseClass << " class " << (*classIt)->name()
@@ -163,7 +163,7 @@ m_newFileNames(dummy), m_cppSupport( cppSupport )
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++)
{
@@ -175,13 +175,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();
@@ -191,13 +191,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);
@@ -214,7 +214,7 @@ void SubclassingDlg::readUiFile()
m_slots << newSlot;
}
- if (m_qtBaseClassName == "QWizard")
+ if (m_qtBaseClassName == "TQWizard")
{
newSlot = new SLOT_NEXT;
m_slotView->insertItem(newSlot);
@@ -234,12 +234,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(),
@@ -250,12 +250,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(),
@@ -276,7 +276,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);
unsigned int searchLength = search.length();
@@ -287,10 +287,10 @@ 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];
@@ -302,7 +302,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());
replace(buffer,"$BASEFILENAMELC$",m_formName.lower());
@@ -327,11 +327,11 @@ 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());
@@ -353,19 +353,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;
int qtVersion = DomUtil::readIntEntry( *m_cppSupport->project()->projectDom(), "/kdevcppsupport/qt/version", 3 );
if (m_creatingNewSubclass)
{
@@ -375,11 +375,11 @@ void SubclassingDlg::accept()
loadBuffer(buffer,::locate("data", "kdevcppsupport/subclassing/subclass_qt4_template.h"));
buffer = FileTemplate::read(m_cppSupport, "h") + buffer;
- QFileInfo fi(m_filename + ".h");
- QString module = fi.baseName();
- QString basefilename = fi.baseName(true);
- buffer.replace(QRegExp("\\$MODULE\\$"),module);
- buffer.replace(QRegExp("\\$FILENAME\\$"),basefilename);
+ TQFileInfo fi(m_filename + ".h");
+ TQString module = fi.baseName();
+ TQString basefilename = fi.baseName(true);
+ buffer.replace(TQRegExp("\\$MODULE\\$"),module);
+ buffer.replace(TQRegExp("\\$FILENAME\\$"),basefilename);
}
else
loadBuffer(buffer,m_filename+".h");
@@ -391,7 +391,7 @@ void SubclassingDlg::accept()
if (!slitem->isOn() ||
slitem->m_alreadyInSubclass)
continue;
- QString declBuild;
+ TQString declBuild;
if (slitem->m_access=="public")
if (!slitem->m_isFunc)
declBuild = public_slot;
@@ -405,7 +405,7 @@ void SubclassingDlg::accept()
if (!(slitem->m_specifier=="non virtual"))
declBuild += "virtual ";
declBuild += slitem->m_returnType + " ";
- QString spacer;
+ TQString spacer;
if (slitem->m_access=="public")
{
if (!slitem->m_isFunc)
@@ -448,13 +448,13 @@ void SubclassingDlg::accept()
// cpp - file
- QString implementation =
+ TQString implementation =
"/*$SPECIALIZATION$*/\n"
"$RETURNTYPE$ $NEWCLASS$::$METHOD$\n"
"{\n"
"}\n";
- QString implementation_callbase =
+ TQString implementation_callbase =
"/*$SPECIALIZATION$*/\n"
"$RETURNTYPE$ $NEWCLASS$::$METHOD$\n"
"{\n"
@@ -470,11 +470,11 @@ void SubclassingDlg::accept()
loadBuffer(buffer,::locate("data", "kdevcppsupport/subclassing/subclass_qt4_template.cpp"));
buffer = FileTemplate::read(m_cppSupport, "cpp") + buffer;
- QFileInfo fi(m_filename + ".cpp");
- QString module = fi.baseName();
- QString basefilename = fi.baseName(true);
- buffer.replace(QRegExp("\\$MODULE\\$"),module);
- buffer.replace(QRegExp("\\$FILENAME\\$"),basefilename);
+ TQFileInfo fi(m_filename + ".cpp");
+ TQString module = fi.baseName();
+ TQString basefilename = fi.baseName(true);
+ buffer.replace(TQRegExp("\\$MODULE\\$"),module);
+ buffer.replace(TQRegExp("\\$FILENAME\\$"),basefilename);
if ( (m_cppSupport->project()) && (m_cppSupport->project()->options() & KDevProject::UsesAutotoolsBuildSystem))
buffer += "\n#include \"$NEWFILENAMELC$.moc\"\n";
}
@@ -488,7 +488,7 @@ void SubclassingDlg::accept()
if (!slitem->isOn() ||
slitem->m_alreadyInSubclass)
continue;
- QString impl = slitem->m_callBaseClass ? implementation_callbase : implementation;
+ TQString impl = slitem->m_callBaseClass ? implementation_callbase : implementation;
replace(impl,"$RETURNTYPE$",slitem->m_returnType);
replace(impl,"$NEWCLASS$",m_edClassName->text());
replace(impl,"$METHOD$", slitem->m_methodName);
@@ -526,9 +526,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();
}