diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
commit | 48d4a26399959121f33d2bc3bfe51c7827b654fc (patch) | |
tree | 5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /kdevdesigner/designer/project.cpp | |
parent | 7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff) | |
download | tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.tar.gz tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.zip |
TQt4 port kdevelop
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/designer/project.cpp')
-rw-r--r-- | kdevdesigner/designer/project.cpp | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/kdevdesigner/designer/project.cpp b/kdevdesigner/designer/project.cpp index a714bd07..5c700a0f 100644 --- a/kdevdesigner/designer/project.cpp +++ b/kdevdesigner/designer/project.cpp @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** -**1 This file is part of Qt Designer. +**1 This file is part of TQt Designer. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition -** licenses may use this file in accordance with the Qt Commercial License +** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition +** licenses may use this file in accordance with the TQt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -17,7 +17,7 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. @@ -29,7 +29,7 @@ #include "designerappiface.h" #include "../interfaces/languageinterface.h" #include "pixmapcollection.h" -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL #include "dbconnectionimpl.h" #endif #include "resource.h" @@ -48,7 +48,7 @@ #include "mainwindow.h" #include <tqworkspace.h> -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL #include <tqsqldatabase.h> #include <tqsqlrecord.h> #include <tqdatatable.h> @@ -61,7 +61,7 @@ #include <klocale.h> -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL DatabaseConnection::~DatabaseConnection() { delete iface; @@ -69,7 +69,7 @@ DatabaseConnection::~DatabaseConnection() bool DatabaseConnection::refreshCatalog() { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( loaded ) return TRUE; if ( !open() ) @@ -91,7 +91,7 @@ bool DatabaseConnection::refreshCatalog() #endif } -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL void DatabaseConnection::remove() { if ( nm == "(default)" ) @@ -105,15 +105,15 @@ void DatabaseConnection::remove() bool DatabaseConnection::open( bool suppressDialog ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL // register our name, if nec if ( nm == "(default)" ) { - if ( !TQSqlDatabase::contains() ) // default doesn't exists? + if ( !TQSqlDatabase::tqcontains() ) // default doesn't exists? conn = TQSqlDatabase::addDatabase( drv ); else conn = TQSqlDatabase::database(); } else { - if ( !TQSqlDatabase::contains( nm ) ) + if ( !TQSqlDatabase::tqcontains( nm ) ) conn = TQSqlDatabase::addDatabase( drv, nm ); else conn = TQSqlDatabase::database( nm ); @@ -152,7 +152,7 @@ bool DatabaseConnection::open( bool suppressDialog ) + TQString( "[" + conn->lastError().driverText() + "\n" + conn->lastError().databaseText() + "]\n" ), i18n( "&OK" ), - i18n( "&Cancel" ), TQString::null, 0, 1 ) ) { + i18n( "&Cancel" ), TQString(), 0, 1 ) ) { case 0: // OK or Enter continue; case 1: // Cancel or Escape @@ -178,7 +178,7 @@ void DatabaseConnection::close() { if ( !loaded ) return; -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( conn ) { conn->close(); } @@ -202,7 +202,7 @@ bool Project::isDummy() const } Project::Project( const TQString &fn, const TQString &pName, - QPluginManager<ProjectSettingsInterface> *pm, bool isDummy, + TQPluginManager<ProjectSettingsInterface> *pm, bool isDummy, const TQString &l ) : proName( pName ), projectSettingsPluginManager( pm ), isDummyProject( isDummy ) { @@ -236,7 +236,7 @@ void Project::setModified( bool b ) emit projectModified(); } -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL DatabaseConnection *Project::databaseConnection( const TQString &name ) { for ( DatabaseConnection *conn = dbConnections.first(); @@ -285,8 +285,8 @@ void Project::setFileName( const TQString &fn, bool doClear ) } - if ( proName.contains( '.' ) ) - proName = proName.left( proName.find( '.' ) ); + if ( proName.tqcontains( '.' ) ) + proName = proName.left( proName.tqfind( '.' ) ); if ( !doClear ) return; @@ -389,7 +389,7 @@ TQStringList parse_multiline_part( const TQString &contents, const TQString &key c == '$' || c == '-' || c == '(' || c == ')' || c == ':' || c == '+' || c == ',' || c == '~' ) && c != ' ' && c != '\t' && c != '\n' ) { if ( !inName ) - currName = TQString::null; + currName = TQString(); if ( c != '\\' || contents[i+1] != '\n' ) { currName += c; inName = TRUE; @@ -424,7 +424,7 @@ void Project::parse() TQStringList::ConstIterator it; - int i = contents.find( "LANGUAGE" ); + int i = contents.tqfind( "LANGUAGE" ); if ( i != -1 ) { lang = ""; is_cpp = FALSE; @@ -433,7 +433,7 @@ void Project::parse() is_cpp = lang == "C++"; } - i = contents.find( "DBFILE" ); + i = contents.tqfind( "DBFILE" ); if ( i != -1 ) { dbFile = ""; TQString part = contents.mid( i + TQString( "DBFILE" ).length() ); @@ -449,7 +449,7 @@ void Project::parse() } - i = contents.find( "TEMPLATE" ); + i = contents.tqfind( "TEMPLATE" ); if ( i != -1 ) { templ = ""; TQString part = contents.mid( i + TQString( "TEMPLATE" ).length() ); @@ -477,12 +477,12 @@ void Project::parse() updateCustomSettings(); for ( it = csList.begin(); it != csList.end(); ++it ) { - i = contents.find( *it ); + i = contents.tqfind( *it ); if ( i != -1 ) { TQString val = ""; TQString part = contents.mid( i + TQString( *it ).length() ); val = parse_part( part ); - customSettings.replace( *it, val ); + customSettings.tqreplace( *it, val ); } } @@ -511,7 +511,7 @@ void Project::clear() bool Project::removeSourceFile( SourceFile *sf ) { - if ( !sourcefiles.containsRef( sf ) ) + if ( !sourcefiles.tqcontainsRef( sf ) ) return FALSE; if ( !sf->close() ) return FALSE; @@ -569,10 +569,10 @@ TQString Project::makeRelative( const TQString &f ) static void remove_contents( TQString &contents, const TQString &s ) { - int i = contents.find( s ); + int i = contents.tqfind( s ); if ( i != -1 ) { int start = i; - int end = contents.find( '\n', i ); + int end = contents.tqfind( '\n', i ); if ( end == -1 ) end = contents.length() - 1; contents.remove( start, end - start + 1 ); @@ -581,7 +581,7 @@ static void remove_contents( TQString &contents, const TQString &s ) static void remove_multiline_contents( TQString &contents, const TQString &s, int *strt = 0 ) { - int i = contents.find( s ); + int i = contents.tqfind( s ); if ( strt ) *strt = i; int start = i; @@ -691,7 +691,7 @@ void Project::save( bool onlyProjectFile ) contents += "unix {\n" " UI_DIR = .ui\n" - " MOC_DIR = .moc\n" + " TQMOC_DIR = .tqmoc\n" " OBJECTS_DIR = .obj\n" "}\n"; } @@ -704,7 +704,7 @@ void Project::save( bool onlyProjectFile ) TQString key = iface->projectKeyForExtension( TQFileInfo( f->fileName() ).extension() ); TQStringList lst = sourceToKey[ key ]; lst << makeRelative( f->fileName() ); - sourceToKey.replace( key, lst ); + sourceToKey.tqreplace( key, lst ); } for ( TQMap<TQString, TQStringList>::Iterator skit = sourceToKey.begin(); @@ -751,7 +751,7 @@ void Project::save( bool onlyProjectFile ) // custom settings for ( TQStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) { - TQString val = *customSettings.find( *it ); + TQString val = *customSettings.tqfind( *it ); if ( !val.isEmpty() ) contents += *it + "\t= " + val + "\n"; } @@ -778,21 +778,21 @@ void Project::save( bool onlyProjectFile ) } } -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL TQPtrList<DatabaseConnection> Project::databaseConnections() const { return dbConnections; } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL void Project::setDatabaseConnections( const TQPtrList<DatabaseConnection> &lst ) { dbConnections = lst; } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL void Project::addDatabaseConnection( DatabaseConnection *conn ) { dbConnections.append( conn ); @@ -800,7 +800,7 @@ void Project::addDatabaseConnection( DatabaseConnection *conn ) } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL void Project::removeDatabaseConnection( const TQString &c ) { for ( DatabaseConnection *conn = dbConnections.first(); conn; conn = dbConnections.next() ) { @@ -814,7 +814,7 @@ void Project::removeDatabaseConnection( const TQString &c ) } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL TQStringList Project::databaseConnectionList() { TQStringList lst; @@ -824,7 +824,7 @@ TQStringList Project::databaseConnectionList() } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL TQStringList Project::databaseTableList( const TQString &connection ) { DatabaseConnection *conn = databaseConnection( connection ); @@ -835,7 +835,7 @@ TQStringList Project::databaseTableList( const TQString &connection ) } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL TQStringList Project::databaseFieldList( const TQString &connection, const TQString &table ) { DatabaseConnection *conn = databaseConnection( connection ); @@ -845,7 +845,7 @@ TQStringList Project::databaseFieldList( const TQString &connection, const TQStr } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL static TQString makeIndent( int indent ) { TQString s; @@ -854,7 +854,7 @@ static TQString makeIndent( int indent ) } #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL static void saveSingleProperty( TQTextStream &ts, const TQString& name, const TQString& value, int indent ) { ts << makeIndent( indent ) << "<property name=\"" << name << "\">" << endl; @@ -867,7 +867,7 @@ static void saveSingleProperty( TQTextStream &ts, const TQString& name, const TQ void Project::saveConnections() { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( dbFile.isEmpty() ) { TQFileInfo fi( fileName() ); setDatabaseDescription( fi.baseName() + ".db" ); @@ -934,7 +934,7 @@ void Project::saveConnections() #endif } -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL static TQDomElement loadSingleProperty( TQDomElement e, const TQString& name ) { TQDomElement n; @@ -950,7 +950,7 @@ static TQDomElement loadSingleProperty( TQDomElement e, const TQString& name ) void Project::loadConnections() { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( dbFile.isEmpty() || !TQFile::exists( makeAbsolute( dbFile ) ) ) return; @@ -1021,7 +1021,7 @@ can be closed again with closeDatabase(). bool Project::openDatabase( const TQString &connection, bool suppressDialog ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL DatabaseConnection *conn = databaseConnection( connection ); if ( connection.isEmpty() && !conn ) conn = databaseConnection( "(default)" ); @@ -1040,7 +1040,7 @@ bool Project::openDatabase( const TQString &connection, bool suppressDialog ) */ void Project::closeDatabase( const TQString &connection ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL DatabaseConnection *conn = databaseConnection( connection ); if ( connection.isEmpty() && !conn ) conn = databaseConnection( "(default)" ); @@ -1105,7 +1105,7 @@ void Project::setCustomSetting( const TQString &key, const TQString &value ) TQString Project::customSetting( const TQString &key ) const { - return *customSettings.find( key ); + return *customSettings.tqfind( key ); } void Project::updateCustomSettings() @@ -1115,14 +1115,14 @@ void Project::updateCustomSettings() /* ProjectSettingsInterface *iface = 0; - projectSettingsPluginManager->queryInterface( lang, (QUnknownInterface**)&iface ); + projectSettingsPluginManager->queryInterface( lang, (TQUnknownInterface**)&iface ); if ( !iface ) return; csList = iface->projectSettings(); iface->release(); */ - QInterfacePtr<ProjectSettingsInterface> iface; + TQInterfacePtr<ProjectSettingsInterface> iface; projectSettingsPluginManager->queryInterface( lang, &iface ); if ( !iface ) return; @@ -1170,23 +1170,23 @@ void Project::setIncludePath( const TQString &platform, const TQString &path ) { if ( inclPath[platform] == path ) return; - inclPath.replace( platform, path ); + inclPath.tqreplace( platform, path ); modified = TRUE; } void Project::setLibs( const TQString &platform, const TQString &path ) { - lbs.replace( platform, path ); + lbs.tqreplace( platform, path ); } void Project::setDefines( const TQString &platform, const TQString &path ) { - defs.replace( platform, path ); + defs.tqreplace( platform, path ); } void Project::setConfig( const TQString &platform, const TQString &config ) { - cfg.replace( platform, config ); + cfg.tqreplace( platform, config ); } TQString Project::config( const TQString &platform ) const @@ -1223,8 +1223,8 @@ void Project::readPlatformSettings( const TQString &contents, const TQString &setting, TQMap<TQString, TQString> &res ) { - const TQString platforms[] = { "", "win32", "unix", "mac", TQString::null }; - for ( int i = 0; platforms[ i ] != TQString::null; ++i ) { + const TQString platforms[] = { "", "win32", "unix", "mac", TQString() }; + for ( int i = 0; platforms[ i ] != TQString(); ++i ) { TQString p = platforms[ i ]; if ( !p.isEmpty() ) p += ":"; @@ -1233,14 +1233,14 @@ void Project::readPlatformSettings( const TQString &contents, TQString key = platforms[ i ]; if ( key.isEmpty() ) key = "(all)"; - res.replace( key, s ); + res.tqreplace( key, s ); } } void Project::removePlatformSettings( TQString &contents, const TQString &setting ) { - const TQString platforms[] = { "win32", "unix", "mac", "", TQString::null }; - for ( int i = 0; platforms[ i ] != TQString::null; ++i ) { + const TQString platforms[] = { "win32", "unix", "mac", "", TQString() }; + for ( int i = 0; platforms[ i ] != TQString(); ++i ) { TQString p = platforms[ i ]; if ( !p.isEmpty() ) p += ":"; @@ -1251,21 +1251,21 @@ void Project::removePlatformSettings( TQString &contents, const TQString &settin void Project::writePlatformSettings( TQString &contents, const TQString &setting, const TQMap<TQString, TQString> &input ) { - const TQString platforms[] = { "", "win32", "unix", "mac", TQString::null }; + const TQString platforms[] = { "", "win32", "unix", "mac", TQString() }; int i; LanguageInterface *iface = MetaDataBase::languageInterface( lang ); if (iface && (setting == "SOURCES" || setting == "HEADERS")) // The (all) part will be saved later on i = 1; else i = 0; - for (; platforms[ i ] != TQString::null; ++i ) { + for (; platforms[ i ] != TQString(); ++i ) { TQString p = platforms[ i ]; if ( !p.isEmpty() ) p += ":"; TQString key = platforms[ i ]; if ( key.isEmpty() ) key = "(all)"; - TQMap<TQString, TQString>::ConstIterator it = input.find( key ); + TQMap<TQString, TQString>::ConstIterator it = input.tqfind( key ); if ( it == input.end() || (*it).isEmpty() ) continue; contents += p + setting + "\t+= " + *it + "\n"; @@ -1281,7 +1281,7 @@ void Project::addFormFile( FormFile *ff ) bool Project::removeFormFile( FormFile *ff ) { - if ( !formfiles.containsRef( ff ) ) + if ( !formfiles.tqcontainsRef( ff ) ) return FALSE; if ( !ff->close() ) return FALSE; @@ -1300,8 +1300,8 @@ void Project::addObject( TQObject *o ) fakeFormFiles.insert( (void*)o, ff ); MetaDataBase::addEntry( o ); if ( hasGUI() ) { - TQWidget *parent = MainWindow::self ? MainWindow::self->qWorkspace() : 0; - FormWindow *fw = new FormWindow( ff, MainWindow::self, parent, "qt_fakewindow" ); + TQWidget *tqparent = MainWindow::self ? MainWindow::self->qWorkspace() : 0; + FormWindow *fw = new FormWindow( ff, MainWindow::self, tqparent, "qt_fakewindow" ); fw->setProject( this ); if ( TQFile::exists( ff->absFileName() ) ) Resource::loadExtraSource( ff, ff->absFileName(), @@ -1316,8 +1316,8 @@ void Project::addObject( TQObject *o ) TQT_SLOT( updateUndoRedo( bool, bool, const TQString &, const TQString & ) ) ); } - if ( fw->parentWidget() ) { - fw->parentWidget()->setFixedSize( 1, 1 ); + if ( fw->tqparentWidget() ) { + fw->tqparentWidget()->setFixedSize( 1, 1 ); fw->show(); } } else { @@ -1352,7 +1352,7 @@ TQObjectList Project::objects() const FormFile *Project::fakeFormFileFor( TQObject *o ) const { - return fakeFormFiles.find( (void*)o ); + return fakeFormFiles.tqfind( (void*)o ); } TQObject *Project::objectForFakeForm( FormWindow *fw ) const @@ -1396,7 +1396,7 @@ void Project::removeTempProject() } d.remove( TQFileInfo( filename ).dirPath() ); #if defined(Q_OS_UNIX) - // ##### implement for all platforms, ideally should be in Qt + // ##### implement for all platforms, ideally should be in TQt ::rmdir( TQFile::encodeName( d.absPath() ) ); #endif } @@ -1411,14 +1411,14 @@ void Project::addAndEditFunction( const TQString &function, const TQString &func return; iface->functions( f->text(), &funcs ); TQString func = function; - int i = func.find( '(' ); + int i = func.tqfind( '(' ); if ( i != -1 ) func = func.left( i ); bool found = FALSE; for ( TQValueList<LanguageInterface::Function>::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { - if ( (*it).name.left( (*it).name.find( '(' ) ) == func ) { + if ( (*it).name.left( (*it).name.tqfind( '(' ) ) == func ) { found = TRUE; break; } @@ -1460,12 +1460,12 @@ bool Project::hasParentObject( TQObject *o ) TQString Project::qualifiedName( TQObject *o ) { TQString name = o->name(); - TQObject *p = o->parent(); + TQObject *p = o->tqparent(); while ( p ) { name.prepend( TQString( p->name() ) + "." ); - if ( objs.findRef( p ) != -1 ) + if ( objs.tqfindRef( p ) != -1 ) break; - p = p->parent(); + p = p->tqparent(); } return name; } @@ -1494,7 +1494,7 @@ void Project::designerCreated() fw->reparent( MainWindow::self->qWorkspace(), TQPoint( 0, 0 ), FALSE ); TQApplication::sendPostedEvents( MainWindow::self->qWorkspace(), TQEvent::ChildInserted ); - fw->parentWidget()->setFixedSize( 1, 1 ); + fw->tqparentWidget()->setFixedSize( 1, 1 ); fw->show(); } } @@ -1509,13 +1509,13 @@ void Project::formOpened( FormWindow *fw ) TQString Project::locationOfObject( TQObject *o ) { if ( !o ) - return TQString::null; + return TQString(); if ( MainWindow::self ) { TQWidgetList windows = MainWindow::self->qWorkspace()->windowList(); for ( TQWidget *w = windows.first(); w; w = windows.next() ) { - FormWindow *fw = ::qt_cast<FormWindow*>(w); - SourceEditor *se = ::qt_cast<SourceEditor*>(w); + FormWindow *fw = ::tqqt_cast<FormWindow*>(w); + SourceEditor *se = ::tqqt_cast<SourceEditor*>(w); if ( fw ) { if ( fw->isFake() ) return objectForFakeForm( fw )->name() + TQString( " [Source]" ); @@ -1532,7 +1532,7 @@ TQString Project::locationOfObject( TQObject *o ) } } - if ( ::qt_cast<SourceFile*>(o) ) { + if ( ::tqqt_cast<SourceFile*>(o) ) { for ( TQPtrListIterator<SourceFile> sources = sourceFiles(); sources.current(); ++sources ) { SourceFile* f = sources.current(); @@ -1544,15 +1544,15 @@ TQString Project::locationOfObject( TQObject *o ) extern TQMap<TQWidget*, TQString> *qwf_forms; if ( !qwf_forms ) { qWarning( "Project::locationOfObject: qwf_forms is NULL!" ); - return TQString::null; + return TQString(); } - TQString s = makeRelative( *qwf_forms->find( (TQWidget*)o ) ); + TQString s = makeRelative( *qwf_forms->tqfind( (TQWidget*)o ) ); s += " [Source]"; return s; } bool Project::hasGUI() const { - return qApp->type() != TQApplication::Tty; + return tqApp->type() != TQApplication::Tty; } |