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 /parts/astyle | |
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 'parts/astyle')
-rw-r--r-- | parts/astyle/astyle_adaptor.cpp | 18 | ||||
-rw-r--r-- | parts/astyle/astyle_adaptor.h | 22 | ||||
-rw-r--r-- | parts/astyle/astyle_part.cpp | 158 | ||||
-rw-r--r-- | parts/astyle/astyle_part.h | 40 | ||||
-rw-r--r-- | parts/astyle/astyle_widget.cpp | 92 | ||||
-rw-r--r-- | parts/astyle/astyle_widget.h | 4 |
6 files changed, 167 insertions, 167 deletions
diff --git a/parts/astyle/astyle_adaptor.cpp b/parts/astyle/astyle_adaptor.cpp index 124da96e..6d6d44b6 100644 --- a/parts/astyle/astyle_adaptor.cpp +++ b/parts/astyle/astyle_adaptor.cpp @@ -4,19 +4,19 @@ #include <string> -#include <qradiobutton.h> -#include <qspinbox.h> -#include <qcheckbox.h> +#include <tqradiobutton.h> +#include <tqspinbox.h> +#include <tqcheckbox.h> #include <kdebug.h> #include <kapplication.h> #include <kconfig.h> -ASStringIterator::ASStringIterator(const QString &text) +ASStringIterator::ASStringIterator(const TQString &text) : ASSourceIterator(), _content(text) { - _is = new QTextStream(&_content, IO_ReadOnly); + _is = new TQTextStream(&_content, IO_ReadOnly); } @@ -38,9 +38,9 @@ string ASStringIterator::nextLine() } -KDevFormatter::KDevFormatter(const QMap<QString, QVariant>& options) +KDevFormatter::KDevFormatter(const TQMap<TQString, TQVariant>& options) { -// for ( QMap<QString, QVariant>::ConstIterator iter = options.begin();iter != options.end();iter++ ) +// for ( TQMap<TQString, TQVariant>::ConstIterator iter = options.begin();iter != options.end();iter++ ) // { // kdDebug ( 9009 ) << "format: " << iter.key() << "=" << iter.data() << endl; // } @@ -48,7 +48,7 @@ KDevFormatter::KDevFormatter(const QMap<QString, QVariant>& options) setCStyle(); // style - QString s = options["FStyle"].toString(); + TQString s = options["FStyle"].toString(); if ( predefinedStyle( s ) ) { return; @@ -215,7 +215,7 @@ KDevFormatter::KDevFormatter( AStyleWidget * widget ) setSingleStatementsMode( !widget->Keep_Statements->isChecked() ); } -bool KDevFormatter::predefinedStyle( const QString & style ) +bool KDevFormatter::predefinedStyle( const TQString & style ) { if (style == "ANSI") { diff --git a/parts/astyle/astyle_adaptor.h b/parts/astyle/astyle_adaptor.h index 2367c4d7..21398fbb 100644 --- a/parts/astyle/astyle_adaptor.h +++ b/parts/astyle/astyle_adaptor.h @@ -2,10 +2,10 @@ #define __ASTYLE_ADAPTOR_H__ -#include <qstring.h> -#include <qtextstream.h> -#include <qmap.h> -#include <qvariant.h> +#include <tqstring.h> +#include <tqtextstream.h> +#include <tqmap.h> +#include <tqvariant.h> #include "astyle.h" @@ -17,7 +17,7 @@ class ASStringIterator : public astyle::ASSourceIterator { public: - ASStringIterator(const QString &string); + ASStringIterator(const TQString &string); virtual ~ASStringIterator(); virtual bool hasMoreLines() const; @@ -26,8 +26,8 @@ public: private: - QString _content; - QTextStream *_is; + TQString _content; + TQTextStream *_is; }; @@ -37,18 +37,18 @@ class KDevFormatter : public astyle::ASFormatter { public: - KDevFormatter(const QMap<QString, QVariant>& options); + KDevFormatter(const TQMap<TQString, TQVariant>& options); KDevFormatter( AStyleWidget * widget ); - QString indentString() const + TQString indentString() const { return m_indentString; } private: - bool predefinedStyle( const QString & style ); + bool predefinedStyle( const TQString & style ); private: - QString m_indentString; + TQString m_indentString; }; 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 <qwhatsthis.h> -#include <qvbox.h> -#include <qtextstream.h> -#include <qpopupmenu.h> +#include <tqwhatsthis.h> +#include <tqvbox.h> +#include <tqtextstream.h> +#include <tqpopupmenu.h> #include <kdeversion.h> #include <kdebug.h> #include <kdialogbase.h> @@ -27,8 +27,8 @@ #include <kfiledialog.h> #include <klocale.h> #include <kmessagebox.h> -#include <qlineedit.h> -#include <qregexp.h> +#include <tqlineedit.h> +#include <tqregexp.h> #include "astyle_widget.h" #include "astyle_adaptor.h" @@ -43,20 +43,20 @@ namespace { typedef KDevGenericFactory<AStylePart> 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("<b>Reformat source</b><p>Source reformatting functionality using <b>astyle</b> library. " "Also available in <b>New Class</b> and <b>Subclassing</b> 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("<b>Fomat files</b><p>Formatting functionality using <b>astyle</b> 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"<<endl; KConfig *config = kapp->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<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) +// for (TQMap<TQString, TQVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) // { // kdDebug(9009) << "load: " <<iter.key() << "="<< iter.data() << endl; // } @@ -109,8 +109,8 @@ void AStylePart::loadGlobal() void AStylePart::saveGlobal() { - QString options; - for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) + TQString options; + for (TQMap<TQString, TQVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) { // kdDebug(9009) <<"saveGlobal" <<iter.key() << "="<< iter.data() << endl; options += iter.key(); @@ -118,7 +118,7 @@ void AStylePart::saveGlobal() options += iter.data().toString(); options += ","; } -// for (QMap<QString, QVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++) +// for (TQMap<TQString, TQVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++) // { // kdDebug(9009) << "project before: " <<iter.key() << "="<< iter.data() << endl; // } @@ -129,11 +129,11 @@ void AStylePart::saveGlobal() config->writeEntry("Extensions",m_globalExtensions.join(",")); config->sync(); -// for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) +// for (TQMap<TQString, TQVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) // { // kdDebug(9009) << "global after: " <<iter.key() << "="<< iter.data() << endl; // } -// for (QMap<QString, QVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++) +// for (TQMap<TQString, TQVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++) // { // kdDebug(9009) << "project after: " <<iter.key() << "="<< iter.data() << endl; // } @@ -165,19 +165,19 @@ void AStylePart::beautifySource() formatter.init(&is); - QString output; - QTextStream os(&output, IO_WriteOnly); + TQString output; + TQTextStream os(&output, IO_WriteOnly); // put the selection back to the same indent level. // taking note of the config options. unsigned int indentCount=0; - QString indentWith(""); + TQString indentWith(""); if ( has_selection){ - QString original = sel_iface->selection(); + TQString original = sel_iface->selection(); for (;indentCount<original.length();indentCount++){ - QChar ch = original[indentCount]; + TQChar ch = original[indentCount]; if ( ch.isSpace()){ - if ( ch == QChar('\n') || ch == QChar('\r')){ + if ( ch == TQChar('\n') || ch == TQChar('\r')){ indentWith=""; } else{ @@ -193,21 +193,21 @@ void AStylePart::beautifySource() if (m_project["Fill"].toString() == "Tabs") { // tabs and wsCount spaces to be a tab - QString replace; + TQString replace; for (int i =0;i<wsCount;i++) replace+=' '; - indentWith=indentWith.replace(replace, QChar('\t')); + indentWith=indentWith.replace(replace, TQChar('\t')); indentWith=indentWith.remove(' '); } else { if ( m_project["FillForce"].toBool()){ //convert tabs to spaces - QString replace; + TQString replace; for (int i =0;i<wsCount;i++) replace+=' '; - indentWith=indentWith.replace(QChar('\t'),replace); + indentWith=indentWith.replace(TQChar('\t'),replace); } } } @@ -216,7 +216,7 @@ void AStylePart::beautifySource() if ( has_selection ){ os << indentWith; } - os << QString::fromUtf8(formatter.nextLine().c_str()) << endl; + os << TQString::fromUtf8(formatter.nextLine().c_str()) << endl; } uint col = 0; @@ -242,31 +242,31 @@ void AStylePart::beautifySource() setCursorPos( partController()->activePart(), 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<<endl; if ( global){ m_globalExtensions.clear(); - m_globalExtensions=QStringList::split ( QRegExp("\n"), ext ); + m_globalExtensions=TQStringList::split ( TQRegExp("\n"), ext ); } else{ m_searchExtensions.clear(); m_projectExtensions.clear(); - m_projectExtensions = QStringList::split ( QRegExp("\n"), ext ); - QStringList bits = QStringList::split(QRegExp("\\s+"),ext); - for ( QStringList::Iterator iter = bits.begin(); iter != bits.end(); iter++ ) + m_projectExtensions = TQStringList::split ( TQRegExp("\n"), ext ); + TQStringList bits = TQStringList::split(TQRegExp("\\s+"),ext); + for ( TQStringList::Iterator iter = bits.begin(); iter != bits.end(); iter++ ) { - QString ending=*iter; + TQString ending=*iter; if ( ending.startsWith ( "*" ) ) { if (ending.length() ==1 ){ @@ -325,7 +325,7 @@ void AStylePart::activePartChanged ( KParts::Part *part ) // check for the everything case.. if ( m_searchExtensions.find ( "*" ) == m_searchExtensions.end() ) { - QString extension = rw_part->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<QString, QVariant>& options ) +TQString AStylePart::formatSource( const TQString text, AStyleWidget * widget, const TQMap<TQString, TQVariant>& 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("<b>Format</b><p>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("<b>Format files</b><p>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<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) + for (TQMap<TQString, TQVariant>::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<QString, QVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++) + for (TQMap<TQString, TQVariant>::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<QString, QString>::Iterator it = m_searchExtensions.begin(); it != m_searchExtensions.end(); ++it ) + for ( TQMap<TQString, TQString>::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 diff --git a/parts/astyle/astyle_part.h b/parts/astyle/astyle_part.h index bf572dcc..377a2b85 100644 --- a/parts/astyle/astyle_part.h +++ b/parts/astyle/astyle_part.h @@ -12,8 +12,8 @@ class KDialogBase; #include <kparts/part.h> #include <kdevplugin.h> #include <kdebug.h> -#include <qmap.h> -#include <qvariant.h> +#include <tqmap.h> +#include <tqvariant.h> class AStyleWidget; class QPopupMenu; @@ -26,21 +26,21 @@ class AStylePart : public KDevSourceFormatter public: - AStylePart(QObject *parent, const char *name, const QStringList &); + AStylePart(TQObject *parent, const char *name, const TQStringList &); ~AStylePart(); - QString formatSource(const QString text, AStyleWidget * widget, const QMap<QString, QVariant>& options); - virtual QString formatSource(const QString text); - QString indentString() const; + TQString formatSource(const TQString text, AStyleWidget * widget, const TQMap<TQString, TQVariant>& options); + virtual TQString formatSource(const TQString text); + TQString indentString() const; void saveGlobal(); - void setExtensions(QString ext, bool global); - QString getProjectExtensions(); - QString getGlobalExtensions(); - void restorePartialProjectSession(const QDomElement * el); - void savePartialProjectSession(QDomElement * el); + void setExtensions(TQString ext, bool global); + TQString getProjectExtensions(); + TQString getGlobalExtensions(); + void restorePartialProjectSession(const TQDomElement * el); + void savePartialProjectSession(TQDomElement * el); - QMap<QString, QVariant>& getProjectOptions(){return m_project;} - QMap<QString, QVariant>& getGlobalOptions(){return m_global;} + TQMap<TQString, TQVariant>& getProjectOptions(){return m_project;} + TQMap<TQString, TQVariant>& getGlobalOptions(){return m_global;} private slots: @@ -49,8 +49,8 @@ private slots: void beautifySource(); void formatFiles(); void formatFilesSelect(); - void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo); - void contextMenu(QPopupMenu *popup, const Context *context); + void insertConfigWidget(const KDialogBase *dlg, TQWidget *page, unsigned int pageNo); + void contextMenu(TQPopupMenu *popup, const Context *context); private: @@ -64,11 +64,11 @@ private: KAction *formatFileAction; // the configurable options. - QMap<QString, QVariant> m_project; - QMap<QString, QVariant> m_global; - QStringList m_projectExtensions; - QStringList m_globalExtensions; - QMap<QString, QString> m_searchExtensions; + TQMap<TQString, TQVariant> m_project; + TQMap<TQString, TQVariant> m_global; + TQStringList m_projectExtensions; + TQStringList m_globalExtensions; + TQMap<TQString, TQString> m_searchExtensions; KURL::List m_urls; }; diff --git a/parts/astyle/astyle_widget.cpp b/parts/astyle/astyle_widget.cpp index 0622b91b..0cb26abb 100644 --- a/parts/astyle/astyle_widget.cpp +++ b/parts/astyle/astyle_widget.cpp @@ -1,59 +1,59 @@ #include "astyle_part.h" #include "astyle_widget.h" -#include <qradiobutton.h> -#include <qtabwidget.h> -#include <qmultilineedit.h> -#include <qbuttongroup.h> -#include <qpushbutton.h> -#include <qcheckbox.h> -#include <qspinbox.h> +#include <tqradiobutton.h> +#include <tqtabwidget.h> +#include <tqmultilineedit.h> +#include <tqbuttongroup.h> +#include <tqpushbutton.h> +#include <tqcheckbox.h> +#include <tqspinbox.h> #include <kapplication.h> #include <kdebug.h> #include <kdevcore.h> -AStyleWidget::AStyleWidget(AStylePart * part, bool global, QWidget *parent, const char *name) +AStyleWidget::AStyleWidget(AStylePart * part, bool global, TQWidget *parent, const char *name) : AStyleConfig(parent, name), m_part(part), isGlobalWidget(global) { // which style changed - disable the other pages. - connect(StyleGroup, SIGNAL(clicked(int)), this, SLOT(styleChanged())); - connect(ConfigTabs, SIGNAL(currentChanged(QWidget*)), this, SLOT(styleChanged()) ); + connect(StyleGroup, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(styleChanged())); + connect(ConfigTabs, TQT_SIGNAL(currentChanged(TQWidget*)), this, TQT_SLOT(styleChanged()) ); - connect(FillingGroup, SIGNAL(clicked(int)), this, SLOT(styleChanged())); - connect(Fill_ForceTabs, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Fill_TabCount, SIGNAL(valueChanged(int)), this, SLOT(styleChanged())); - connect(Fill_SpaceCount, SIGNAL(valueChanged(int)), this, SLOT(styleChanged())); + connect(FillingGroup, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(styleChanged())); + connect(Fill_ForceTabs, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Fill_TabCount, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(styleChanged())); + connect(Fill_SpaceCount, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(styleChanged())); - connect(BracketGroup, SIGNAL(clicked(int)), this, SLOT(styleChanged())); - connect(Brackets_CloseHeaders, SIGNAL(clicked()), this, SLOT(styleChanged())); + connect(BracketGroup, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(styleChanged())); + connect(Brackets_CloseHeaders, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); - connect(Indent_Switches, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Cases, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Classes, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Brackets, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Namespaces, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Labels, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Blocks, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Indent_Preprocessors, SIGNAL(clicked()), this, SLOT(styleChanged())); + connect(Indent_Switches, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Cases, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Classes, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Brackets, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Namespaces, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Labels, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Blocks, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Indent_Preprocessors, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); - connect(Continue_MaxStatement, SIGNAL(valueChanged(int)), this, SLOT(styleChanged())); - connect(Continue_MinConditional, SIGNAL(valueChanged(int)), this, SLOT(styleChanged())); + connect(Continue_MaxStatement, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(styleChanged())); + connect(Continue_MinConditional, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(styleChanged())); - connect(Block_Break, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Block_BreakAll, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Block_IfElse, SIGNAL(clicked()), this, SLOT(styleChanged())); + connect(Block_Break, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Block_BreakAll, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Block_IfElse, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); - connect(Pad_ParenthesesIn, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Pad_ParenthesesOut, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Pad_ParenthesesUn, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Pad_Operators, SIGNAL(clicked()), this, SLOT(styleChanged())); + connect(Pad_ParenthesesIn, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Pad_ParenthesesOut, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Pad_ParenthesesUn, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Pad_Operators, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); - connect(Keep_Statements, SIGNAL(clicked()), this, SLOT(styleChanged())); - connect(Keep_Blocks, SIGNAL(clicked()), this, SLOT(styleChanged())); + connect(Keep_Statements, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); + connect(Keep_Blocks, TQT_SIGNAL(clicked()), this, TQT_SLOT(styleChanged())); - QMap<QString, QVariant> option; + TQMap<TQString, TQVariant> option; if ( isGlobalWidget){ Style_Global->hide(); option = m_part->getGlobalOptions(); @@ -64,7 +64,7 @@ AStyleWidget::AStyleWidget(AStylePart * part, bool global, QWidget *parent, cons } // style - QString s = option["FStyle"].toString(); + TQString s = option["FStyle"].toString(); // fake the id so we disable the other pages. int id=0; if (s == "ANSI") id=1; @@ -172,7 +172,7 @@ AStyleWidget::~AStyleWidget() void AStyleWidget::accept() { - QMap<QString, QVariant>* m_option; + TQMap<TQString, TQVariant>* m_option; if ( isGlobalWidget){ m_option = &(m_part->getGlobalOptions()); m_part->setExtensions(GeneralExtension->text(),true); @@ -195,8 +195,8 @@ void AStyleWidget::accept() else if (Style_JAVA->isChecked()) (*m_option)["FStyle"] = "JAVA"; else if (Style_Global->isChecked()){ - QMap<QString,QVariant>& global = m_part->getGlobalOptions(); - QMap<QString,QVariant>& project = m_part->getProjectOptions(); + TQMap<TQString,TQVariant>& global = m_part->getGlobalOptions(); + TQMap<TQString,TQVariant>& project = m_part->getProjectOptions(); project=global; project["FStyle"]="GLOBAL"; } @@ -264,7 +264,7 @@ void AStyleWidget::accept() } if ( isGlobalWidget){ - QMap<QString, QVariant>& project = m_part->getProjectOptions(); + TQMap<TQString, TQVariant>& project = m_part->getProjectOptions(); if ( project["FStyle"] == "GLOBAL"){ project = m_part->getGlobalOptions(); project["FStyle"] = "GLOBAL"; @@ -272,7 +272,7 @@ void AStyleWidget::accept() m_part->saveGlobal(); } -// for ( QMap<QString, QVariant>::ConstIterator iter = m_option->begin();iter != m_option->end();iter++ ) +// for ( TQMap<TQString, TQVariant>::ConstIterator iter = m_option->begin();iter != m_option->end();iter++ ) // { // kdDebug ( 9009 ) << "widget: " << iter.key() << "=" << iter.data() << endl; // } @@ -296,13 +296,13 @@ void AStyleWidget::styleChanged( ) StyleExample->clear(); - QString bracketSample = "namespace foospace {\n\tint Foo(){\n\tif (isBar)\n{\nbar(); \n\treturn 1; } else \nreturn 0;}}\n\nvoid test(){\n\tif (isFoo){\n\tbar();\n} else\n{\n\tbar();\n}\n}\n"; + TQString bracketSample = "namespace foospace {\n\tint Foo(){\n\tif (isBar)\n{\nbar(); \n\treturn 1; } else \nreturn 0;}}\n\nvoid test(){\n\tif (isFoo){\n\tbar();\n} else\n{\n\tbar();\n}\n}\n"; - QString indentSample = "#define foobar(A)\\\n{Foo();Bar();}\n#define anotherFoo(B)\\\nreturn Bar()\n\nnamespace Bar\n{\nclass Foo\n{public:\nFoo();\nvirtual ~Foo();\n};\nswitch (foo)\n{\ncase 1:\na+=1;\nbreak;\ncase 2:\n{\na += 2;\n break;\n}\n}\nif (isFoo)\n{\nbar();\n}\nelse\n{\nanotherBar();\n}\nint foo()\n\twhile(isFoo)\n\t\t{\n\t\t\t...\n\t\t\tgoto error;\n\t\t....\n\t\terror:\n\t\t\t...\n\t\t}\n\t}\nfooArray[]={ red,\n\tgreen,\n\tdarkblue};\nfooFunction(barArg1,\n\tbarArg2,\n\tbarArg3);\n"; + TQString indentSample = "#define foobar(A)\\\n{Foo();Bar();}\n#define anotherFoo(B)\\\nreturn Bar()\n\nnamespace Bar\n{\nclass Foo\n{public:\nFoo();\nvirtual ~Foo();\n};\nswitch (foo)\n{\ncase 1:\na+=1;\nbreak;\ncase 2:\n{\na += 2;\n break;\n}\n}\nif (isFoo)\n{\nbar();\n}\nelse\n{\nanotherBar();\n}\nint foo()\n\twhile(isFoo)\n\t\t{\n\t\t\t...\n\t\t\tgoto error;\n\t\t....\n\t\terror:\n\t\t\t...\n\t\t}\n\t}\nfooArray[]={ red,\n\tgreen,\n\tdarkblue};\nfooFunction(barArg1,\n\tbarArg2,\n\tbarArg3);\n"; - QString formattingSample = "void func(){\n\tif(isFoo(a,b))\n\tbar(a,b);\nif(isFoo)\n\ta=bar((b-c)*a,*d--);\nif( isFoo( a,b ) )\n\tbar(a, b);\nif (isFoo) {isFoo=false;cat << isFoo <<endl;}\nif(isFoo)DoBar();if (isFoo){\n\tbar();\n}\n\telse if(isBar()){\n\tannotherBar();\n}\n}\n"; + TQString formattingSample = "void func(){\n\tif(isFoo(a,b))\n\tbar(a,b);\nif(isFoo)\n\ta=bar((b-c)*a,*d--);\nif( isFoo( a,b ) )\n\tbar(a, b);\nif (isFoo) {isFoo=false;cat << isFoo <<endl;}\nif(isFoo)DoBar();if (isFoo){\n\tbar();\n}\n\telse if(isBar()){\n\tannotherBar();\n}\n}\n"; - QString styleSample = "\t//Tabs & Brackets\nnamespace foo{\n" + bracketSample + "}\n\t// Indentation\n" + indentSample + "\t// Formatting\n" + formattingSample; + TQString styleSample = "\t//Tabs & Brackets\nnamespace foo{\n" + bracketSample + "}\n\t// Indentation\n" + indentSample + "\t// Formatting\n" + formattingSample; switch(id){ case 1: diff --git a/parts/astyle/astyle_widget.h b/parts/astyle/astyle_widget.h index ac779985..0d379fc0 100644 --- a/parts/astyle/astyle_widget.h +++ b/parts/astyle/astyle_widget.h @@ -13,7 +13,7 @@ class AStyleWidget : public AStyleConfig public: - AStyleWidget( AStylePart * part, bool global, QWidget *parent=0, const char *name=0 ); + AStyleWidget( AStylePart * part, bool global, TQWidget *parent=0, const char *name=0 ); ~AStyleWidget(); @@ -28,7 +28,7 @@ private slots: private: AStylePart * m_part; bool isGlobalWidget; - QString m_lastExt; + TQString m_lastExt; bool globalOptions; }; |