Rev 80 | Rev 146 | Go to most recent revision | Details | Compare with Previous | 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); |
||
80 | Franz | 4 | extern double UmReFaktor; |
3 | paul | 5 | |
80 | Franz | 6 | ReformDoc::ReformDoc( QWidget* parent, double t, double l, double r, double b, double Pagebr, double Pageho, bool fp, bool fpe, int Einh) |
3 | paul | 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 | } |
||
36 | Franz | 26 | Breite = qRound(Pagebr * UmReFaktor * 100); |
27 | Hoehe = qRound(Pageho * UmReFaktor * 100); |
||
3 | paul | 28 | setCaption( tr( "Document Setup" ) ); |
83 | Franz | 29 | setIcon(loadIcon("AppIcon.png")); |
3 | paul | 30 | ReformDocLayout = new QVBoxLayout( this ); |
31 | ReformDocLayout->setSpacing( 6 ); |
||
32 | ReformDocLayout->setMargin( 10 ); |
||
33 | GroupBox7 = new QGroupBox( this, "GroupBox7" ); |
||
34 | GroupBox7->setTitle( tr( "Margin Guides" ) ); |
||
35 | GroupBox7->setColumnLayout(0, Qt::Vertical ); |
||
36 | GroupBox7->layout()->setSpacing( 0 ); |
||
37 | GroupBox7->layout()->setMargin( 0 ); |
||
38 | GroupBox7Layout = new QHBoxLayout( GroupBox7->layout() ); |
||
39 | GroupBox7Layout->setAlignment( Qt::AlignTop ); |
||
40 | GroupBox7Layout->setSpacing( 0 ); |
||
41 | GroupBox7Layout->setMargin( 10 ); |
||
42 | Layout4 = new QGridLayout; |
||
43 | Layout4->setSpacing( 6 ); |
||
44 | Layout4->setMargin( 0 ); |
||
45 | TextLabel5 = new QLabel( GroupBox7, "TextLabel5" ); |
||
46 | TextLabel5->setText( tr( "Top:" ) ); |
||
47 | Layout4->addWidget( TextLabel5, 0, 0 ); |
||
48 | TopR = new MSpinBox( GroupBox7, 2 ); |
||
49 | TopR->setSuffix( ein ); |
||
36 | Franz | 50 | TopR->setMaxValue(Hoehe); |
3 | paul | 51 | TopR->setValue( qRound(t * UmReFaktor * 100) ); |
52 | Layout4->addWidget( TopR, 0, 1 ); |
||
53 | Links = new QLabel( GroupBox7, "Links" ); |
||
54 | Links->setText( tr( "Left:" ) ); |
||
55 | Layout4->addWidget( Links, 0, 2 ); |
||
56 | LeftR = new MSpinBox( GroupBox7, 2 ); |
||
57 | LeftR->setSuffix( ein ); |
||
36 | Franz | 58 | LeftR->setMaxValue(Breite); |
3 | paul | 59 | LeftR->setValue( qRound(l * UmReFaktor * 100) ); |
60 | Layout4->addWidget( LeftR, 0, 3 ); |
||
61 | TextLabel7 = new QLabel( GroupBox7, "TextLabel7" ); |
||
62 | TextLabel7->setText( tr( "Bottom:" ) ); |
||
63 | Layout4->addWidget( TextLabel7, 1, 0 ); |
||
64 | BottomR = new MSpinBox( GroupBox7, 2 ); |
||
65 | BottomR->setSuffix( ein ); |
||
36 | Franz | 66 | BottomR->setMaxValue(Hoehe); |
3 | paul | 67 | BottomR->setValue( qRound(b * UmReFaktor * 100) ); |
68 | Layout4->addWidget( BottomR, 1, 1 ); |
||
69 | Rechts = new QLabel( GroupBox7, "Rechts" ); |
||
70 | Rechts->setText( tr( "Right:" ) ); |
||
71 | Layout4->addWidget( Rechts, 1, 2 ); |
||
72 | RightR = new MSpinBox( GroupBox7, 2 ); |
||
73 | RightR->setSuffix( ein ); |
||
36 | Franz | 74 | RightR->setMaxValue(Breite); |
3 | paul | 75 | RightR->setValue( qRound(r * UmReFaktor * 100) ); |
76 | Layout4->addWidget( RightR, 1, 3 ); |
||
77 | Doppelseiten = new QCheckBox( GroupBox7, "Doppelseiten" ); |
||
78 | Doppelseiten->setText( tr( "Facing Pages" ) ); |
||
79 | Doppelseiten->setChecked( fp ); |
||
80 | Layout4->addMultiCellWidget( Doppelseiten, 2, 2, 0, 1 ); |
||
81 | ErsteSeite = new QCheckBox( GroupBox7, "n" ); |
||
82 | ErsteSeite->setText( tr( "Left Page first" ) ); |
||
83 | ErsteSeite->setChecked( fpe ); |
||
84 | Layout4->addMultiCellWidget( ErsteSeite, 2, 2, 2, 3 ); |
||
85 | if (!fp) |
||
86 | ErsteSeite->setEnabled(false); |
||
87 | setDS(); |
||
88 | GroupBox7Layout->addLayout( Layout4 ); |
||
89 | ReformDocLayout->addWidget( GroupBox7 ); |
||
90 | Layout3 = new QHBoxLayout; |
||
91 | Layout3->setSpacing( 6 ); |
||
92 | Layout3->setMargin( 0 ); |
||
93 | OKButton = new QPushButton( this, "OKButton" ); |
||
94 | OKButton->setText( tr( "OK" ) ); |
||
95 | OKButton->setDefault( true ); |
||
96 | Layout3->addWidget( OKButton ); |
||
97 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
||
98 | Layout3->addItem( spacer ); |
||
99 | CancelB = new QPushButton( this, "CancelB" ); |
||
100 | CancelB->setText( tr( "Cancel" ) ); |
||
101 | CancelB->setAutoDefault( false ); |
||
102 | Layout3->addWidget( CancelB ); |
||
103 | ReformDocLayout->addLayout( Layout3 ); |
||
104 | TopR->setDecimals(100); |
||
105 | LeftR->setDecimals(100); |
||
106 | RightR->setDecimals(100); |
||
107 | BottomR->setDecimals(100); |
||
36 | Franz | 108 | RightR->setMaxValue(Breite - LeftR->value()); |
109 | LeftR->setMaxValue(Breite - RightR->value()); |
||
110 | TopR->setMaxValue(Hoehe - BottomR->value()); |
||
111 | BottomR->setMaxValue(Hoehe - TopR->value()); |
||
3 | paul | 112 | |
113 | // signals and slots connections |
||
114 | connect( Doppelseiten, SIGNAL( clicked() ), this, SLOT( setDS() ) ); |
||
115 | connect( OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
||
116 | connect( CancelB, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
||
36 | Franz | 117 | connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int))); |
118 | connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int))); |
||
119 | connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int))); |
||
120 | connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int))); |
||
3 | paul | 121 | } |
122 | |||
36 | Franz | 123 | void ReformDoc::setTop(int v) |
124 | { |
||
125 | BottomR->setMaxValue(Hoehe - TopR->value()); |
||
126 | } |
||
3 | paul | 127 | |
36 | Franz | 128 | void ReformDoc::setBottom(int v) |
129 | { |
||
130 | TopR->setMaxValue(Hoehe - BottomR->value()); |
||
131 | } |
||
132 | |||
133 | void ReformDoc::setLeft(int v) |
||
134 | { |
||
135 | RightR->setMaxValue(Breite - LeftR->value()); |
||
136 | } |
||
137 | |||
138 | void ReformDoc::setRight(int v) |
||
139 | { |
||
140 | LeftR->setMaxValue(Breite - RightR->value()); |
||
141 | } |
||
142 | |||
3 | paul | 143 | void ReformDoc::setDS() |
144 | { |
||
145 | if (Doppelseiten->isChecked()) |
||
146 | { |
||
147 | Links->setText( tr( "Inside:" ) ); |
||
148 | Rechts->setText( tr( "Outside:" ) ); |
||
149 | ErsteSeite->setEnabled(true); |
||
150 | } |
||
151 | else |
||
152 | { |
||
153 | Links->setText( tr( "Left:" ) ); |
||
154 | Rechts->setText( tr( "Right:" ) ); |
||
155 | ErsteSeite->setEnabled(false); |
||
156 | } |
||
157 | } |
||
158 |