Subversion Repositories Scribus

Rev

Rev 36 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 paul 1
#include "reformdoc.h"
2
#include "reformdoc.moc"
3
extern QPixmap loadIcon(QString nam);
4
extern float UmReFaktor;
5
 
6
ReformDoc::ReformDoc( QWidget* parent, float t, float l, float r, float b, bool fp, bool fpe, int Einh)
7
    : QDialog( parent, "r", true, 0 )
8
{
9
    QString ein;
10
                einheit = Einh;
11
                switch (Einh)
12
                        {
13
                        case 0:
14
                ein = " pt";
15
                                break;
16
                        case 1:
17
                ein = " mm";
18
                                break;
19
                        case 2:
20
                ein = " in";
21
                                break;
22
                        case 3:
23
                ein = " p";
24
                                break;
25
                        }
26
    setCaption( tr( "Document Setup" ) );
27
        setIcon(loadIcon("AppIcon.xpm"));
28
    ReformDocLayout = new QVBoxLayout( this );
29
    ReformDocLayout->setSpacing( 6 );
30
    ReformDocLayout->setMargin( 10 );
31
    GroupBox7 = new QGroupBox( this, "GroupBox7" );
32
    GroupBox7->setTitle( tr( "Margin Guides" ) );
33
    GroupBox7->setColumnLayout(0, Qt::Vertical );
34
    GroupBox7->layout()->setSpacing( 0 );
35
    GroupBox7->layout()->setMargin( 0 );
36
    GroupBox7Layout = new QHBoxLayout( GroupBox7->layout() );
37
    GroupBox7Layout->setAlignment( Qt::AlignTop );
38
    GroupBox7Layout->setSpacing( 0 );
39
    GroupBox7Layout->setMargin( 10 );
40
    Layout4 = new QGridLayout;
41
    Layout4->setSpacing( 6 );
42
    Layout4->setMargin( 0 );
43
    TextLabel5 = new QLabel( GroupBox7, "TextLabel5" );
44
    TextLabel5->setText( tr( "Top:" ) );
45
    Layout4->addWidget( TextLabel5, 0, 0 );
46
                TopR = new MSpinBox( GroupBox7, 2 );
47
    TopR->setSuffix( ein );
48
    TopR->setMaxValue( 100000 );
49
    TopR->setValue( qRound(t * UmReFaktor * 100) );
50
    Layout4->addWidget( TopR, 0, 1 );
51
    Links = new QLabel( GroupBox7, "Links" );
52
    Links->setText( tr( "Left:" ) );
53
    Layout4->addWidget( Links, 0, 2 );
54
                LeftR = new MSpinBox( GroupBox7, 2 );
55
    LeftR->setSuffix( ein );
56
    LeftR->setMaxValue( 100000 );
57
    LeftR->setValue( qRound(l * UmReFaktor * 100) );
58
    Layout4->addWidget( LeftR, 0, 3 );
59
    TextLabel7 = new QLabel( GroupBox7, "TextLabel7" );
60
    TextLabel7->setText( tr( "Bottom:" ) );
61
    Layout4->addWidget( TextLabel7, 1, 0 );
62
                BottomR = new MSpinBox( GroupBox7, 2 );
63
    BottomR->setSuffix( ein );
64
    BottomR->setMaxValue( 100000 );
65
    BottomR->setValue( qRound(b * UmReFaktor * 100) );
66
    Layout4->addWidget( BottomR, 1, 1 );
67
    Rechts = new QLabel( GroupBox7, "Rechts" );
68
    Rechts->setText( tr( "Right:" ) );
69
    Layout4->addWidget( Rechts, 1, 2 );
70
                RightR = new MSpinBox( GroupBox7, 2 );
71
    RightR->setSuffix( ein );
72
    RightR->setMaxValue( 100000 );
73
    RightR->setValue( qRound(r * UmReFaktor * 100) );
74
    Layout4->addWidget( RightR, 1, 3 );
75
    Doppelseiten = new QCheckBox( GroupBox7, "Doppelseiten" );
76
    Doppelseiten->setText( tr( "Facing Pages" ) );
77
    Doppelseiten->setChecked( fp );
78
    Layout4->addMultiCellWidget( Doppelseiten, 2, 2, 0, 1 );
79
    ErsteSeite = new QCheckBox( GroupBox7, "n" );
80
    ErsteSeite->setText( tr( "Left Page first" ) );
81
    ErsteSeite->setChecked( fpe );
82
    Layout4->addMultiCellWidget( ErsteSeite, 2, 2, 2, 3 );
83
    if (!fp)
84
        ErsteSeite->setEnabled(false);
85
    setDS();
86
    GroupBox7Layout->addLayout( Layout4 );
87
    ReformDocLayout->addWidget( GroupBox7 );
88
    Layout3 = new QHBoxLayout;
89
    Layout3->setSpacing( 6 );
90
    Layout3->setMargin( 0 );
91
    OKButton = new QPushButton( this, "OKButton" );
92
    OKButton->setText( tr( "OK" ) );
93
    OKButton->setDefault( true );
94
    Layout3->addWidget( OKButton );
95
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
96
    Layout3->addItem( spacer );
97
    CancelB = new QPushButton( this, "CancelB" );
98
    CancelB->setText( tr( "Cancel" ) );
99
    CancelB->setAutoDefault( false );
100
    Layout3->addWidget( CancelB );
101
    ReformDocLayout->addLayout( Layout3 );
102
    TopR->setDecimals(100);
103
    LeftR->setDecimals(100);
104
    RightR->setDecimals(100);
105
        BottomR->setDecimals(100);
106
 
107
    // signals and slots connections
108
    connect( Doppelseiten, SIGNAL( clicked() ), this, SLOT( setDS() ) );
109
    connect( OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
110
    connect( CancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
111
}
112
 
113
 
114
void ReformDoc::setDS()
115
{
116
    if (Doppelseiten->isChecked())
117
        {
118
        Links->setText( tr( "Inside:" ) );
119
        Rechts->setText( tr( "Outside:" ) );
120
        ErsteSeite->setEnabled(true);          
121
        }
122
    else
123
        {
124
        Links->setText( tr( "Left:" ) );
125
        Rechts->setText( tr( "Right:" ) );
126
        ErsteSeite->setEnabled(false);
127
        }
128
}
129