From e1f0110799282020eba5dac4a1a7bf27a6187f59 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 28 Sep 2018 20:41:02 +0900 Subject: Fixed FTBFS caused by qt->tqt renaming. Signed-off-by: Michele Calgaro --- languages/cpp/qtdesignercppintegration.cpp | 218 ---------------------------- languages/cpp/qtdesignercppintegration.h | 41 ------ languages/cpp/tqtdesignercppintegration.cpp | 218 ++++++++++++++++++++++++++++ languages/cpp/tqtdesignercppintegration.h | 41 ++++++ 4 files changed, 259 insertions(+), 259 deletions(-) delete mode 100644 languages/cpp/qtdesignercppintegration.cpp delete mode 100644 languages/cpp/qtdesignercppintegration.h create mode 100644 languages/cpp/tqtdesignercppintegration.cpp create mode 100644 languages/cpp/tqtdesignercppintegration.h (limited to 'languages/cpp') diff --git a/languages/cpp/qtdesignercppintegration.cpp b/languages/cpp/qtdesignercppintegration.cpp deleted file mode 100644 index 21db2b63..00000000 --- a/languages/cpp/qtdesignercppintegration.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2004 by Alexander Dymo * -* adymo@mksat.net * -* Portions Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org) * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -***************************************************************************/ -#include "tqtdesignercppintegration.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "backgroundparser.h" -#include "cppsupportpart.h" -#include "codemodel_utils.h" -#include "implementationwidget.h" - -QtDesignerCppIntegration::QtDesignerCppIntegration( KDevLanguageSupport *part, - ImplementationWidget *impl ) -: QtDesignerIntegration( part, impl, true, 0 ) -{} - -void QtDesignerCppIntegration::addFunctionToClass( KInterfaceDesigner::Function function, ClassDom klass ) -{ - m_part->partController() ->editDocument( KURL( klass->fileName() ) ); - KTextEditor::EditInterface* editIface = dynamic_cast( m_part->partController() ->activePart() ); - if ( !editIface ) - { - /// @todo show messagebox - // TQDialog::accept(); - return ; - } - - int line, column; - klass->getEndPosition( &line, &column ); - - // compute the insertion point map - TQMap > points; - - const FunctionList functionList = klass->functionList(); - for ( FunctionList::ConstIterator it = functionList.begin(); it != functionList.end(); ++it ) - { - int funEndLine, funEndColumn; - ( *it ) ->getEndPosition( &funEndLine, &funEndColumn ); - TQString access = accessID( *it ); - TQPair funEndPoint = tqMakePair( funEndLine, funEndColumn ); - - if ( !points.contains( access ) || points[ access ] < funEndPoint ) - { - points[ access ] = funEndPoint; - } - } - - int insertedLine = 0; - - TQString access = function.access + ( function.type == KInterfaceDesigner::ftTQtSlot ? " slots" : "" ); - - TQString str = function.returnType + " " + function.function; - if ( function.specifier == "virtual" ) - str = "virtual " + str; - else if ( function.specifier == "pure virtual" ) - str = "virtual " + str + " = 0"; - else if ( function.specifier == "static" ) - str = "static " + str; - str += ";\n"; - str = " " + str; - - TQPair pt; - if ( points.contains( access ) ) - { - pt = points[ access ]; - } - else - { - str.prepend( access + ":\n" ); - points[ access ] = tqMakePair( line - 1, 0 ); - pt = points[ access ]; // end of class declaration - } - - editIface->insertText( pt.first + insertedLine + 1, 0 /*pt.second*/, str ); - insertedLine += str.contains( TQChar( '\n' ) ); - - CppSupportPart *cppPart = dynamic_cast( m_part ); - cppPart->backgroundParser() ->addFile( klass->fileName() ); - - if ( function.specifier == "pure virtual" ) - return ; - - - //implementation - TQString stri = function.returnType + " " + klass->name() + "::" + function.function; - if ( function.specifier == "static" ) - stri = "static " + stri; - stri += "\n{\n}\n"; - stri = "\n" + stri; - - TQFileInfo fi( klass->fileName() ); - TQString implementationFile = fi.absFilePath(); - implementationFile.replace( ".h", ".cpp" ); - - TQFileInfo fileInfo( implementationFile ); - if ( !TQFile::exists( fileInfo.absFilePath() ) ) - { - if ( KDevCreateFile * createFileSupp = m_part->extension( "TDevelop/CreateFile" ) ) - createFileSupp->createNewFile( fileInfo.extension(), fileInfo.dirPath( true ), fileInfo.fileName() ); - } - - m_part->partController() ->editDocument( KURL( implementationFile ) ); - editIface = dynamic_cast( m_part->partController() ->activePart() ); - if ( !editIface ) - return ; - - int atLine = 0, atColumn = 0; - TranslationUnitAST *translationUnit = 0; - ParsedFilePointer p = cppPart->backgroundParser() ->translationUnit( implementationFile ); - if( p ) translationUnit = *p; - if ( translationUnit ) - { - translationUnit->getEndPosition( &atLine, &atColumn ); - kdDebug() << "atLine: " << atLine << endl; - stri = "\n" + stri; - } - else - { - atLine = editIface->numLines(); - line = editIface->numLines(); - while ( line > 0 ) - { - if ( editIface->textLine( line ).isEmpty() ) - { - --line; - continue; - } - else - { - if ( editIface->textLine( line ).contains( TQRegExp( ".*#include .*\\.moc.*" ) ) ) - atLine = line; - break; - } - } - kdDebug() << "atLine (2): " << atLine << endl; - atColumn = 0; - } - - // editIface->insertLine( atLine + 1, TQString::fromLatin1("") ); - kdDebug() << "at line in intg: " << atLine << " atCol: " << atColumn << endl; - kdDebug() << "text: " << stri << endl; - editIface->insertText( atLine, atColumn, stri ); - KTextEditor::View *activeView = dynamic_cast( m_part->partController() ->activePart() ->widget() ); - if ( activeView ) - { - KTextEditor::ViewCursorInterface * cursor = dynamic_cast( activeView ); - if ( cursor ) - cursor->setCursorPositionReal( atLine + 3, 1 ); - } - - cppPart->backgroundParser() ->addFile( implementationFile ); -} - -TQString QtDesignerCppIntegration::accessID( FunctionDom fun ) const -{ - if ( fun->isSignal() ) - return TQString::fromLatin1( "signals" ); - - switch ( fun->access() ) - { - case CodeModelItem::Public: - if ( fun->isSlot() ) - return TQString::fromLatin1( "public slots" ); - return TQString::fromLatin1( "public" ); - - case CodeModelItem::Protected: - if ( fun->isSlot() ) - return TQString::fromLatin1( "protected slots" ); - return TQString::fromLatin1( "protected" ); - - case CodeModelItem::Private: - if ( fun->isSlot() ) - return TQString::fromLatin1( "private slots" ); - return TQString::fromLatin1( "private" ); - } - - return TQString(); -} - -void QtDesignerCppIntegration::processImplementationName( TQString &name ) -{ - name.replace( ".h", ".cpp" ); -} - -#include "tqtdesignercppintegration.moc" - -//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/qtdesignercppintegration.h b/languages/cpp/qtdesignercppintegration.h deleted file mode 100644 index 0e63f652..00000000 --- a/languages/cpp/qtdesignercppintegration.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2004 by Alexander Dymo * -* adymo@mksat.net * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -***************************************************************************/ -#ifndef TQTDESIGNERCPPINTEGRATION_H -#define TQTDESIGNERCPPINTEGRATION_H - -#include - -class QtDesignerCppIntegration : public QtDesignerIntegration -{ - Q_OBJECT - -public: - QtDesignerCppIntegration( KDevLanguageSupport *part, ImplementationWidget *impl ); - -protected: - virtual void addFunctionToClass( KInterfaceDesigner::Function function, ClassDom klass ); - TQString accessID( FunctionDom fun ) const; - - virtual void processImplementationName( TQString &name ); -}; - -#endif -// kate: indent-mode csands; tab-width 4; - diff --git a/languages/cpp/tqtdesignercppintegration.cpp b/languages/cpp/tqtdesignercppintegration.cpp new file mode 100644 index 00000000..21db2b63 --- /dev/null +++ b/languages/cpp/tqtdesignercppintegration.cpp @@ -0,0 +1,218 @@ +/*************************************************************************** +* Copyright (C) 2004 by Alexander Dymo * +* adymo@mksat.net * +* Portions Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org) * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +***************************************************************************/ +#include "tqtdesignercppintegration.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "backgroundparser.h" +#include "cppsupportpart.h" +#include "codemodel_utils.h" +#include "implementationwidget.h" + +QtDesignerCppIntegration::QtDesignerCppIntegration( KDevLanguageSupport *part, + ImplementationWidget *impl ) +: QtDesignerIntegration( part, impl, true, 0 ) +{} + +void QtDesignerCppIntegration::addFunctionToClass( KInterfaceDesigner::Function function, ClassDom klass ) +{ + m_part->partController() ->editDocument( KURL( klass->fileName() ) ); + KTextEditor::EditInterface* editIface = dynamic_cast( m_part->partController() ->activePart() ); + if ( !editIface ) + { + /// @todo show messagebox + // TQDialog::accept(); + return ; + } + + int line, column; + klass->getEndPosition( &line, &column ); + + // compute the insertion point map + TQMap > points; + + const FunctionList functionList = klass->functionList(); + for ( FunctionList::ConstIterator it = functionList.begin(); it != functionList.end(); ++it ) + { + int funEndLine, funEndColumn; + ( *it ) ->getEndPosition( &funEndLine, &funEndColumn ); + TQString access = accessID( *it ); + TQPair funEndPoint = tqMakePair( funEndLine, funEndColumn ); + + if ( !points.contains( access ) || points[ access ] < funEndPoint ) + { + points[ access ] = funEndPoint; + } + } + + int insertedLine = 0; + + TQString access = function.access + ( function.type == KInterfaceDesigner::ftTQtSlot ? " slots" : "" ); + + TQString str = function.returnType + " " + function.function; + if ( function.specifier == "virtual" ) + str = "virtual " + str; + else if ( function.specifier == "pure virtual" ) + str = "virtual " + str + " = 0"; + else if ( function.specifier == "static" ) + str = "static " + str; + str += ";\n"; + str = " " + str; + + TQPair pt; + if ( points.contains( access ) ) + { + pt = points[ access ]; + } + else + { + str.prepend( access + ":\n" ); + points[ access ] = tqMakePair( line - 1, 0 ); + pt = points[ access ]; // end of class declaration + } + + editIface->insertText( pt.first + insertedLine + 1, 0 /*pt.second*/, str ); + insertedLine += str.contains( TQChar( '\n' ) ); + + CppSupportPart *cppPart = dynamic_cast( m_part ); + cppPart->backgroundParser() ->addFile( klass->fileName() ); + + if ( function.specifier == "pure virtual" ) + return ; + + + //implementation + TQString stri = function.returnType + " " + klass->name() + "::" + function.function; + if ( function.specifier == "static" ) + stri = "static " + stri; + stri += "\n{\n}\n"; + stri = "\n" + stri; + + TQFileInfo fi( klass->fileName() ); + TQString implementationFile = fi.absFilePath(); + implementationFile.replace( ".h", ".cpp" ); + + TQFileInfo fileInfo( implementationFile ); + if ( !TQFile::exists( fileInfo.absFilePath() ) ) + { + if ( KDevCreateFile * createFileSupp = m_part->extension( "TDevelop/CreateFile" ) ) + createFileSupp->createNewFile( fileInfo.extension(), fileInfo.dirPath( true ), fileInfo.fileName() ); + } + + m_part->partController() ->editDocument( KURL( implementationFile ) ); + editIface = dynamic_cast( m_part->partController() ->activePart() ); + if ( !editIface ) + return ; + + int atLine = 0, atColumn = 0; + TranslationUnitAST *translationUnit = 0; + ParsedFilePointer p = cppPart->backgroundParser() ->translationUnit( implementationFile ); + if( p ) translationUnit = *p; + if ( translationUnit ) + { + translationUnit->getEndPosition( &atLine, &atColumn ); + kdDebug() << "atLine: " << atLine << endl; + stri = "\n" + stri; + } + else + { + atLine = editIface->numLines(); + line = editIface->numLines(); + while ( line > 0 ) + { + if ( editIface->textLine( line ).isEmpty() ) + { + --line; + continue; + } + else + { + if ( editIface->textLine( line ).contains( TQRegExp( ".*#include .*\\.moc.*" ) ) ) + atLine = line; + break; + } + } + kdDebug() << "atLine (2): " << atLine << endl; + atColumn = 0; + } + + // editIface->insertLine( atLine + 1, TQString::fromLatin1("") ); + kdDebug() << "at line in intg: " << atLine << " atCol: " << atColumn << endl; + kdDebug() << "text: " << stri << endl; + editIface->insertText( atLine, atColumn, stri ); + KTextEditor::View *activeView = dynamic_cast( m_part->partController() ->activePart() ->widget() ); + if ( activeView ) + { + KTextEditor::ViewCursorInterface * cursor = dynamic_cast( activeView ); + if ( cursor ) + cursor->setCursorPositionReal( atLine + 3, 1 ); + } + + cppPart->backgroundParser() ->addFile( implementationFile ); +} + +TQString QtDesignerCppIntegration::accessID( FunctionDom fun ) const +{ + if ( fun->isSignal() ) + return TQString::fromLatin1( "signals" ); + + switch ( fun->access() ) + { + case CodeModelItem::Public: + if ( fun->isSlot() ) + return TQString::fromLatin1( "public slots" ); + return TQString::fromLatin1( "public" ); + + case CodeModelItem::Protected: + if ( fun->isSlot() ) + return TQString::fromLatin1( "protected slots" ); + return TQString::fromLatin1( "protected" ); + + case CodeModelItem::Private: + if ( fun->isSlot() ) + return TQString::fromLatin1( "private slots" ); + return TQString::fromLatin1( "private" ); + } + + return TQString(); +} + +void QtDesignerCppIntegration::processImplementationName( TQString &name ) +{ + name.replace( ".h", ".cpp" ); +} + +#include "tqtdesignercppintegration.moc" + +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/tqtdesignercppintegration.h b/languages/cpp/tqtdesignercppintegration.h new file mode 100644 index 00000000..0e63f652 --- /dev/null +++ b/languages/cpp/tqtdesignercppintegration.h @@ -0,0 +1,41 @@ +/*************************************************************************** +* Copyright (C) 2004 by Alexander Dymo * +* adymo@mksat.net * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +***************************************************************************/ +#ifndef TQTDESIGNERCPPINTEGRATION_H +#define TQTDESIGNERCPPINTEGRATION_H + +#include + +class QtDesignerCppIntegration : public QtDesignerIntegration +{ + Q_OBJECT + +public: + QtDesignerCppIntegration( KDevLanguageSupport *part, ImplementationWidget *impl ); + +protected: + virtual void addFunctionToClass( KInterfaceDesigner::Function function, ClassDom klass ); + TQString accessID( FunctionDom fun ) const; + + virtual void processImplementationName( TQString &name ); +}; + +#endif +// kate: indent-mode csands; tab-width 4; + -- cgit v1.2.1