~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to kdevdesigner/designer/formsettingsimpl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**********************************************************************
2
 
** Copyright (C) 2000 Trolltech AS.  All rights reserved.
3
 
**
4
 
** This file is part of Qt Designer.
5
 
**
6
 
** This file may be distributed and/or modified under the terms of the
7
 
** GNU General Public License version 2 as published by the Free Software
8
 
** Foundation and appearing in the file LICENSE.GPL included in the
9
 
** packaging of this file.
10
 
**
11
 
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12
 
** licenses may use this file in accordance with the Qt Commercial License
13
 
** Agreement provided with the Software.
14
 
**
15
 
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16
 
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17
 
**
18
 
** See http://www.trolltech.com/gpl/ for GPL licensing information.
19
 
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20
 
**   information about Qt Commercial License Agreements.
21
 
**
22
 
** Contact info@trolltech.com if any conditions of this licensing are
23
 
** not clear to you.
24
 
**
25
 
**********************************************************************/
26
 
 
27
 
#include "formsettingsimpl.h"
28
 
#include "formwindow.h"
29
 
#include "metadatabase.h"
30
 
#include "command.h"
31
 
#include "asciivalidator.h"
32
 
#include "mainwindow.h"
33
 
#include "project.h"
34
 
 
35
 
#include <qmultilineedit.h>
36
 
#include <qpushbutton.h>
37
 
#include <qcombobox.h>
38
 
#include <qradiobutton.h>
39
 
#include <klineedit.h>
40
 
#include <qspinbox.h>
41
 
#include <qcheckbox.h>
42
 
 
43
 
FormSettings::FormSettings( QWidget *parent, FormWindow *fw )
44
 
    : FormSettingsBase( parent, 0, TRUE ), formwindow( fw )
45
 
{
46
 
    connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
47
 
    MetaDataBase::MetaInfo info = MetaDataBase::metaInfo( fw );
48
 
    if ( info.classNameChanged && !info.className.isEmpty() )
49
 
        editClassName->setText( info.className );
50
 
    else
51
 
        editClassName->setText( fw->name() );
52
 
    editComment->setText( info.comment );
53
 
    editAuthor->setText( info.author );
54
 
 
55
 
    editClassName->setValidator( new AsciiValidator( QString( ":" ), editClassName ) );
56
 
    editPixmapFunction->setValidator( new AsciiValidator( QString( ":" ), editPixmapFunction ) );
57
 
 
58
 
    if ( formwindow->savePixmapInline() )
59
 
        radioPixmapInline->setChecked( TRUE );
60
 
    else if ( formwindow->savePixmapInProject() )
61
 
        radioProjectImageFile->setChecked( TRUE );
62
 
    else
63
 
        radioPixmapFunction->setChecked( TRUE );
64
 
    editPixmapFunction->setText( formwindow->pixmapLoaderFunction() );
65
 
    radioProjectImageFile->setEnabled( !fw->project()->isDummy() );
66
 
    spinSpacing->setValue( formwindow->layoutDefaultSpacing() );
67
 
    spinMargin->setValue( formwindow->layoutDefaultMargin() );
68
 
    editSpacingFunction->setValidator( new AsciiValidator( QString( ":" ), editSpacingFunction ) );
69
 
    editMarginFunction->setValidator( new AsciiValidator( QString( ":" ), editMarginFunction ) ); 
70
 
    checkLayoutFunctions->setChecked( formwindow->hasLayoutFunctions() );
71
 
    editSpacingFunction->setText( formwindow->spacingFunction() );
72
 
    editMarginFunction->setText( formwindow->marginFunction() );
73
 
}
74
 
 
75
 
void FormSettings::okClicked()
76
 
{
77
 
    MetaDataBase::MetaInfo info;
78
 
    info.className = editClassName->text();
79
 
    info.classNameChanged = info.className != QString( formwindow->name() );
80
 
    info.comment = editComment->text();
81
 
    info.author = editAuthor->text();
82
 
    MetaDataBase::setMetaInfo( formwindow, info );
83
 
 
84
 
    formwindow->commandHistory()->setModified( TRUE );
85
 
 
86
 
    if ( formwindow->savePixmapInline() ) {
87
 
        MetaDataBase::clearPixmapArguments( formwindow );
88
 
        MetaDataBase::clearPixmapKeys( formwindow );
89
 
    } else if ( formwindow->savePixmapInProject() ) {
90
 
        MetaDataBase::clearPixmapArguments( formwindow );
91
 
    } else {
92
 
        MetaDataBase::clearPixmapKeys( formwindow );
93
 
    }
94
 
 
95
 
    if ( radioPixmapInline->isChecked() ) {
96
 
        formwindow->setSavePixmapInline( TRUE );
97
 
        formwindow->setSavePixmapInProject( FALSE );
98
 
    } else if ( radioProjectImageFile->isChecked() ){
99
 
        formwindow->setSavePixmapInline( FALSE );
100
 
        formwindow->setSavePixmapInProject( TRUE );
101
 
    } else {
102
 
        formwindow->setSavePixmapInline( FALSE );
103
 
        formwindow->setSavePixmapInProject( FALSE );
104
 
    }
105
 
    
106
 
    if ( checkLayoutFunctions->isChecked() )
107
 
        formwindow->hasLayoutFunctions( TRUE );
108
 
    else
109
 
        formwindow->hasLayoutFunctions( FALSE );
110
 
 
111
 
    formwindow->setPixmapLoaderFunction( editPixmapFunction->text() );
112
 
    formwindow->setLayoutDefaultSpacing( spinSpacing->value() );
113
 
    formwindow->setSpacingFunction( editSpacingFunction->text() );
114
 
    formwindow->setLayoutDefaultMargin( spinMargin->value() );
115
 
    formwindow->setMarginFunction( editMarginFunction->text() );
116
 
 
117
 
    accept();
118
 
}