summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/formfile.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-14 16:45:05 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-14 16:45:05 +0000
commit48d4a26399959121f33d2bc3bfe51c7827b654fc (patch)
tree5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /kdevdesigner/designer/formfile.cpp
parent7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff)
downloadtdevelop-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/formfile.cpp')
-rw-r--r--kdevdesigner/designer/formfile.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/kdevdesigner/designer/formfile.cpp b/kdevdesigner/designer/formfile.cpp
index e65ed706..1e9c489d 100644
--- a/kdevdesigner/designer/formfile.cpp
+++ b/kdevdesigner/designer/formfile.cpp
@@ -1,15 +1,15 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
-** This file is part of Qt Designer.
+** 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.
@@ -50,17 +50,17 @@
static TQString make_func_pretty( const TQString &s )
{
TQString res = s;
- if ( res.find( ")" ) - res.find( "(" ) == 1 )
+ if ( res.tqfind( ")" ) - res.tqfind( "(" ) == 1 )
return res;
- res.replace( "(", "( " );
- res.replace( ")", " )" );
- res.replace( "&", " &" );
- res.replace( "*", " *" );
- res.replace( ",", ", " );
- res.replace( ":", " : " );
+ res.tqreplace( "(", "( " );
+ res.tqreplace( ")", " )" );
+ res.tqreplace( "&", " &" );
+ res.tqreplace( "*", " *" );
+ res.tqreplace( ",", ", " );
+ res.tqreplace( ":", " : " );
res = res.simplifyWhiteSpace();
- res.replace( " : : ", "::" );
- res.replace( ">>", "> >" );
+ res.tqreplace( " : : ", "::" );
+ res.tqreplace( ">>", "> >" );
return res;
}
@@ -77,13 +77,13 @@ FormFile::FormFile( const TQString &fn, bool temp, Project *p, const char *name
if ( !temp )
checkFileName( FALSE );
- connect(this, TQT_SIGNAL(somethingChanged(FormFile* )), this, TQT_SLOT(emitNewStatus(FormFile* )));
+ connect(this, TQT_SIGNAL(somethingChanged(FormFile* )), this, TQT_SLOT(emitNewtqStatus(FormFile* )));
}
FormFile::~FormFile()
{
pro->removeFormFile( this );
- if ( formWindow() )
+ if ( TQT_TQOBJECT(formWindow()) )
formWindow()->setFormFile( 0 );
}
@@ -111,7 +111,7 @@ void FormFile::setFileName( const TQString &fn )
return;
if ( fn.isEmpty() ) {
fileNameTemp = TRUE;
- if ( filename.find( "unnamed" ) != 0 )
+ if ( filename.tqfind( "unnamed" ) != 0 )
filename = createUnnamedFileName();
return;
} else {
@@ -170,7 +170,7 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
if ( ed )
ed->save();
- if ( formWindow() && isModified( WFormWindow ) ) {
+ if ( TQT_TQOBJECT(formWindow()) && isModified( WFormWindow ) ) {
if ( withMsgBox ) {
if ( !formWindow()->checkCustomWidgets() )
return FALSE;
@@ -192,7 +192,7 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
f2.writeBlock( data );
} else {
TQMessageBox::warning( MainWindow::self, i18n( "Save" ),
- i18n( "The file %1 could not be saved" ).arg( codeFile() ) );
+ i18n( "The file %1 could not be saved" ).tqarg( codeFile() ) );
}
}
}
@@ -213,21 +213,21 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
TQCString data( f.size() );
f.readBlock( data.data(), f.size() );
f2.writeBlock( data );
- } else if ( qApp->type() != TQApplication::Tty ) {
+ } else if ( tqApp->type() != TQApplication::Tty ) {
TQMessageBox::warning( MainWindow::self, i18n( "Save" ),
- i18n( "The file %1 could not be saved" ).arg( codeFile() ) );
+ i18n( "The file %1 could not be saved" ).tqarg( codeFile() ) );
}
}
}
}
- if ( formWindow() ) {
+ if ( TQT_TQOBJECT(formWindow()) ) {
Resource resource( MainWindow::self );
resource.setWidget( formWindow() );
bool formCodeOnly = isModified( WFormCode ) && !isModified( WFormWindow );
if ( !resource.save( pro->makeAbsolute( filename ), formCodeOnly ) ) {
if ( MainWindow::self )
- MainWindow::self->statusMessage( i18n( "Failed to save file '%1'.").arg( formCodeOnly ? codeFile(): filename ) );
+ MainWindow::self->statusMessage( i18n( "Failed to save file '%1'.").tqarg( formCodeOnly ? codeFile(): filename ) );
if ( formCodeOnly )
return FALSE;
return saveAs();
@@ -247,23 +247,23 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
bool FormFile::saveAs( bool ignoreModified )
{
TQString f = pro->makeAbsolute( fileName() );
- if ( fileNameTemp && formWindow() ) {
+ if ( fileNameTemp && TQT_TQOBJECT(formWindow()) ) {
f = TQString( formWindow()->name() ).lower();
- f.replace( "::", "_" );
+ f.tqreplace( "::", "_" );
f = pro->makeAbsolute( f + ".ui" );
}
bool saved = FALSE;
if ( ignoreModified ) {
- TQString dir = TQStringList::split( ':', pro->iFace()->customSetting( "QTSCRIPT_PACKAGES" ) ).first();
+ TQString dir = TQStringList::split( ':', pro->iFace()->customSetting( "TQTSCRIPT_PACKAGES" ) ).first();
f = TQFileInfo( f ).fileName();
f.prepend( dir + "/" );
}
TQString fn;
while ( !saved ) {
fn = KFileDialog::getSaveFileName( f,
- i18n( "*.ui|Qt User-Interface Files" ) + "\n" +
+ i18n( "*.ui|TQt User-Interface Files" ) + "\n" +
i18n( "*|All Files" ), MainWindow::self, /*0,*/
- i18n( "Save Form '%1' As").arg( formName() )/*,
+ i18n( "Save Form '%1' As").tqarg( formName() )/*,
MainWindow::self ? &MainWindow::self->lastSaveFilter : 0*/ );
if ( fn.isEmpty() )
return FALSE;
@@ -293,8 +293,8 @@ bool FormFile::saveAs( bool ignoreModified )
}
pro->setModified( TRUE );
timeStamp.setFileName( pro->makeAbsolute( codeFile() ) );
- if ( ed && formWindow() )
- ed->setCaption( i18n( "Edit %1" ).arg( formWindow()->name() ) );
+ if ( ed && TQT_TQOBJECT(formWindow()) )
+ ed->setCaption( i18n( "Edit %1" ).tqarg( formWindow()->name() ) );
setModified( TRUE );
if ( pro->isDummy() )
fw->mainWindow()->addRecentlyOpenedFile( fn );
@@ -307,7 +307,7 @@ bool FormFile::close()
editor()->save();
editor()->close();
}
- if ( formWindow() )
+ if ( TQT_TQOBJECT(formWindow()) )
return formWindow()->close();
return TRUE;
}
@@ -326,7 +326,7 @@ bool FormFile::closeEvent()
editor()->save();
switch ( TQMessageBox::warning( MainWindow::self, i18n( "Save Form" ),
- i18n( "Save changes to form '%1'?" ).arg( filename ),
+ i18n( "Save changes to form '%1'?" ).tqarg( filename ),
i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) {
case 0: // save
if ( !save() )
@@ -372,7 +372,7 @@ bool FormFile::isModified( int who )
bool FormFile::isFormWindowModified() const
{
- if ( !formWindow() || !formWindow()->commandHistory() )
+ if ( !TQT_TQOBJECT(formWindow()) || !formWindow()->commandHistory() )
return FALSE;
return formWindow()->commandHistory()->isModified();
}
@@ -389,7 +389,7 @@ void FormFile::setFormWindowModified( bool m )
bool b = isFormWindowModified();
if ( m == b )
return;
- if ( !formWindow() || !formWindow()->commandHistory() )
+ if ( !TQT_TQOBJECT(formWindow()) || !formWindow()->commandHistory() )
return;
formWindow()->commandHistory()->setModified( m );
emit somethingChanged( this );
@@ -411,13 +411,13 @@ void FormFile::showFormWindow()
{
if ( !MainWindow::self )
return;
- if ( formWindow() ) {
+ if ( TQT_TQOBJECT(formWindow()) ) {
if ( ( formWindow()->hasFocus() ||
- MainWindow::self->qWorkspace()->activeWindow() == formWindow() ) &&
- MainWindow::self->propertyeditor()->formWindow() != formWindow() ) {
- MainWindow::self->propertyeditor()->setWidget( formWindow()->currentWidget(), formWindow() );
+ TQT_BASE_OBJECT(MainWindow::self->qWorkspace()->activeWindow()) == TQT_BASE_OBJECT(formWindow()) ) &&
+ TQT_BASE_OBJECT(MainWindow::self->propertyeditor()->formWindow()) != TQT_BASE_OBJECT(formWindow()) ) {
+ MainWindow::self->propertyeditor()->setWidget( TQT_TQOBJECT(formWindow()->currentWidget()), formWindow() );
MainWindow::self->objectHierarchy()->setFormWindow( formWindow(),
- formWindow()->currentWidget() );
+ TQT_TQOBJECT(formWindow()->currentWidget()) );
}
formWindow()->setFocus();
return;
@@ -493,7 +493,7 @@ TQString FormFile::codeComment() const
"** ui.h extension file, included from the uic-generated form implementation.\n"
"**\n"
"** If you want to add, delete, or rename functions or slots, use\n"
- "** Qt Designer to update this file, preserving your code.\n"
+ "** TQt Designer to update this file, preserving your code.\n"
"**\n"
"** You should not define a constructor or destructor in this file.\n"
"** Instead, write your code in functions called init() and destroy().\n"
@@ -519,14 +519,14 @@ void FormFile::setCodeFileState( UihState s )
void FormFile::createFormCode()
{
- if ( !formWindow() )
+ if ( !TQT_TQOBJECT(formWindow()) )
return;
LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() );
if ( !iface )
return;
if ( pro->isCpp() )
cod = codeComment();
- TQValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( formWindow() );
+ TQValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( TQT_TQOBJECT(formWindow()) );
for ( TQValueList<MetaDataBase::Function>::Iterator it = functionList.begin(); it != functionList.end(); ++it ) {
cod += (!cod.isEmpty() ? "\n\n" : "") +
iface->createFunctionStart( formWindow()->name(), make_func_pretty((*it).function),
@@ -573,14 +573,14 @@ void FormFile::setCodeEdited( bool b )
void FormFile::parseCode( const TQString &txt, bool allowModify )
{
- if ( !formWindow() )
+ if ( !TQT_TQOBJECT(formWindow()) )
return;
LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() );
if ( !iface )
return;
TQValueList<LanguageInterface::Function> functions;
TQValueList<MetaDataBase::Function> newFunctions, oldFunctions;
- oldFunctions = MetaDataBase::functionList( formWindow() );
+ oldFunctions = MetaDataBase::functionList( TQT_TQOBJECT(formWindow()) );
iface->functions( txt, &functions );
TQMap<TQString, TQString> funcs;
for ( TQValueList<LanguageInterface::Function>::Iterator it = functions.begin();
@@ -634,7 +634,7 @@ void FormFile::parseCode( const TQString &txt, bool allowModify )
if ( allowModify && oldFunctions.count() > 0 )
setFormWindowModified( TRUE );
- MetaDataBase::setFunctionList( formWindow(), newFunctions );
+ MetaDataBase::setFunctionList( TQT_TQOBJECT(formWindow()), newFunctions );
}
void FormFile::syncCode()
@@ -651,9 +651,9 @@ void FormFile::checkTimeStamp()
return;
timeStamp.update();
if ( codeEdited ) {
- if ( TQMessageBox::information( MainWindow::self, i18n( "Qt Designer" ),
- i18n( "File '%1' has been changed outside Qt Designer.\n"
- "Do you want to reload it?" ).arg( timeStamp.fileName() ),
+ if ( TQMessageBox::information( MainWindow::self, i18n( "TQt Designer" ),
+ i18n( "File '%1' has been changed outside TQt Designer.\n"
+ "Do you want to reload it?" ).tqarg( timeStamp.fileName() ),
i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) {
TQFile f( timeStamp.fileName() );
if ( f.open( IO_ReadOnly ) ) {
@@ -704,7 +704,7 @@ void FormFile::addFunctionCode( MetaDataBase::Function function )
if ( !hasFunc ) {
if ( !codeEdited && !timeStamp.isUpToDate() )
loadCode();
- MetaDataBase::MetaInfo mi = MetaDataBase::metaInfo( formWindow() );
+ MetaDataBase::MetaInfo mi = MetaDataBase::metaInfo( TQT_TQOBJECT(formWindow()) );
TQString cn;
if ( mi.classNameChanged )
cn = mi.className;
@@ -745,7 +745,7 @@ void FormFile::removeFunctionCode( MetaDataBase::Function function )
int line = 0;
int start = 0;
while ( line < (*fit).start - 1 ) {
- start = sourceCode.find( '\n', start );
+ start = sourceCode.tqfind( '\n', start );
if ( start == -1 )
return;
start++;
@@ -755,7 +755,7 @@ void FormFile::removeFunctionCode( MetaDataBase::Function function )
return;
int end = start;
while ( line < (*fit).end + 1 ) {
- end = sourceCode.find( '\n', end );
+ end = sourceCode.tqfind( '\n', end );
if ( end == -1 ) {
if ( line <= (*fit).end )
end = sourceCode.length() - 1;
@@ -777,7 +777,7 @@ void FormFile::functionNameChanged( const TQString &oldName, const TQString &new
{
if ( !cod.isEmpty() ) {
TQString funcStart = TQString( formWindow()->name() ) + TQString( "::" );
- int i = cod.find( funcStart + oldName );
+ int i = cod.tqfind( funcStart + oldName );
if ( i != -1 ) {
cod.remove( i + funcStart.length(), oldName.length() );
cod.insert( i + funcStart.length(), newName );
@@ -791,7 +791,7 @@ void FormFile::functionRetTypeChanged( const TQString &fuName, const TQString &o
TQString oldFunct = oldType + " " + TQString( formWindow()->name() ) + "::" + fuName;
TQString newFunct = newType + " " + TQString( formWindow()->name() ) + "::" + fuName;
- int i = cod.find( oldFunct );
+ int i = cod.tqfind( oldFunct );
if ( i != -1 ) {
cod.remove( i, oldFunct.length() );
cod.insert( i, newFunct );
@@ -802,7 +802,7 @@ void FormFile::functionRetTypeChanged( const TQString &fuName, const TQString &o
TQString FormFile::formName() const
{
FormFile* that = (FormFile*) this;
- if ( formWindow() ) {
+ if ( TQT_TQOBJECT(formWindow()) ) {
that->cachedFormName = formWindow()->name();
return cachedFormName;
}
@@ -816,7 +816,7 @@ TQString FormFile::formName() const
while ( !ts.eof() ) {
line = ts.readLine();
if ( !className.isEmpty() ) {
- int end = line.find( "</class>" );
+ int end = line.tqfind( "</class>" );
if ( end == -1 ) {
className += line;
} else {
@@ -826,8 +826,8 @@ TQString FormFile::formName() const
continue;
}
int start;
- if ( ( start = line.find( "<class>" ) ) != -1 ) {
- int end = line.find( "</class>" );
+ if ( ( start = line.tqfind( "<class>" ) ) != -1 ) {
+ int end = line.tqfind( "</class>" );
if ( end == -1 ) {
className = line.mid( start + 7 );
} else {
@@ -854,12 +854,12 @@ bool FormFile::checkFileName( bool allowBreak )
if ( ff )
TQMessageBox::warning( MainWindow::self, i18n( "Invalid Filename" ),
i18n( "The project already contains a form with a\n"
- "filename of '%1'. Please choose a new filename." ).arg( filename ) );
+ "filename of '%1'. Please choose a new filename." ).tqarg( filename ) );
while ( ff ) {
TQString fn;
while ( fn.isEmpty() ) {
fn = KFileDialog::getSaveFileName( pro->makeAbsolute( fileName() ),
- i18n( "*.ui|Qt User-Interface Files" ) + "\n" +
+ i18n( "*.ui|TQt User-Interface Files" ) + "\n" +
i18n( "*|All Files" ), MainWindow::self,/* 0,*/
i18n( "Save Form '%1' As").
arg( formWindow()->name() )/*,
@@ -899,7 +899,7 @@ void FormFile::notifyFormWindowChange()
pro->formOpened( fw );
}
-void FormFile::emitNewStatus(FormFile *file)
+void FormFile::emitNewtqStatus(FormFile *file)
{
- fw->mainWindow()->part()->emitNewStatus(fileName(), isModified());
+ fw->mainWindow()->part()->emitNewtqStatus(fileName(), isModified());
}