From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/astyle/astyle_part.cpp | 158 +++++++++++++++++++++---------------------- 1 file changed, 79 insertions(+), 79 deletions(-) (limited to 'parts/astyle/astyle_part.cpp') diff --git a/parts/astyle/astyle_part.cpp b/parts/astyle/astyle_part.cpp index 526af170..f89c2b95 100644 --- a/parts/astyle/astyle_part.cpp +++ b/parts/astyle/astyle_part.cpp @@ -1,9 +1,9 @@ #include "astyle_part.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include +#include #include "astyle_widget.h" #include "astyle_adaptor.h" @@ -43,20 +43,20 @@ namespace { typedef KDevGenericFactory AStyleFactory; K_EXPORT_COMPONENT_FACTORY( libkdevastyle, AStyleFactory( data ) ) -AStylePart::AStylePart(QObject *parent, const char *name, const QStringList &) +AStylePart::AStylePart(TQObject *parent, const char *name, const TQStringList &) : KDevSourceFormatter(&data, parent, name ? name : "AStylePart") { setInstance(AStyleFactory::instance()); setXMLFile("kdevpart_astyle.rc"); - formatTextAction = new KAction(i18n("&Reformat Source"), 0, this, SLOT(beautifySource()), actionCollection(), "edit_astyle"); + formatTextAction = new KAction(i18n("&Reformat Source"), 0, this, TQT_SLOT(beautifySource()), actionCollection(), "edit_astyle"); formatTextAction->setEnabled(false); formatTextAction->setToolTip(i18n("Reformat source")); formatTextAction->setWhatsThis(i18n("Reformat source

Source reformatting functionality using astyle library. " "Also available in New Class and Subclassing wizards.")); - formatFileAction = new KAction(i18n("Format files"), 0, this, SLOT(formatFilesSelect()), actionCollection(), "tools_astyle"); + formatFileAction = new KAction(i18n("Format files"), 0, this, TQT_SLOT(formatFilesSelect()), actionCollection(), "tools_astyle"); formatFileAction->setEnabled(false); formatFileAction->setToolTip(i18n("Format files")); formatFileAction->setWhatsThis(i18n("Fomat files

Formatting functionality using astyle library. " @@ -68,11 +68,11 @@ AStylePart::AStylePart(QObject *parent, const char *name, const QStringList &) m_configProxy->createProjectConfigPage(i18n("Formatting"), PROJECTDOC_OPTIONS, info()->icon()); - connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase* ,QWidget*,unsigned int)), this, SLOT(insertConfigWidget(const KDialogBase*,QWidget*,unsigned int))); + connect(m_configProxy, TQT_SIGNAL(insertConfigWidget(const KDialogBase* ,TQWidget*,unsigned int)), this, TQT_SLOT(insertConfigWidget(const KDialogBase*,TQWidget*,unsigned int))); - connect(partController(), SIGNAL(activePartChanged(KParts::Part*)), this, SLOT(activePartChanged(KParts::Part*))); + connect(partController(), TQT_SIGNAL(activePartChanged(KParts::Part*)), this, TQT_SLOT(activePartChanged(KParts::Part*))); - connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); + connect( core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)), this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *)) ); loadGlobal(); //use the globals first, project level will override later.. @@ -90,18 +90,18 @@ void AStylePart::loadGlobal() // kdDebug(9009) << "Load global"<config(); config->setGroup("AStyle"); - QString options = config->readEntry("Options","BlockBreak=0,BlockBreakAll=0,BlockIfElse=0,Brackets=Break,BracketsCloseHeaders=0,FStyle=UserDefined,Fill=Tabs,FillCount=4,FillEmptyLines=0,FillForce=0,IndentBlocks=0,IndentBrackets=0,IndentCases=0,IndentClasses=1,IndentLabels=1,IndentNamespaces=1,IndentPreprocessors=0,IndentSwitches=1,KeepBlocks=1,KeepStatements=1,MaxStatement=40,MinConditional=-1,PadOperators=0,PadParenthesesIn=1,PadParenthesesOut=1,PadParenthesesUn=1,"); - m_globalExtensions=QStringList::split(",",config->readEntry("Extensions",defaultFormatExtensions)); + TQString options = config->readEntry("Options","BlockBreak=0,BlockBreakAll=0,BlockIfElse=0,Brackets=Break,BracketsCloseHeaders=0,FStyle=UserDefined,Fill=Tabs,FillCount=4,FillEmptyLines=0,FillForce=0,IndentBlocks=0,IndentBrackets=0,IndentCases=0,IndentClasses=1,IndentLabels=1,IndentNamespaces=1,IndentPreprocessors=0,IndentSwitches=1,KeepBlocks=1,KeepStatements=1,MaxStatement=40,MinConditional=-1,PadOperators=0,PadParenthesesIn=1,PadParenthesesOut=1,PadParenthesesUn=1,"); + m_globalExtensions=TQStringList::split(",",config->readEntry("Extensions",defaultFormatExtensions)); - QStringList pairs = QStringList::split( ",", options); - QStringList::Iterator it; + TQStringList pairs = TQStringList::split( ",", options); + TQStringList::Iterator it; for ( it = pairs.begin(); it != pairs.end(); ++it ) { - QStringList bits = QStringList::split( "=", (*it) ); + TQStringList bits = TQStringList::split( "=", (*it) ); m_global[bits[0]] = bits[1]; } -// for (QMap::iterator iter = m_global.begin();iter != m_global.end();iter++) +// for (TQMap::iterator iter = m_global.begin();iter != m_global.end();iter++) // { // kdDebug(9009) << "load: " <::iterator iter = m_project.begin();iter != m_project.end();iter++) +// for (TQMap::iterator iter = m_project.begin();iter != m_project.end();iter++) // { // kdDebug(9009) << "project before: " <sync(); -// for (QMap::iterator iter = m_global.begin();iter != m_global.end();iter++) +// for (TQMap::iterator iter = m_global.begin();iter != m_global.end();iter++) // { // kdDebug(9009) << "global after: " <selection(); + TQString original = sel_iface->selection(); for (;indentCountactivePart(), col, line ); } -void AStylePart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo) +void AStylePart::insertConfigWidget(const KDialogBase *dlg, TQWidget *page, unsigned int pageNo) { switch (pageNo) { case GLOBALDOC_OPTIONS: { AStyleWidget *w = new AStyleWidget(this, true, page, "astyle config widget"); - connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + connect(dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept())); break; } case PROJECTDOC_OPTIONS: { AStyleWidget *w = new AStyleWidget(this, false, page, "astyle config widget"); - connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + connect(dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept())); break; } } } -QString AStylePart::getGlobalExtensions(){ - QString values = m_globalExtensions.join("\n"); +TQString AStylePart::getGlobalExtensions(){ + TQString values = m_globalExtensions.join("\n"); return values.stripWhiteSpace(); } -QString AStylePart::getProjectExtensions(){ - QString values = m_projectExtensions.join("\n"); +TQString AStylePart::getProjectExtensions(){ + TQString values = m_projectExtensions.join("\n"); return values.stripWhiteSpace(); } @@ -277,21 +277,21 @@ QString AStylePart::getProjectExtensions(){ * end up at the top * @param ext */ -void AStylePart::setExtensions ( QString ext, bool global ) +void AStylePart::setExtensions ( TQString ext, bool global ) { kdDebug(9009) << "setExtensions " << ext<url().path(); + TQString extension = rw_part->url().path(); int pos = extension.findRev ( '.' ); if ( pos >= 0 ) { @@ -343,18 +343,18 @@ void AStylePart::activePartChanged ( KParts::Part *part ) formatTextAction->setEnabled ( enabled ); } -QString AStylePart::formatSource( const QString text, AStyleWidget * widget, const QMap& options ) +TQString AStylePart::formatSource( const TQString text, AStyleWidget * widget, const TQMap& options ) { ASStringIterator is(text); KDevFormatter * formatter = ( widget)? new KDevFormatter( widget ) : new KDevFormatter(options); formatter->init(&is); - QString output; - QTextStream os(&output, IO_WriteOnly); + TQString output; + TQTextStream os(&output, IO_WriteOnly); while ( formatter->hasMoreLines() ) - os << QString::fromUtf8( formatter->nextLine().c_str() ) << endl; + os << TQString::fromUtf8( formatter->nextLine().c_str() ) << endl; delete formatter; @@ -383,23 +383,23 @@ void AStylePart::setCursorPos( KParts::Part *part, uint line, uint col ) } } -QString AStylePart::formatSource( const QString text ) +TQString AStylePart::formatSource( const TQString text ) { return formatSource(text, 0, m_project); } -QString AStylePart::indentString( ) const +TQString AStylePart::indentString( ) const { KDevFormatter formatter(m_project); return formatter.indentString(); } -void AStylePart::contextMenu(QPopupMenu *popup, const Context *context) +void AStylePart::contextMenu(TQPopupMenu *popup, const Context *context) { if (context->hasType( Context::EditorContext )) { popup->insertSeparator(); - int id = popup->insertItem( i18n("Format selection"), this, SLOT(beautifySource()) ); + int id = popup->insertItem( i18n("Format selection"), this, TQT_SLOT(beautifySource()) ); popup->setWhatsThis(id, i18n("Format

Formats the current selection, if possible")); } else if ( context->hasType( Context::FileContext )){ @@ -407,16 +407,16 @@ void AStylePart::contextMenu(QPopupMenu *popup, const Context *context) m_urls = ctx->urls(); popup->insertSeparator(); - int id = popup->insertItem( i18n("Format files"), this, SLOT(formatFiles()) ); + int id = popup->insertItem( i18n("Format files"), this, TQT_SLOT(formatFiles()) ); popup->setWhatsThis(id, i18n("Format files

Formats selected files if possible")); } } -void AStylePart::restorePartialProjectSession(const QDomElement * el) +void AStylePart::restorePartialProjectSession(const TQDomElement * el) { kdDebug(9009) << "Load project" << endl; - QDomElement style = el->namedItem("AStyle").toElement(); + TQDomElement style = el->namedItem("AStyle").toElement(); if (style.attribute("FStyle", "GLOBAL") == "GLOBAL") { @@ -426,36 +426,36 @@ void AStylePart::restorePartialProjectSession(const QDomElement * el) } else { - for (QMap::iterator iter = m_global.begin();iter != m_global.end();iter++) + for (TQMap::iterator iter = m_global.begin();iter != m_global.end();iter++) { m_project[iter.key()] = style.attribute(iter.key(),iter.data().toString()); } - QDomElement exten = el->namedItem("Extensions").toElement(); - QString ext = exten.attribute("ext").simplifyWhiteSpace(); + TQDomElement exten = el->namedItem("Extensions").toElement(); + TQString ext = exten.attribute("ext").simplifyWhiteSpace(); if ( ext.isEmpty()){ ext=defaultFormatExtensions; } - setExtensions(ext.replace(QChar(','), QChar('\n')),false); + setExtensions(ext.replace(TQChar(','), TQChar('\n')),false); } } -void AStylePart::savePartialProjectSession(QDomElement * el) +void AStylePart::savePartialProjectSession(TQDomElement * el) { - QDomDocument domDoc = el->ownerDocument(); + TQDomDocument domDoc = el->ownerDocument(); if (domDoc.isNull()) return; - QDomElement style = domDoc.createElement("AStyle"); + TQDomElement style = domDoc.createElement("AStyle"); style.setAttribute("FStyle", m_project["FStyle"].toString()); if (m_project["FStyle"] != "GLOBAL") { - for (QMap::iterator iter = m_project.begin();iter != m_project.end();iter++) + for (TQMap::iterator iter = m_project.begin();iter != m_project.end();iter++) { style.setAttribute(iter.key(),iter.data().toString()); } - QDomElement exten = domDoc.createElement ( "Extensions" ); + TQDomElement exten = domDoc.createElement ( "Extensions" ); exten.setAttribute ( "ext", m_projectExtensions.join(",").simplifyWhiteSpace() ); el->appendChild(exten); } @@ -464,9 +464,9 @@ void AStylePart::savePartialProjectSession(QDomElement * el) void AStylePart::formatFilesSelect(){ m_urls.clear(); - QStringList filenames = KFileDialog::getOpenFileNames ( QString::null, getProjectExtensions(),0,"Select files to format" ); + TQStringList filenames = KFileDialog::getOpenFileNames ( TQString::null, getProjectExtensions(),0,"Select files to format" ); - for(QStringList::Iterator it = filenames.begin(); it != filenames.end();it++){ + for(TQStringList::Iterator it = filenames.begin(); it != filenames.end();it++){ m_urls << *it; } formatFiles(); @@ -488,12 +488,12 @@ void AStylePart::formatFiles() uint processed = 0; for ( uint fileCount = 0; fileCount < m_urls.size(); fileCount++ ) { - QString fileName = m_urls[fileCount].pathOrURL(); + TQString fileName = m_urls[fileCount].pathOrURL(); bool found = false; - for ( QMap::Iterator it = m_searchExtensions.begin(); it != m_searchExtensions.end(); ++it ) + for ( TQMap::Iterator it = m_searchExtensions.begin(); it != m_searchExtensions.end(); ++it ) { - QRegExp re ( it.data(), true, true ); + TQRegExp re ( it.data(), true, true ); if ( re.search ( fileName ) == 0 && ( uint ) re.matchedLength() == fileName.length() ) { found = true; @@ -503,19 +503,19 @@ void AStylePart::formatFiles() if ( found ) { - QString backup = fileName + "#"; - QFile fin ( fileName ); - QFile fout ( backup ); + TQString backup = fileName + "#"; + TQFile fin ( fileName ); + TQFile fout ( backup ); if ( fin.open ( IO_ReadOnly ) ) { if ( fout.open ( IO_WriteOnly ) ) { - QString fileContents ( fin.readAll() ); + TQString fileContents ( fin.readAll() ); fin.close(); - QTextStream outstream ( &fout ); + TQTextStream outstream ( &fout ); outstream << formatSource ( fileContents ); fout.close(); - QDir().rename ( backup, fileName ); + TQDir().rename ( backup, fileName ); processed++; } else -- cgit v1.2.1