diff options
Diffstat (limited to 'kdevdesigner/designer/formfile.cpp')
-rw-r--r-- | kdevdesigner/designer/formfile.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/kdevdesigner/designer/formfile.cpp b/kdevdesigner/designer/formfile.cpp index 4ba5b7c7..d32a0611 100644 --- a/kdevdesigner/designer/formfile.cpp +++ b/kdevdesigner/designer/formfile.cpp @@ -66,8 +66,8 @@ static TQString make_func_pretty( const TQString &s ) FormFile::FormFile( const TQString &fn, bool temp, Project *p, const char *name ) : filename( fn ), fileNameTemp( temp ), pro( p ), fw( 0 ), ed( 0 ), - timeStamp( 0, fn + codeExtension() ), codeEdited( FALSE ), pkg( FALSE ), - cm( FALSE ), codeFileStat( None ) + timeStamp( 0, fn + codeExtension() ), codeEdited( false ), pkg( false ), + cm( false ), codeFileStat( None ) { MetaDataBase::addEntry( this ); fake = qstrcmp( name, "qt_fakewindow" ) == 0; @@ -75,15 +75,15 @@ FormFile::FormFile( const TQString &fn, bool temp, Project *p, const char *name pro->addFormFile( this ); loadCode(); if ( !temp ) - checkFileName( FALSE ); + checkFileName( false ); - connect(this, TQT_SIGNAL(somethingChanged(FormFile* )), this, TQT_SLOT(emitNewStatus(FormFile* ))); + connect(this, TQ_SIGNAL(somethingChanged(FormFile* )), this, TQ_SLOT(emitNewStatus(FormFile* ))); } FormFile::~FormFile() { pro->removeFormFile( this ); - if ( TQT_TQOBJECT(formWindow()) ) + if ( formWindow() ) formWindow()->setFormFile( 0 ); } @@ -96,8 +96,8 @@ void FormFile::setFormWindow( FormWindow *f ) fw = f; if ( fw ) fw->setFormFile( this ); - parseCode( cod, FALSE ); - TQTimer::singleShot( 0, this, TQT_SLOT( notifyFormWindowChange() ) ); + parseCode( cod, false ); + TQTimer::singleShot( 0, this, TQ_SLOT( notifyFormWindowChange() ) ); } void FormFile::setEditor( SourceEditor *e ) @@ -110,12 +110,12 @@ void FormFile::setFileName( const TQString &fn ) if ( fn == filename ) return; if ( fn.isEmpty() ) { - fileNameTemp = TRUE; + fileNameTemp = true; if ( filename.find( "unnamed" ) != 0 ) filename = createUnnamedFileName(); return; } else { - fileNameTemp = FALSE; + fileNameTemp = false; } filename = fn; timeStamp.setFileName( filename + codeExtension() ); @@ -166,14 +166,14 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified ) if ( fileNameTemp ) return saveAs(); if ( !ignoreModified && !isModified() ) - return TRUE; + return true; if ( ed ) ed->save(); - if ( TQT_TQOBJECT(formWindow()) && isModified( WFormWindow ) ) { + if ( formWindow() && isModified( WFormWindow ) ) { if ( withMsgBox ) { if ( !formWindow()->checkCustomWidgets() ) - return FALSE; + return false; } if ( TQFile::exists( pro->makeAbsolute( filename ) ) ) { @@ -221,7 +221,7 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified ) } } - if ( TQT_TQOBJECT(formWindow()) ) { + if ( formWindow() ) { Resource resource( MainWindow::self ); resource.setWidget( formWindow() ); bool formCodeOnly = isModified( WFormCode ) && !isModified( WFormWindow ); @@ -229,7 +229,7 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified ) if ( MainWindow::self ) MainWindow::self->statusMessage( i18n( "Failed to save file '%1'.").arg( formCodeOnly ? codeFile(): filename ) ); if ( formCodeOnly ) - return FALSE; + return false; return saveAs(); } if ( MainWindow::self ) @@ -237,22 +237,22 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified ) arg( formCodeOnly ? codeFile() : filename )); } else { if ( !Resource::saveFormCode(this, MetaDataBase::languageInterface(pro->language())) ) - return FALSE; + return false; } timeStamp.update(); - setModified( FALSE ); - return TRUE; + setModified( false ); + return true; } bool FormFile::saveAs( bool ignoreModified ) { TQString f = pro->makeAbsolute( fileName() ); - if ( fileNameTemp && TQT_TQOBJECT(formWindow()) ) { + if ( fileNameTemp && formWindow() ) { f = TQString( formWindow()->name() ).lower(); f.replace( "::", "_" ); f = pro->makeAbsolute( f + ".ui" ); } - bool saved = FALSE; + bool saved = false; if ( ignoreModified ) { TQString dir = TQStringList::split( ':', pro->iFace()->customSetting( "QTSCRIPT_PACKAGES" ) ).first(); f = TQFileInfo( f ).fileName(); @@ -266,11 +266,11 @@ bool FormFile::saveAs( bool ignoreModified ) i18n( "Save Form '%1' As").arg( formName() )/*, MainWindow::self ? &MainWindow::self->lastSaveFilter : 0*/ ); if ( fn.isEmpty() ) - return FALSE; + return false; TQFileInfo fi( fn ); if ( fi.extension() != "ui" ) fn += ".ui"; - fileNameTemp = FALSE; + fileNameTemp = false; filename = pro->makeRelative( fn ); TQFileInfo relfi( filename ); if ( relfi.exists() ) { @@ -278,27 +278,27 @@ bool FormFile::saveAs( bool ignoreModified ) i18n( "The file already exists. Do you wish to overwrite it?" ), TQMessageBox::Yes, TQMessageBox::No ) == TQMessageBox::Yes ) { - saved = TRUE; + saved = true; } else { filename = f; } } else { - saved = TRUE; + saved = true; } } - if ( !checkFileName( TRUE ) ) { + if ( !checkFileName( true ) ) { filename = f; - return FALSE; + return false; } - pro->setModified( TRUE ); + pro->setModified( true ); timeStamp.setFileName( pro->makeAbsolute( codeFile() ) ); - if ( ed && TQT_TQOBJECT(formWindow()) ) + if ( ed && formWindow() ) ed->setCaption( i18n( "Edit %1" ).arg( formWindow()->name() ) ); - setModified( TRUE ); + setModified( true ); if ( pro->isDummy() ) fw->mainWindow()->addRecentlyOpenedFile( fn ); - return save( TRUE, ignoreModified ); + return save( true, ignoreModified ); } bool FormFile::close() @@ -307,20 +307,20 @@ bool FormFile::close() editor()->save(); editor()->close(); } - if ( TQT_TQOBJECT(formWindow()) ) + if ( formWindow() ) return formWindow()->close(); - return TRUE; + return true; } bool FormFile::closeEvent() { if ( !isModified() && fileNameTemp ) { pro->removeFormFile( this ); - return TRUE; + return true; } if ( !isModified() ) - return TRUE; + return true; if ( editor() ) editor()->save(); @@ -330,7 +330,7 @@ bool FormFile::closeEvent() i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) { case 0: // save if ( !save() ) - return FALSE; + return false; case 1: // don't save loadCode(); if ( ed ) @@ -341,16 +341,16 @@ bool FormFile::closeEvent() MainWindow::self->workspace()->update(); break; case 2: // cancel - return FALSE; + return false; default: break; } - setModified( FALSE ); + setModified( false ); if ( MainWindow::self ) MainWindow::self->updateFunctionList(); - setCodeEdited( FALSE ); - return TRUE; + setCodeEdited( false ); + return true; } void FormFile::setModified( bool m, int who ) @@ -372,8 +372,8 @@ bool FormFile::isModified( int who ) bool FormFile::isFormWindowModified() const { - if ( !TQT_TQOBJECT(formWindow()) || !formWindow()->commandHistory() ) - return FALSE; + if ( !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 ( !TQT_TQOBJECT(formWindow()) || !formWindow()->commandHistory() ) + if ( !formWindow() || !formWindow()->commandHistory() ) return; formWindow()->commandHistory()->setModified( m ); emit somethingChanged( this ); @@ -411,18 +411,18 @@ void FormFile::showFormWindow() { if ( !MainWindow::self ) return; - if ( TQT_TQOBJECT(formWindow()) ) { + if ( formWindow() ) { if ( ( formWindow()->hasFocus() || - 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->qWorkspace()->activeWindow() == formWindow() ) && + MainWindow::self->propertyeditor()->formWindow() != formWindow() ) { + MainWindow::self->propertyeditor()->setWidget( formWindow()->currentWidget(), formWindow() ); MainWindow::self->objectHierarchy()->setFormWindow( formWindow(), - TQT_TQOBJECT(formWindow()->currentWidget()) ); + formWindow()->currentWidget() ); } formWindow()->setFocus(); return; } - MainWindow::self->openFormWindow( pro->makeAbsolute( filename ), TRUE, this ); + MainWindow::self->openFormWindow( pro->makeAbsolute( filename ), true, this ); } bool FormFile::setupUihFile( bool askForUih ) @@ -430,10 +430,10 @@ bool FormFile::setupUihFile( bool askForUih ) if ( !pro->isCpp() || !askForUih ) { if ( !hasFormCode() ) { createFormCode(); - setModified( TRUE ); + setModified( true ); } codeFileStat = FormFile::Ok; - return TRUE; + return true; } if ( codeFileStat != FormFile::Ok && !ed ) { if ( hasFormCode() ) { @@ -443,20 +443,20 @@ bool FormFile::setupUihFile( bool askForUih ) i18n( "Use Existing" ), i18n( "Create New" ), i18n( "Cancel" ), 2, 2 ); if ( i == 2 ) - return FALSE; + return false; if ( i == 1 ) createFormCode(); } else { if ( TQMessageBox::Yes != TQMessageBox::information( MainWindow::self, i18n( "Creating ui.h file" ), i18n( "Do you want to create an new \"ui.h\" file?" ), TQMessageBox::Yes, TQMessageBox::No ) ) - return FALSE; + return false; createFormCode(); } - setModified( TRUE ); + setModified( true ); } codeFileStat = FormFile::Ok; - return TRUE; + return true; } SourceEditor *FormFile::showEditor( bool askForUih ) @@ -519,14 +519,14 @@ void FormFile::setCodeFileState( UihState s ) void FormFile::createFormCode() { - if ( !TQT_TQOBJECT(formWindow()) ) + if ( !formWindow() ) return; LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); if ( !iface ) return; if ( pro->isCpp() ) cod = codeComment(); - TQValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( TQT_TQOBJECT(formWindow()) ); + TQValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( 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), @@ -535,7 +535,7 @@ void FormFile::createFormCode() (*it).returnType, (*it).access ) + "\n" + iface->createEmptyFunction(); } - parseCode( cod, FALSE ); + parseCode( cod, false ); } void FormFile::load() @@ -550,15 +550,15 @@ bool FormFile::loadCode() if ( !f.open( IO_ReadOnly ) ) { cod = ""; setCodeFileState( FormFile::None ); - return FALSE; + return false; } TQTextStream ts( &f ); cod = ts.read(); - parseCode( cod, FALSE ); + parseCode( cod, false ); if ( hasFormCode() && codeFileStat != FormFile::Ok ) setCodeFileState( FormFile::Deleted ); timeStamp.update(); - return TRUE; + return true; } bool FormFile::isCodeEdited() const @@ -573,25 +573,25 @@ void FormFile::setCodeEdited( bool b ) void FormFile::parseCode( const TQString &txt, bool allowModify ) { - if ( !TQT_TQOBJECT(formWindow()) ) + if ( !formWindow() ) return; LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); if ( !iface ) return; TQValueList<LanguageInterface::Function> functions; TQValueList<MetaDataBase::Function> newFunctions, oldFunctions; - oldFunctions = MetaDataBase::functionList( TQT_TQOBJECT(formWindow()) ); + oldFunctions = MetaDataBase::functionList( formWindow() ); iface->functions( txt, &functions ); TQMap<TQString, TQString> funcs; for ( TQValueList<LanguageInterface::Function>::Iterator it = functions.begin(); it != functions.end(); ++it ) { - bool found = FALSE; + bool found = false; for ( TQValueList<MetaDataBase::Function>::Iterator fit = oldFunctions.begin(); fit != oldFunctions.end(); ++fit ) { TQString f( (*fit).function ); if ( MetaDataBase::normalizeFunction( f ) == MetaDataBase::normalizeFunction( (*it).name ) ) { - found = TRUE; + found = true; MetaDataBase::Function function; function.function = make_func_pretty( (*it).name ); function.specifier = (*fit).specifier; @@ -627,21 +627,21 @@ void FormFile::parseCode( const TQString &txt, bool allowModify ) newFunctions << function; funcs.insert( (*it).name, (*it).body ); if ( allowModify ) - setFormWindowModified( TRUE ); + setFormWindowModified( true ); } } if ( allowModify && oldFunctions.count() > 0 ) - setFormWindowModified( TRUE ); + setFormWindowModified( true ); - MetaDataBase::setFunctionList( TQT_TQOBJECT(formWindow()), newFunctions ); + MetaDataBase::setFunctionList( formWindow(), newFunctions ); } void FormFile::syncCode() { if ( !editor() ) return; - parseCode( editor()->editorInterface()->text(), TRUE ); + parseCode( editor()->editorInterface()->text(), true ); cod = editor()->editorInterface()->text(); } @@ -672,14 +672,14 @@ void FormFile::checkTimeStamp() bool FormFile::isUihFileUpToDate() { if ( timeStamp.isUpToDate() ) - return TRUE; + return true; if ( !editor() ) { MainWindow::self->editSource(); tqDebug( "parse Code" ); - parseCode( editor()->editorInterface()->text(), TRUE ); + parseCode( editor()->editorInterface()->text(), true ); } checkTimeStamp(); - return FALSE; + return false; } void FormFile::addFunctionCode( MetaDataBase::Function function ) @@ -692,11 +692,11 @@ void FormFile::addFunctionCode( MetaDataBase::Function function ) TQValueList<LanguageInterface::Function> funcs; iface->functions( cod, &funcs ); - bool hasFunc = FALSE; + bool hasFunc = false; for ( TQValueList<LanguageInterface::Function>::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { if ( MetaDataBase::normalizeFunction( (*it).name ) == MetaDataBase::normalizeFunction( function.function ) ) { - hasFunc = TRUE; + hasFunc = true; break; } } @@ -704,7 +704,7 @@ void FormFile::addFunctionCode( MetaDataBase::Function function ) if ( !hasFunc ) { if ( !codeEdited && !timeStamp.isUpToDate() ) loadCode(); - MetaDataBase::MetaInfo mi = MetaDataBase::metaInfo( TQT_TQOBJECT(formWindow()) ); + MetaDataBase::MetaInfo mi = MetaDataBase::metaInfo( formWindow() ); TQString cn; if ( mi.classNameChanged ) cn = mi.className; @@ -718,7 +718,7 @@ void FormFile::addFunctionCode( MetaDataBase::Function function ) "\n" + iface->createEmptyFunction(); cod += body; if ( codeEdited ) { - setModified( TRUE ); + setModified( true ); emit somethingChanged( this ); } } @@ -802,7 +802,7 @@ void FormFile::functionRetTypeChanged( const TQString &fuName, const TQString &o TQString FormFile::formName() const { FormFile* that = (FormFile*) this; - if ( TQT_TQOBJECT(formWindow()) ) { + if ( formWindow() ) { that->cachedFormName = formWindow()->name(); return cachedFormName; } @@ -865,12 +865,12 @@ bool FormFile::checkFileName( bool allowBreak ) arg( formWindow()->name() )/*, MainWindow::self ? &MainWindow::self->lastSaveFilter : 0 */); if ( allowBreak && fn.isEmpty() ) - return FALSE; + return false; } filename = pro->makeRelative( fn ); ff = pro->findFormFile( filename, this ); } - return TRUE; + return true; } void FormFile::addConnection( const TQString &sender, const TQString &signal, |