You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
4.7 KiB
119 lines
4.7 KiB
15 years ago
|
/**********************************************************************
|
||
|
** Copyright (C) 2000 Trolltech AS. All rights reserved.
|
||
|
**
|
||
14 years ago
|
** This file is part of TQt Designer.
|
||
15 years ago
|
**
|
||
|
** 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.
|
||
|
**
|
||
14 years ago
|
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
|
||
|
** licenses may use this file in accordance with the TQt Commercial License
|
||
15 years ago
|
** Agreement provided with the Software.
|
||
|
**
|
||
|
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||
|
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
**
|
||
|
** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
||
|
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
||
14 years ago
|
** information about TQt Commercial License Agreements.
|
||
15 years ago
|
**
|
||
|
** Contact info@trolltech.com if any conditions of this licensing are
|
||
|
** not clear to you.
|
||
|
**
|
||
|
**********************************************************************/
|
||
|
|
||
|
#include "formsettingsimpl.h"
|
||
|
#include "formwindow.h"
|
||
|
#include "metadatabase.h"
|
||
|
#include "command.h"
|
||
|
#include "asciivalidator.h"
|
||
|
#include "mainwindow.h"
|
||
|
#include "project.h"
|
||
|
|
||
15 years ago
|
#include <tqmultilineedit.h>
|
||
|
#include <tqpushbutton.h>
|
||
|
#include <tqcombobox.h>
|
||
|
#include <tqradiobutton.h>
|
||
15 years ago
|
#include <klineedit.h>
|
||
15 years ago
|
#include <tqspinbox.h>
|
||
|
#include <tqcheckbox.h>
|
||
15 years ago
|
|
||
14 years ago
|
FormSettings::FormSettings( TQWidget *parent, FormWindow *fw )
|
||
|
: FormSettingsBase( parent, 0, TRUE ), formwindow( fw )
|
||
15 years ago
|
{
|
||
15 years ago
|
connect( buttonHelp, TQT_SIGNAL( clicked() ), MainWindow::self, TQT_SLOT( showDialogHelp() ) );
|
||
14 years ago
|
MetaDataBase::MetaInfo info = MetaDataBase::metaInfo( TQT_TQOBJECT(fw) );
|
||
15 years ago
|
if ( info.classNameChanged && !info.className.isEmpty() )
|
||
|
editClassName->setText( info.className );
|
||
|
else
|
||
|
editClassName->setText( fw->name() );
|
||
|
editComment->setText( info.comment );
|
||
|
editAuthor->setText( info.author );
|
||
|
|
||
14 years ago
|
editClassName->setValidator( new AsciiValidator( TQString( ":" ), TQT_TQOBJECT(editClassName) ) );
|
||
|
editPixmapFunction->setValidator( new AsciiValidator( TQString( ":" ), TQT_TQOBJECT(editPixmapFunction) ) );
|
||
15 years ago
|
|
||
|
if ( formwindow->savePixmapInline() )
|
||
|
radioPixmapInline->setChecked( TRUE );
|
||
|
else if ( formwindow->savePixmapInProject() )
|
||
|
radioProjectImageFile->setChecked( TRUE );
|
||
|
else
|
||
|
radioPixmapFunction->setChecked( TRUE );
|
||
|
editPixmapFunction->setText( formwindow->pixmapLoaderFunction() );
|
||
|
radioProjectImageFile->setEnabled( !fw->project()->isDummy() );
|
||
14 years ago
|
spinSpacing->setValue( formwindow->layoutDefaultSpacing() );
|
||
|
spinMargin->setValue( formwindow->layoutDefaultMargin() );
|
||
14 years ago
|
editSpacingFunction->setValidator( new AsciiValidator( TQString( ":" ), TQT_TQOBJECT(editSpacingFunction) ) );
|
||
|
editMarginFunction->setValidator( new AsciiValidator( TQString( ":" ), TQT_TQOBJECT(editMarginFunction) ) );
|
||
15 years ago
|
checkLayoutFunctions->setChecked( formwindow->hasLayoutFunctions() );
|
||
|
editSpacingFunction->setText( formwindow->spacingFunction() );
|
||
|
editMarginFunction->setText( formwindow->marginFunction() );
|
||
|
}
|
||
|
|
||
|
void FormSettings::okClicked()
|
||
|
{
|
||
|
MetaDataBase::MetaInfo info;
|
||
|
info.className = editClassName->text();
|
||
15 years ago
|
info.classNameChanged = info.className != TQString( formwindow->name() );
|
||
15 years ago
|
info.comment = editComment->text();
|
||
|
info.author = editAuthor->text();
|
||
14 years ago
|
MetaDataBase::setMetaInfo( TQT_TQOBJECT(formwindow), info );
|
||
15 years ago
|
|
||
|
formwindow->commandHistory()->setModified( TRUE );
|
||
|
|
||
|
if ( formwindow->savePixmapInline() ) {
|
||
14 years ago
|
MetaDataBase::clearPixmapArguments( TQT_TQOBJECT(formwindow) );
|
||
|
MetaDataBase::clearPixmapKeys( TQT_TQOBJECT(formwindow) );
|
||
15 years ago
|
} else if ( formwindow->savePixmapInProject() ) {
|
||
14 years ago
|
MetaDataBase::clearPixmapArguments( TQT_TQOBJECT(formwindow) );
|
||
15 years ago
|
} else {
|
||
14 years ago
|
MetaDataBase::clearPixmapKeys( TQT_TQOBJECT(formwindow) );
|
||
15 years ago
|
}
|
||
|
|
||
|
if ( radioPixmapInline->isChecked() ) {
|
||
|
formwindow->setSavePixmapInline( TRUE );
|
||
|
formwindow->setSavePixmapInProject( FALSE );
|
||
|
} else if ( radioProjectImageFile->isChecked() ){
|
||
|
formwindow->setSavePixmapInline( FALSE );
|
||
|
formwindow->setSavePixmapInProject( TRUE );
|
||
|
} else {
|
||
|
formwindow->setSavePixmapInline( FALSE );
|
||
|
formwindow->setSavePixmapInProject( FALSE );
|
||
|
}
|
||
|
|
||
|
if ( checkLayoutFunctions->isChecked() )
|
||
|
formwindow->hasLayoutFunctions( TRUE );
|
||
|
else
|
||
|
formwindow->hasLayoutFunctions( FALSE );
|
||
|
|
||
|
formwindow->setPixmapLoaderFunction( editPixmapFunction->text() );
|
||
|
formwindow->setLayoutDefaultSpacing( spinSpacing->value() );
|
||
|
formwindow->setSpacingFunction( editSpacingFunction->text() );
|
||
|
formwindow->setLayoutDefaultMargin( spinMargin->value() );
|
||
|
formwindow->setMarginFunction( editMarginFunction->text() );
|
||
|
|
||
|
accept();
|
||
|
}
|