~ubuntu-branches/ubuntu/maverick/scribus-ng/maverick-backports

« back to all changes in this revision

Viewing changes to scribus/newfile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2009-02-09 09:25:18 UTC
  • mfrom: (5.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090209092518-iqsxmh3pjspgrdyd
Tags: 1.3.5.dfsg~svn20090208-2
debian/control: Use "type-handling -n arm,armel,armeb any" to generate the
list of architectures to build on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
for which a new license (GPL+exception) is in place.
6
6
*/
7
7
#include "newfile.h"
8
 
#include "newfile.moc"
9
8
 
10
 
#include <qdir.h>
11
 
#include <qtooltip.h>
12
 
#include <qobjectlist.h>
13
 
#include <qpoint.h>
14
 
#include <qiconview.h>
 
9
#include <QFormLayout>
 
10
#include <QGridLayout>
 
11
#include <QHBoxLayout>
 
12
#include <QVBoxLayout>
 
13
#include <QSpacerItem>
 
14
#include <QListWidgetItem>
 
15
#include <QFrame>
 
16
#include <QGroupBox>
 
17
#include <QLabel>
 
18
#include <QSpinBox>
 
19
#include <QCheckBox>
 
20
#include <QTabWidget>
 
21
#include <QPushButton>
 
22
#include <QPixmap>
 
23
#include <QToolTip>
 
24
#include <QDir>
 
25
#include <QPoint>
 
26
#if QT_VERSION  >= 0x040300
 
27
        #include <QFileDialog>
 
28
#else
 
29
        #include "customfdialog.h"
 
30
#endif
15
31
 
16
32
#include "fileloader.h"
17
33
#include "prefsfile.h"
18
34
#include "units.h"
19
35
#include "pagesize.h"
20
 
#include "marginWidget.h"
 
36
#include "marginwidget.h"
21
37
#include "scconfig.h"
22
38
#include "scribuscore.h"
23
39
#include "prefsmanager.h"
24
40
#include "pagelayout.h"
25
41
#include "pagestructs.h"
26
42
#include "commonstrings.h"
27
 
#include "mspinbox.h"
28
 
#include "customfdialog.h"
 
43
#include "scrspinbox.h"
29
44
#include "sccombobox.h"
30
 
 
31
 
 
32
 
extern QPixmap loadIcon(QString nam);
33
 
 
34
 
 
35
 
NewDoc::NewDoc( QWidget* parent, const QStringList& recentDocs, bool startUp ) : QDialog( parent, "newDoc", true, 0 )
36
 
{
 
45
#include "util_icon.h"
 
46
 
 
47
PageLayoutsWidget::PageLayoutsWidget(QWidget* parent) : QListWidget(parent)
 
48
{
 
49
        setDragEnabled(false);
 
50
        setViewMode(QListView::IconMode);
 
51
        setFlow(QListView::LeftToRight);
 
52
        setSortingEnabled(false);
 
53
        setWrapping(false);
 
54
        setWordWrap(true);
 
55
        setAcceptDrops(false);
 
56
        setDropIndicatorShown(false);
 
57
        setDragDropMode(QAbstractItemView::NoDragDrop);
 
58
        setResizeMode(QListView::Adjust);
 
59
        setSelectionMode(QAbstractItemView::SingleSelection);
 
60
        setFocusPolicy(Qt::NoFocus);
 
61
        setIconSize(QSize(32, 32));
 
62
        clear();
 
63
        setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
 
64
}
 
65
 
 
66
void PageLayoutsWidget::arrangeIcons()
 
67
{
 
68
        QListWidgetItem* ic;
 
69
        int startY = 5;
 
70
        int startX = 5;
 
71
        setResizeMode(QListView::Fixed);
 
72
        int maxSizeY = 0;
 
73
        for (int cc = 0; cc < count(); ++cc)
 
74
        {
 
75
                ic = item(cc);
 
76
                QRect ir = visualItemRect(ic);
 
77
                setPositionForIndex(QPoint(startX, startY), indexFromItem(ic));
 
78
                startX += ir.width()+5;
 
79
                maxSizeY = qMax(maxSizeY, ir.height());
 
80
        }
 
81
        maxX = startX;
 
82
        maxY = maxSizeY+10;
 
83
}
 
84
 
 
85
const QSize PageLayoutsWidget::minimumSizeHint()
 
86
{
 
87
        return QSize(maxX, maxY);
 
88
}
 
89
 
 
90
NewDoc::NewDoc( QWidget* parent, const QStringList& recentDocs, bool startUp ) : QDialog( parent )
 
91
{
 
92
        setModal(true);
37
93
        prefsManager=PrefsManager::instance();
38
94
        tabSelected = 0;
39
95
        onStartup = startUp;
40
96
        unitIndex = prefsManager->appPrefs.docUnitIndex;
 
97
        unitRatio = unitGetRatioFromIndex(unitIndex);
41
98
        unitSuffix = unitGetSuffixFromIndex(unitIndex);
42
 
        unitRatio = unitGetRatioFromIndex(unitIndex);
43
 
        precision = unitGetPrecisionFromIndex(unitIndex);
44
99
        Orient = 0;
45
 
        setCaption( tr( "New Document" ) );
46
 
        setIcon(loadIcon("AppIcon.png"));
47
 
        TabbedNewDocLayout = new QVBoxLayout( this, 10, 5, "Form1Layout");
 
100
        setWindowTitle( tr( "New Document" ) );
 
101
        setWindowIcon(QIcon(loadIcon("AppIcon.png")));
 
102
        TabbedNewDocLayout = new QVBoxLayout( this );
 
103
        TabbedNewDocLayout->setMargin(10);
 
104
        TabbedNewDocLayout->setSpacing(5);
48
105
        if (startUp)
49
 
                tabWidget = new QTabWidget( this, "tabWidget2" );
 
106
                tabWidget = new QTabWidget( this );
50
107
        createNewDocPage();
51
108
        if (startUp)
52
109
        {
62
119
                TabbedNewDocLayout->addWidget(newDocFrame);
63
120
 
64
121
        Layout1 = new QHBoxLayout;
65
 
        Layout1->setSpacing( 6 );
 
122
        Layout1->setSpacing( 5 );
66
123
        Layout1->setMargin( 0 );
67
124
        if (startUp)
68
125
        {
69
 
                startUpDialog = new QCheckBox( tr( "Do not show this dialog again" ), this, "startUpDialog" );
 
126
                startUpDialog = new QCheckBox( tr( "Do not show this dialog again" ), this );
70
127
                startUpDialog->setChecked(!prefsManager->appPrefs.showStartupDialog);
71
128
                Layout1->addWidget( startUpDialog );
72
129
        }
73
 
        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
 
130
        QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
74
131
        Layout1->addItem( spacer );
75
 
        OKButton = new QPushButton( CommonStrings::tr_OK, this, "OKButton" );
 
132
        OKButton = new QPushButton( CommonStrings::tr_OK, this );
76
133
        OKButton->setDefault( true );
77
134
        Layout1->addWidget( OKButton );
78
 
        CancelB = new QPushButton( CommonStrings::tr_Cancel, this, "CancelB" );
 
135
        CancelB = new QPushButton( CommonStrings::tr_Cancel, this );
79
136
        CancelB->setAutoDefault( false );
80
137
        Layout1->addWidget( CancelB );
81
138
        TabbedNewDocLayout->addLayout( Layout1 );
82
139
        //tooltips
83
 
        QToolTip::add( pageSizeComboBox, tr( "Document page size, either a standard size or a custom size" ) );
84
 
        QToolTip::add( pageOrientationComboBox, tr( "Orientation of the document's pages" ) );
85
 
        QToolTip::add( widthMSpinBox, tr( "Width of the document's pages, editable if you have chosen a custom page size" ) );
86
 
        QToolTip::add( heightMSpinBox, tr( "Height of the document's pages, editable if you have chosen a custom page size" ) );
87
 
        QToolTip::add( pageCountSpinBox, tr( "Initial number of pages of the document" ) );
88
 
        QToolTip::add( unitOfMeasureComboBox, tr( "Default unit of measurement for document editing" ) );
89
 
        QToolTip::add( autoTextFrame, tr( "Create text frames automatically when new pages are added" ) );
90
 
        QToolTip::add( numberOfCols, tr( "Number of columns to create in automatically created text frames" ) );
91
 
        QToolTip::add( Distance, tr( "Distance between automatically created columns" ) );
 
140
        pageSizeComboBox->setToolTip( tr( "Document page size, either a standard size or a custom size" ) );
 
141
        pageOrientationComboBox->setToolTip( tr( "Orientation of the document's pages" ) );
 
142
        widthSpinBox->setToolTip( tr( "Width of the document's pages, editable if you have chosen a custom page size" ) );
 
143
        heightSpinBox->setToolTip( tr( "Height of the document's pages, editable if you have chosen a custom page size" ) );
 
144
        pageCountSpinBox->setToolTip( tr( "Initial number of pages of the document" ) );
 
145
        unitOfMeasureComboBox->setToolTip( tr( "Default unit of measurement for document editing" ) );
 
146
        autoTextFrame->setToolTip( tr( "Create text frames automatically when new pages are added" ) );
 
147
        numberOfCols->setToolTip( tr( "Number of columns to create in automatically created text frames" ) );
 
148
        Distance->setToolTip( tr( "Distance between automatically created columns" ) );
92
149
 
93
150
        // signals and slots connections
94
151
        connect( OKButton, SIGNAL( clicked() ), this, SLOT( ExitOK() ) );
96
153
        connect(pageSizeComboBox, SIGNAL(activated(const QString &)), this, SLOT(setPGsize(const QString &)));
97
154
        connect(pageOrientationComboBox, SIGNAL(activated(int)), this, SLOT(setOrien(int)));
98
155
        connect(unitOfMeasureComboBox, SIGNAL(activated(int)), this, SLOT(setUnit(int)));
99
 
        connect(Distance, SIGNAL(valueChanged(int)), this, SLOT(setDist(int)));
 
156
        connect(Distance, SIGNAL(valueChanged(double)), this, SLOT(setDist(double)));
100
157
        connect(autoTextFrame, SIGNAL(clicked()), this, SLOT(handleAutoFrame()));
101
 
        connect(layoutsView, SIGNAL(clicked(QIconViewItem *)), this, SLOT(itemSelected(QIconViewItem* )));
 
158
        connect(layoutsView, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
159
        connect(layoutsView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
160
        connect(layoutsView, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
161
        connect(layoutsView, SIGNAL(itemPressed(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
102
162
        if (startUp)
103
 
                connect(recentDocListBox, SIGNAL(selected(int)), this, SLOT(recentDocListBox_doubleClicked(int)));
 
163
                connect(recentDocListBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(recentDocListBox_doubleClicked()));
104
164
 
105
 
        setMinimumSize(minimumSizeHint());
106
 
        setMaximumSize(minimumSizeHint());
107
 
        resize(minimumSizeHint());
108
 
        clearWState( WState_Polished );
 
165
//      setMinimumSize(minimumSizeHint());
 
166
//      setMaximumSize(minimumSizeHint());
 
167
//      resize(minimumSizeHint());
109
168
}
110
169
 
111
170
void NewDoc::createNewDocPage()
112
171
{
113
 
        newDocFrame = new QFrame(this, "newDocFrame");
 
172
        newDocFrame = new QFrame(this);
114
173
 
115
 
        pageSizeGroupBox = new QGroupBox(newDocFrame, "pageSizeGroupBox" );
 
174
        pageSizeGroupBox = new QGroupBox(newDocFrame );
116
175
        pageSizeGroupBox->setTitle( tr( "Document Layout" ) );
117
 
        pageSizeGroupBox->setColumnLayout(0, Qt::Vertical );
118
 
        pageSizeGroupBox->layout()->setSpacing( 5 );
119
 
        pageSizeGroupBox->layout()->setMargin( 10 );
120
 
        pageSizeGroupBoxLayout = new QGridLayout( pageSizeGroupBox->layout() );
 
176
        pageSizeGroupBoxLayout = new QGridLayout( pageSizeGroupBox );
 
177
        pageSizeGroupBoxLayout->setMargin(10);
 
178
        pageSizeGroupBoxLayout->setSpacing(5);
121
179
        pageSizeGroupBoxLayout->setAlignment( Qt::AlignTop );
122
180
 
123
 
        layoutsView = new QIconView( pageSizeGroupBox, "layoutsView" );
124
 
        layoutsView->setHScrollBarMode( QIconView::Auto );
125
 
        layoutsView->setVScrollBarMode( QIconView::Auto );
126
 
        layoutsView->setArrangement(QIconView::LeftToRight);
127
 
        layoutsView->setItemsMovable(false);
128
 
        layoutsView->setSorting( false );
129
 
        layoutsView->setFocusPolicy(QWidget::NoFocus);
130
 
        layoutsView->setSelectionMode(QIconView::Single);
131
 
        layoutsView->clear();
132
 
        for (uint pg = 0; pg < prefsManager->appPrefs.pageSets.count(); ++pg)
 
181
        layoutsView = new PageLayoutsWidget( pageSizeGroupBox );
 
182
        layoutsView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
 
183
        for (int pg = 0; pg < prefsManager->appPrefs.pageSets.count(); ++pg)
133
184
        {
134
 
                QIconViewItem *ic;
 
185
                QListWidgetItem *ic;
135
186
                QString psname=CommonStrings::translatePageSetString(prefsManager->appPrefs.pageSets[pg].Name);
136
187
                if (pg == 0)
137
188
                {
138
 
                        ic = new QIconViewItem( layoutsView, psname, loadIcon("32/page-simple.png") );
139
 
                        ic->setDragEnabled(false);
 
189
                        ic = new QListWidgetItem( QIcon(loadIcon("32/page-simple.png")), psname, layoutsView );
 
190
                        ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
140
191
                }
141
192
                else if (pg == 1)
142
193
                {
143
 
                        ic = new QIconViewItem( layoutsView, psname, loadIcon("32/page-doublesided.png") );
144
 
                        ic->setDragEnabled(false);
 
194
                        ic = new QListWidgetItem( QIcon(loadIcon("32/page-doublesided.png")), psname, layoutsView );
 
195
                        ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
145
196
                }
146
197
                else if (pg == 2)
147
198
                {
148
 
                        ic = new QIconViewItem( layoutsView, psname, loadIcon("32/page-3fold.png") );
149
 
                        ic->setDragEnabled(false);
 
199
                        ic = new QListWidgetItem( QIcon(loadIcon("32/page-3fold.png")), psname, layoutsView );
 
200
                        ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
150
201
                }
151
202
                else if (pg == 3)
152
203
                {
153
 
                        ic = new QIconViewItem( layoutsView, psname, loadIcon("32/page-4fold.png") );
154
 
                        ic->setDragEnabled(false);
 
204
                        ic = new QListWidgetItem( QIcon(loadIcon("32/page-4fold.png")), psname, layoutsView );
 
205
                        ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
155
206
                }
156
207
                else
157
208
                {
158
 
                        ic = new QIconViewItem( layoutsView, psname, loadIcon("32/page-simple.png") );
159
 
                        ic->setDragEnabled(false);
 
209
                        ic = new QListWidgetItem( QIcon(loadIcon("32/page-simple.png")), psname, layoutsView );
 
210
                        ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
160
211
                }
161
212
        }
162
 
        pageSizeGroupBoxLayout->addMultiCellWidget( layoutsView, 0, 4, 0, 0 );
163
 
 
164
 
 
165
 
        TextLabel1 = new QLabel( tr( "&Size:" ), pageSizeGroupBox, "TextLabel1" );
 
213
        layoutsView->arrangeIcons();
 
214
        pageSizeGroupBoxLayout->addWidget( layoutsView, 0, 0, 5, 1 );
 
215
        layoutsView->arrangeIcons();
 
216
 
 
217
 
 
218
        TextLabel1 = new QLabel( tr( "&Size:" ), pageSizeGroupBox );
166
219
        pageSizeGroupBoxLayout->addWidget( TextLabel1, 0, 1 );
167
220
        PageSize ps(prefsManager->appPrefs.pageSize);
168
 
        pageSizeComboBox = new QComboBox( true, pageSizeGroupBox, "pageSizeComboBox" );
169
 
        pageSizeComboBox->insertStringList(ps.sizeTRList());
170
 
        pageSizeComboBox->insertItem( CommonStrings::trCustomPageSize );
 
221
        pageSizeComboBox = new QComboBox( pageSizeGroupBox );
 
222
        pageSizeComboBox->addItems(ps.sizeTRList());
 
223
        pageSizeComboBox->addItem( CommonStrings::trCustomPageSize );
171
224
        pageSizeComboBox->setEditable(false);
172
225
        TextLabel1->setBuddy(pageSizeComboBox);
173
226
        pageSizeGroupBoxLayout->addWidget(pageSizeComboBox, 0, 2 );
174
 
        TextLabel2 = new QLabel( tr( "Orie&ntation:" ), pageSizeGroupBox, "TextLabel2" );
 
227
        TextLabel2 = new QLabel( tr( "Orie&ntation:" ), pageSizeGroupBox );
175
228
        pageSizeGroupBoxLayout->addWidget( TextLabel2, 1, 1 );
176
 
        pageOrientationComboBox = new QComboBox( true, pageSizeGroupBox, "pageOrientationComboBox" );
177
 
        pageOrientationComboBox->insertItem( tr( "Portrait" ) );
178
 
        pageOrientationComboBox->insertItem( tr( "Landscape" ) );
 
229
        pageOrientationComboBox = new QComboBox( pageSizeGroupBox );
 
230
        pageOrientationComboBox->addItem( tr( "Portrait" ) );
 
231
        pageOrientationComboBox->addItem( tr( "Landscape" ) );
179
232
        pageOrientationComboBox->setEditable(false);
180
 
        pageOrientationComboBox->setCurrentItem(prefsManager->appPrefs.pageOrientation);
 
233
        pageOrientationComboBox->setCurrentIndex(prefsManager->appPrefs.pageOrientation);
181
234
        TextLabel2->setBuddy(pageOrientationComboBox);
182
235
        pageSizeGroupBoxLayout->addWidget( pageOrientationComboBox, 1, 2 );
183
236
 
184
 
        TextLabel1_2 = new QLabel( tr( "&Width:" ), pageSizeGroupBox, "TextLabel1_2" );
 
237
        TextLabel1_2 = new QLabel( tr( "&Width:" ), pageSizeGroupBox );
185
238
        pageSizeGroupBoxLayout->addWidget(TextLabel1_2, 2, 1 );
186
 
        widthMSpinBox = new MSpinBox( 1, 10000, pageSizeGroupBox, precision );
187
 
        widthMSpinBox->setSuffix(unitSuffix);
188
 
        TextLabel1_2->setBuddy(widthMSpinBox);
189
 
        pageSizeGroupBoxLayout->addWidget(widthMSpinBox, 2, 2 );
190
 
        TextLabel2_2 = new QLabel( tr( "&Height:" ), pageSizeGroupBox, "TextLabel2_2" );
 
239
        widthSpinBox = new ScrSpinBox( 1, 16777215, pageSizeGroupBox, unitIndex );
 
240
        widthSpinBox->setSuffix(unitSuffix);
 
241
        TextLabel1_2->setBuddy(widthSpinBox);
 
242
        pageSizeGroupBoxLayout->addWidget(widthSpinBox, 2, 2 );
 
243
        TextLabel2_2 = new QLabel( tr( "&Height:" ), pageSizeGroupBox );
191
244
        pageSizeGroupBoxLayout->addWidget(TextLabel2_2, 3, 1 );
192
 
        heightMSpinBox = new MSpinBox( 1, 10000, pageSizeGroupBox, precision );
193
 
        heightMSpinBox->setSuffix(unitSuffix);
194
 
        TextLabel2_2->setBuddy(heightMSpinBox);
195
 
        pageSizeGroupBoxLayout->addWidget(heightMSpinBox, 3, 2 );
196
 
        layoutLabel1 = new QLabel( pageSizeGroupBox, "layoutLabel1" );
 
245
        heightSpinBox = new ScrSpinBox( 1, 16777215, pageSizeGroupBox, unitIndex );
 
246
        heightSpinBox->setSuffix(unitSuffix);
 
247
        TextLabel2_2->setBuddy(heightSpinBox);
 
248
        pageSizeGroupBoxLayout->addWidget(heightSpinBox, 3, 2 );
 
249
        layoutLabel1 = new QLabel( pageSizeGroupBox );
197
250
        layoutLabel1->setText( tr( "First Page is:" ) );
198
251
        pageSizeGroupBoxLayout->addWidget( layoutLabel1, 4, 1 );
199
 
        firstPage = new ScComboBox( false, pageSizeGroupBox, "firstPage" );
 
252
        firstPage = new ScComboBox( pageSizeGroupBox );
200
253
        firstPage->clear();
201
254
        pageSizeGroupBoxLayout->addWidget( firstPage, 4, 2 );
202
255
        selectItem(prefsManager->appPrefs.FacingPages);
203
 
        firstPage->setCurrentItem(prefsManager->appPrefs.pageSets[prefsManager->appPrefs.FacingPages].FirstPage);
 
256
        firstPage->setCurrentIndex(prefsManager->appPrefs.pageSets[prefsManager->appPrefs.FacingPages].FirstPage);
204
257
 
205
258
        MarginStruct marg(prefsManager->appPrefs.margins);
206
259
        marginGroup = new MarginWidget(newDocFrame,  tr( "Margin Guides" ), &marg, unitIndex );
207
260
        marginGroup->setPageWidthHeight(prefsManager->appPrefs.PageWidth, prefsManager->appPrefs.PageHeight);
208
261
        marginGroup->setFacingPages(!(prefsManager->appPrefs.FacingPages == singlePage));
209
 
        widthMSpinBox->setValue(prefsManager->appPrefs.PageWidth * unitRatio);
210
 
        heightMSpinBox->setValue(prefsManager->appPrefs.PageHeight * unitRatio);
 
262
        widthSpinBox->setValue(prefsManager->appPrefs.PageWidth * unitRatio);
 
263
        heightSpinBox->setValue(prefsManager->appPrefs.PageHeight * unitRatio);
211
264
        QStringList pageSizes=ps.sizeList();
212
 
        int sizeIndex=pageSizes.findIndex(ps.nameTR());
 
265
        int sizeIndex=pageSizes.indexOf(ps.nameTR());
213
266
        if (sizeIndex!=-1)
214
 
                pageSizeComboBox->setCurrentItem(sizeIndex);
 
267
                pageSizeComboBox->setCurrentIndex(sizeIndex);
215
268
        else
216
 
                pageSizeComboBox->setCurrentItem(pageSizeComboBox->count()-1);
 
269
                pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
217
270
        marginGroup->setPageSize(pageSizeComboBox->currentText());
218
271
        setDS(prefsManager->appPrefs.FacingPages);
219
272
        setSize(prefsManager->appPrefs.pageSize);
220
273
        setOrien(prefsManager->appPrefs.pageOrientation);
221
 
        widthMSpinBox->setValue(prefsManager->appPrefs.PageWidth * unitRatio);
222
 
        heightMSpinBox->setValue(prefsManager->appPrefs.PageHeight * unitRatio);
223
274
        marginGroup->setNewBleeds(prefsManager->appPrefs.bleeds);
 
275
        marginGroup->setMarginPreset(prefsManager->appPrefs.marginPreset);
224
276
 
225
 
        optionsGroupBox = new QGroupBox( newDocFrame, "optionsGroupBox" );
 
277
        optionsGroupBox = new QGroupBox( newDocFrame );
226
278
        optionsGroupBox->setTitle( tr( "Options" ) );
227
 
        optionsGroupBox->setColumnLayout(0, Qt::Vertical );
228
 
        optionsGroupBox->layout()->setSpacing( 5 );
229
 
        optionsGroupBox->layout()->setMargin( 10 );
230
 
        optionsGroupBoxLayout = new QGridLayout( optionsGroupBox->layout() );
 
279
        optionsGroupBoxLayout = new QFormLayout( optionsGroupBox );
 
280
        optionsGroupBoxLayout->setSpacing( 5 );
 
281
        optionsGroupBoxLayout->setMargin( 10 );
231
282
        optionsGroupBoxLayout->setAlignment( Qt::AlignTop );
232
 
        pageCountLabel = new QLabel( tr( "N&umber of Pages:" ), optionsGroupBox, "pageCountLabel" );
 
283
        optionsGroupBoxLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
 
284
        optionsGroupBoxLayout->setLabelAlignment(Qt::AlignLeft);
 
285
        pageCountLabel = new QLabel( tr( "N&umber of Pages:" ), optionsGroupBox );
233
286
 
234
 
        pageCountSpinBox = new QSpinBox( optionsGroupBox, "pageCountSpinBox" );
235
 
        pageCountSpinBox->setMaxValue( 10000 );
236
 
        pageCountSpinBox->setMinValue( 1 );
 
287
        pageCountSpinBox = new QSpinBox( optionsGroupBox );
 
288
        pageCountSpinBox->setMaximum( 10000 );
 
289
        pageCountSpinBox->setMinimum( 1 );
237
290
        pageCountLabel->setBuddy(pageCountSpinBox);
238
 
        unitOfMeasureLabel = new QLabel( tr( "&Default Unit:" ), optionsGroupBox, "unitOfMeasureLabel" );
239
 
        unitOfMeasureComboBox = new QComboBox( true, optionsGroupBox, "unitOfMeasureComboBox" );
240
 
        unitOfMeasureComboBox->insertStringList(unitGetTextUnitList());
241
 
        unitOfMeasureComboBox->setCurrentItem(unitIndex);
 
291
        unitOfMeasureLabel = new QLabel( tr( "&Default Unit:" ), optionsGroupBox );
 
292
        unitOfMeasureComboBox = new QComboBox( optionsGroupBox );
 
293
        unitOfMeasureComboBox->addItems(unitGetTextUnitList());
 
294
        unitOfMeasureComboBox->setCurrentIndex(unitIndex);
242
295
        unitOfMeasureComboBox->setEditable(false);
243
296
        unitOfMeasureLabel->setBuddy(unitOfMeasureComboBox);
244
 
        optionsGroupBoxLayout->addWidget( pageCountLabel, 0, 0 );
245
 
        optionsGroupBoxLayout->addWidget( pageCountSpinBox, 0, 1 );
246
 
        optionsGroupBoxLayout->addWidget( unitOfMeasureLabel, 1, 0 );
247
 
        optionsGroupBoxLayout->addWidget( unitOfMeasureComboBox, 1, 1 );
 
297
        optionsGroupBoxLayout->addRow( pageCountLabel, pageCountSpinBox);
 
298
        optionsGroupBoxLayout->addRow( unitOfMeasureLabel, unitOfMeasureComboBox );
248
299
 
249
 
        autoTextFrame = new QCheckBox( optionsGroupBox, "autoTextFrame" );
 
300
        autoTextFrame = new QCheckBox( optionsGroupBox );
250
301
        autoTextFrame->setText( tr( "&Automatic Text Frames" ) );
251
 
        optionsGroupBoxLayout->addMultiCellWidget( autoTextFrame, 2, 2, 0, 1 );
252
 
        TextLabel3 = new QLabel( tr( "Colu&mns:" ), optionsGroupBox, "TextLabel3" );
253
 
        optionsGroupBoxLayout->addWidget( TextLabel3, 3, 0 );
254
 
        numberOfCols = new QSpinBox( optionsGroupBox, "numberOfCols" );
 
302
        optionsGroupBoxLayout->addRow( autoTextFrame );
 
303
        TextLabel3 = new QLabel( tr( "Colu&mns:" ), optionsGroupBox );
 
304
        numberOfCols = new QSpinBox( optionsGroupBox );
255
305
        numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows );
256
 
        numberOfCols->setMinValue( 1 );
 
306
        numberOfCols->setMinimum( 1 );
257
307
        numberOfCols->setValue( 1 );
258
308
        TextLabel3->setBuddy(numberOfCols);
259
 
        optionsGroupBoxLayout->addWidget( numberOfCols, 3, 1);
 
309
        optionsGroupBoxLayout->addRow( TextLabel3, numberOfCols );
260
310
 
261
 
        TextLabel4 = new QLabel( tr( "&Gap:" ), optionsGroupBox, "TextLabel4" );
262
 
        optionsGroupBoxLayout->addWidget( TextLabel4, 4, 0 );
263
 
        Distance = new MSpinBox( 0, 1000, optionsGroupBox, precision );
264
 
        Distance->setSuffix( unitSuffix );
 
311
        TextLabel4 = new QLabel( tr( "&Gap:" ), optionsGroupBox );
 
312
        Distance = new ScrSpinBox( 0, 1000, optionsGroupBox, unitIndex );
265
313
        Distance->setValue(11 * unitRatio);
266
314
        Dist = 11;
267
 
        optionsGroupBoxLayout->addWidget( Distance, 4, 1);
 
315
        optionsGroupBoxLayout->addRow( TextLabel4, Distance );
268
316
        TextLabel4->setBuddy(Distance);
269
317
 
270
318
        TextLabel3->setEnabled(false);
271
319
        TextLabel4->setEnabled(false);
272
320
        Distance->setEnabled(false);
273
321
        numberOfCols->setEnabled(false);
274
 
        startDocSetup = new QCheckBox( optionsGroupBox, "startDocSetup" );
 
322
        startDocSetup = new QCheckBox( optionsGroupBox );
275
323
        startDocSetup->setText( tr( "Show Document Settings After Creation" ) );
276
324
        startDocSetup->setChecked(false);
277
 
        optionsGroupBoxLayout->addMultiCellWidget( startDocSetup, 5, 5, 0, 1 );
278
 
 
279
 
        NewDocLayout = new QGridLayout( newDocFrame, 2, 2, 10, 5, "NewDocLayout");
 
325
        optionsGroupBoxLayout->addRow( startDocSetup );
 
326
        NewDocLayout = new QGridLayout( newDocFrame );
 
327
        NewDocLayout->setMargin(10);
 
328
        NewDocLayout->setSpacing(5);
280
329
        NewDocLayout->addWidget( marginGroup, 1, 0 );
281
330
        NewDocLayout->addWidget( optionsGroupBox, 1, 1 );
282
 
        NewDocLayout->addMultiCellWidget( pageSizeGroupBox, 0, 0, 0, 1);
 
331
        NewDocLayout->addWidget( pageSizeGroupBox, 0, 0, 1, 2);
283
332
}
284
333
 
285
334
void NewDoc::createOpenDocPage()
292
341
        else
293
342
                docDir = docContext->get("docsopen", ".");
294
343
        QString formats(FileLoader::getLoadFilterString());
295
 
        openDocFrame = new QFrame(this, "openDocFrame");
296
 
        QVBoxLayout* openDocLayout = new QVBoxLayout(openDocFrame, 5,5, "openDocLayout");
 
344
        formats.remove("PDF (*.pdf *.PDF);;");
 
345
        openDocFrame = new QFrame(this);
 
346
        openDocLayout = new QVBoxLayout(openDocFrame);
 
347
        openDocLayout->setMargin(5);
 
348
        openDocLayout->setSpacing(5);
 
349
        selectedFile = "";
 
350
#if QT_VERSION  >= 0x040300
 
351
        fileDialog = new QFileDialog(openDocFrame, tr("Open"), docDir, formats);
 
352
        fileDialog->setFileMode(QFileDialog::ExistingFile);
 
353
        fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
 
354
        fileDialog->setReadOnly(true);
 
355
#else
297
356
        fileDialog = new CustomFDialog(openDocFrame, docDir, tr("Open"), formats, fdNone);
 
357
#endif
298
358
        fileDialog->setSizeGripEnabled(false);
299
359
        fileDialog->setModal(false);
300
 
        QObjectList *l = fileDialog->queryList("QPushButton");
301
 
        QObjectListIt it(*l);
302
 
        QObject *obj;
303
 
        while ((obj = it.current()) != 0)
304
 
        {
305
 
                ++it;
306
 
                ((QPushButton*)obj)->hide();
307
 
        }
308
 
        delete l;
309
 
        QPoint point = QPoint(0,0);
310
 
        fileDialog->reparent(openDocFrame, point);
 
360
        QList<QPushButton *> b = fileDialog->findChildren<QPushButton *>();
 
361
        QListIterator<QPushButton *> i(b);
 
362
        while (i.hasNext())
 
363
                i.next()->setVisible(false);
 
364
        fileDialog->setWindowFlags(Qt::Widget);
311
365
        openDocLayout->addWidget(fileDialog);
312
 
        connect(fileDialog, SIGNAL(fileSelected ( const QString & )), this, SLOT(openFile(const QString& )));
 
366
#if QT_VERSION  >= 0x040300
 
367
        connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(openFile()));
 
368
#else
 
369
        connect(fileDialog, SIGNAL(fileSelected (const QString &)), this, SLOT(openFile()));
 
370
#endif
313
371
}
314
372
 
315
 
void NewDoc::openFile(const QString &)
 
373
void NewDoc::openFile()
316
374
{
317
375
        ExitOK();
318
376
}
319
377
 
320
378
void NewDoc::createRecentDocPage()
321
379
{
322
 
        recentDocFrame = new QFrame(this, "recentDocFrame");
323
 
        recentDocLayout = new QVBoxLayout(recentDocFrame, 5, 5, "recentDocLayout");
324
 
        recentDocListBox = new QListBox(recentDocFrame, "recentDocListBox");
 
380
        recentDocFrame = new QFrame(this);
 
381
        recentDocLayout = new QVBoxLayout(recentDocFrame);
 
382
        recentDocLayout->setMargin(5);
 
383
        recentDocLayout->setSpacing(5);
 
384
        recentDocListBox = new QListWidget(recentDocFrame);
325
385
        recentDocLayout->addWidget(recentDocListBox);
326
 
        uint max = QMIN(prefsManager->appPrefs.RecentDCount, recentDocList.count());
 
386
        uint max = qMin(prefsManager->appPrefs.RecentDCount, recentDocList.count());
327
387
        for (uint m = 0; m < max; ++m)
328
 
                recentDocListBox->insertItem( QDir::convertSeparators(recentDocList[m]) );
 
388
                recentDocListBox->addItem( QDir::convertSeparators(recentDocList[m]) );
329
389
}
330
390
 
331
 
void NewDoc::setWidth(int)
 
391
void NewDoc::setWidth(double)
332
392
{
333
 
        pageWidth = widthMSpinBox->value() / unitRatio;
 
393
        pageWidth = widthSpinBox->value() / unitRatio;
334
394
        marginGroup->setPageWidth(pageWidth);
335
395
        QString psText=pageSizeComboBox->currentText();
336
396
        if (psText!=CommonStrings::trCustomPageSize && psText!=CommonStrings::customPageSize)
337
 
                pageSizeComboBox->setCurrentItem(pageSizeComboBox->count()-1);
 
397
                pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
338
398
}
339
399
 
340
 
void NewDoc::setHeight(int)
 
400
void NewDoc::setHeight(double)
341
401
{
342
 
        pageHeight = heightMSpinBox->value() / unitRatio;
 
402
        pageHeight = heightSpinBox->value() / unitRatio;
343
403
        marginGroup->setPageHeight(pageHeight);
344
404
        QString psText=pageSizeComboBox->currentText();
345
405
        if (psText!=CommonStrings::trCustomPageSize && psText!=CommonStrings::customPageSize)
346
 
                pageSizeComboBox->setCurrentItem(pageSizeComboBox->count()-1);
 
406
                pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
347
407
}
348
408
 
349
409
void NewDoc::selectItem(uint nr)
350
410
{
351
 
        QIconViewItem* ic=0;
352
 
        uint cce;
353
 
        disconnect(layoutsView, SIGNAL(clicked(QIconViewItem *)), this, SLOT(itemSelected(QIconViewItem* )));
354
 
        ic = layoutsView->firstItem();
355
 
        cce = layoutsView->count();
356
 
        for (uint cc = 0; cc < cce; ++cc)
 
411
        disconnect(layoutsView, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
412
        disconnect(layoutsView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
413
        disconnect(layoutsView, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
414
        disconnect(layoutsView, SIGNAL(itemPressed(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
415
        if (nr > 0)
357
416
        {
358
 
                if (cc == nr)
 
417
                firstPage->setEnabled(true);
 
418
                firstPage->clear();
 
419
                QStringList::Iterator pNames;
 
420
                for(pNames = prefsManager->appPrefs.pageSets[nr].pageNames.begin(); pNames != prefsManager->appPrefs.pageSets[nr].pageNames.end(); ++pNames )
359
421
                {
360
 
                        if (cc > 0)
361
 
                        {
362
 
                                firstPage->setEnabled(true);
363
 
                                firstPage->clear();
364
 
                                QStringList::Iterator pNames;
365
 
                                for(pNames = prefsManager->appPrefs.pageSets[cc].pageNames.begin(); pNames != prefsManager->appPrefs.pageSets[cc].pageNames.end(); ++pNames )
366
 
                                {
367
 
                                        firstPage->insertItem(CommonStrings::translatePageSetLocString((*pNames)));
368
 
                                }
369
 
                        }
370
 
                        else
371
 
                        {
372
 
                                firstPage->clear();
373
 
                                firstPage->insertItem(" ");
374
 
                                firstPage->setEnabled(false);
375
 
                        }
376
 
                        layoutsView->setSelected(ic, true);
377
 
                        break;
 
422
                        firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames)));
378
423
                }
379
 
                ic = ic->nextItem();
380
 
        }
381
 
        connect(layoutsView, SIGNAL(clicked(QIconViewItem *)), this, SLOT(itemSelected(QIconViewItem* )));
 
424
        }
 
425
        else
 
426
        {
 
427
                firstPage->clear();
 
428
                firstPage->addItem(" ");
 
429
                firstPage->setEnabled(false);
 
430
        }
 
431
        layoutsView->setCurrentRow(nr);
 
432
        layoutsView->item(nr)->setSelected(true);
 
433
        connect(layoutsView, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
434
        connect(layoutsView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
435
        connect(layoutsView, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
 
436
        connect(layoutsView, SIGNAL(itemPressed(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* )));
382
437
}
383
438
 
384
 
void NewDoc::itemSelected(QIconViewItem* ic)
 
439
void NewDoc::itemSelected(QListWidgetItem* ic)
385
440
{
386
441
        if (ic == 0)
387
442
                return;
388
 
        selectItem(layoutsView->index(ic));
389
 
        setDS(layoutsView->index(ic));
 
443
        selectItem(layoutsView->row(ic));
 
444
        setDS(layoutsView->row(ic));
390
445
}
391
446
 
392
447
void NewDoc::handleAutoFrame()
407
462
        }
408
463
}
409
464
 
410
 
void NewDoc::setDist(int)
 
465
void NewDoc::setDist(double)
411
466
{
412
467
        Dist = Distance->value() / unitRatio;
413
468
}
414
469
 
415
470
void NewDoc::setUnit(int newUnitIndex)
416
471
{
417
 
        disconnect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setWidth(int)));
418
 
        disconnect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setHeight(int)));
419
 
 
420
 
        double oldUnitRatio = unitRatio;
 
472
        disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 
473
        disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
 
474
        widthSpinBox->setNewUnit(newUnitIndex);
 
475
        heightSpinBox->setNewUnit(newUnitIndex);
 
476
        Distance->setNewUnit(newUnitIndex);
 
477
        unitRatio = unitGetRatioFromIndex(newUnitIndex);
 
478
        unitIndex = newUnitIndex;
 
479
/*      
 
480
double oldUnitRatio = unitRatio;
421
481
        double val, oldB, oldBM, oldH, oldHM;
422
482
        int decimals;
423
 
        widthMSpinBox->getValues(&oldB, &oldBM, &decimals, &val);
 
483
        widthSpinBox->getValues(&oldB, &oldBM, &decimals, &val);
424
484
        oldB /= oldUnitRatio;
425
485
        oldBM /= oldUnitRatio;
426
 
        heightMSpinBox->getValues(&oldH, &oldHM, &decimals, &val);
 
486
        heightSpinBox->getValues(&oldH, &oldHM, &decimals, &val);
427
487
        oldH /= oldUnitRatio;
428
488
        oldHM /= oldUnitRatio;
429
489
 
432
492
        decimals = unitGetDecimalsFromIndex(newUnitIndex);
433
493
        if (pageOrientationComboBox->currentItem() == portraitPage)
434
494
        {
435
 
                widthMSpinBox->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, pageWidth * unitRatio);
436
 
                heightMSpinBox->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, pageHeight * unitRatio);
 
495
                widthSpinBox->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, pageWidth * unitRatio);
 
496
                heightSpinBox->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, pageHeight * unitRatio);
437
497
        }
438
498
        else
439
499
        {
440
 
                widthMSpinBox->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, pageHeight * unitRatio);
441
 
                heightMSpinBox->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, pageWidth * unitRatio);
 
500
                widthSpinBox->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, pageHeight * unitRatio);
 
501
                heightSpinBox->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, pageWidth * unitRatio);
442
502
        }
443
503
        Distance->setValue(Dist * unitRatio);
444
504
        unitSuffix = unitGetSuffixFromIndex(newUnitIndex);
445
 
        widthMSpinBox->setSuffix(unitSuffix);
446
 
        heightMSpinBox->setSuffix(unitSuffix);
 
505
        widthSpinBox->setSuffix(unitSuffix);
 
506
        heightSpinBox->setSuffix(unitSuffix);
447
507
        Distance->setSuffix( unitSuffix );
448
 
        marginGroup->unitChange(unitRatio, decimals, unitSuffix);
 
508
*/
 
509
        marginGroup->setNewUnit(unitIndex);
449
510
        marginGroup->setPageHeight(pageHeight);
450
511
        marginGroup->setPageWidth(pageWidth);
451
 
        connect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setWidth(int)));
452
 
        connect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setHeight(int)));
 
512
        connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 
513
        connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
453
514
 
454
515
}
455
516
 
456
517
void NewDoc::ExitOK()
457
518
{
458
 
        pageWidth = widthMSpinBox->value() / unitRatio;
459
 
        pageHeight = heightMSpinBox->value() / unitRatio;
 
519
        pageWidth = widthSpinBox->value() / unitRatio;
 
520
        pageHeight = heightSpinBox->value() / unitRatio;
460
521
        bleedBottom = marginGroup->bottomBleed();
461
522
        bleedTop = marginGroup->topBleed();
462
523
        bleedLeft = marginGroup->leftBleed();
463
524
        bleedRight = marginGroup->rightBleed();
464
525
        if (onStartup)
465
 
                tabSelected = tabWidget->currentPageIndex();
 
526
        {
 
527
                tabSelected = tabWidget->currentIndex();
 
528
#if QT_VERSION  >= 0x040300
 
529
                QStringList files = fileDialog->selectedFiles();
 
530
                if (files.count() != 0)
 
531
                        selectedFile = files[0];
 
532
#else
 
533
                selectedFile = fileDialog->selectedFile();
 
534
#endif
 
535
        }
466
536
        else
467
537
                tabSelected = 0;
468
538
        accept();
471
541
void NewDoc::setOrien(int ori)
472
542
{
473
543
        double br;
474
 
        disconnect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setWidth(int)));
475
 
        disconnect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setHeight(int)));
 
544
        disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 
545
        disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
476
546
        if (ori != Orient)
477
547
        {
478
 
                br = widthMSpinBox->value();
479
 
                widthMSpinBox->setValue(heightMSpinBox->value());
480
 
                heightMSpinBox->setValue(br);
 
548
                br = widthSpinBox->value();
 
549
                widthSpinBox->setValue(heightSpinBox->value());
 
550
                heightSpinBox->setValue(br);
481
551
        }
482
552
        // #869 pv - defined constants added + code repeat (check w/h)
483
553
        (ori == portraitPage) ? Orient = portraitPage : Orient = landscapePage;
484
554
        if (pageSizeComboBox->currentText() == CommonStrings::trCustomPageSize)
485
555
        {
486
 
                if (widthMSpinBox->value() > heightMSpinBox->value())
487
 
                        pageOrientationComboBox->setCurrentItem(landscapePage);
 
556
                if (widthSpinBox->value() > heightSpinBox->value())
 
557
                        pageOrientationComboBox->setCurrentIndex(landscapePage);
488
558
                else
489
 
                        pageOrientationComboBox->setCurrentItem(portraitPage);
 
559
                        pageOrientationComboBox->setCurrentIndex(portraitPage);
490
560
        }
491
561
        // end of #869
492
562
        marginGroup->setPageHeight(pageHeight);
493
563
        marginGroup->setPageWidth(pageWidth);
494
 
        connect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setWidth(int)));
495
 
        connect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setHeight(int)));
 
564
        connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 
565
        connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
496
566
}
497
567
 
498
568
void NewDoc::setPGsize(const QString &size)
502
572
        else
503
573
        {
504
574
                setSize(size);
505
 
                setOrien(pageOrientationComboBox->currentItem());
 
575
                setOrien(pageOrientationComboBox->currentIndex());
506
576
        }
507
577
        marginGroup->setPageSize(size);
508
578
}
509
579
 
510
580
void NewDoc::setSize(QString gr)
511
581
{
512
 
        pageWidth = widthMSpinBox->value() / unitRatio;
513
 
        pageHeight = heightMSpinBox->value() / unitRatio;
 
582
        pageWidth = widthSpinBox->value() / unitRatio;
 
583
        pageHeight = heightSpinBox->value() / unitRatio;
514
584
 
515
 
        disconnect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setWidth(int)));
516
 
        disconnect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setHeight(int)));
 
585
        disconnect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 
586
        disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
517
587
        if (gr==CommonStrings::trCustomPageSize || gr==CommonStrings::customPageSize)
518
588
        {
519
 
                //widthMSpinBox->setEnabled(true);
520
 
                //heightMSpinBox->setEnabled(true);
 
589
                widthSpinBox->setEnabled(true);
 
590
                heightSpinBox->setEnabled(true);
521
591
        }
522
592
        else
523
593
        {
524
594
                PageSize *ps2=new PageSize(gr);
525
 
                if (pageOrientationComboBox->currentItem() == portraitPage)
 
595
                if (pageOrientationComboBox->currentIndex() == portraitPage)
526
596
                {
527
597
                        pageWidth = ps2->width();
528
598
                        pageHeight = ps2->height();
532
602
                }
533
603
                delete ps2;
534
604
        }
535
 
        widthMSpinBox->setValue(pageWidth * unitRatio);
536
 
        heightMSpinBox->setValue(pageHeight * unitRatio);
 
605
        widthSpinBox->setValue(pageWidth * unitRatio);
 
606
        heightSpinBox->setValue(pageHeight * unitRatio);
537
607
        marginGroup->setPageHeight(pageHeight);
538
608
        marginGroup->setPageWidth(pageWidth);
539
 
        connect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setWidth(int)));
540
 
        connect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setHeight(int)));
 
609
        connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 
610
        connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
541
611
}
542
612
 
543
613
void NewDoc::setDS(int layout)
544
614
{
545
615
        marginGroup->setFacingPages(!(layout == singlePage));
546
616
        choosenLayout = layout;
547
 
        firstPage->setCurrentItem(prefsManager->appPrefs.pageSets[choosenLayout].FirstPage);
 
617
        firstPage->setCurrentIndex(prefsManager->appPrefs.pageSets[choosenLayout].FirstPage);
548
618
}
549
619
 
550
 
void NewDoc::recentDocListBox_doubleClicked(int /*item*/)
 
620
void NewDoc::recentDocListBox_doubleClicked()
551
621
{
552
622
        /* Yep. There is nothing to solve. ScribusMainWindow handles all
553
623
        openings etc. It's Franz's programming style ;) */